• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## -*-makefile-*-
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
4## os/390, z/OS specific setup
5## Copyright (c) 1999-2014, International Business Machines Corporation and
6## others. All Rights Reserved.
7
8###################################################################
9#                    IMPORTANT NOTE                               #
10###################################################################
11# Before you try to run the Makefile, make sure you have the      #
12# environment variables set.                                      #
13#                                                                 #
14# If you are going to do the OS390BATCH build, make sure you have #
15# the OS390BATCH environment variable set.                        #
16#                                                                 #
17#   export OS390BATCH=1                                           #
18#                                                                 #
19# To build a version of ICU that does not use IEEE Floating point #
20#                                                                 #
21#   export IEEE390=0                                              #
22#                                                                 #
23# To build a version of ICU which uses a two data libraries       #
24# where the smaller one is loaded first, use OS390_STUBDATA.      #
25# USAGE OF THIS OPTION IS DEPRECATED. You should look into using  #
26# Link Pack Area (LPA), library lookaside facility (LLA) or other #
27# z/OS options that enable page fault based loading of read-only  #
28# code/data instead of this option.                               #
29# This option will be removed in a future version of ICU.         #
30#                                                                 #
31#   export OS390_STUBDATA=1                                       #
32#                                                                 #
33# To build a version of ICU which exploits the C/C++ compiler     #
34# and runtime Extra Performance Linkage (XPLINK), specify         #
35#                                                                 #
36#   export OS390_XPLINK=1                                         #
37#                                                                 #
38###################################################################
39
40# TODO: Fix this configuration so that icu-config will work!
41#       If statements don't work well when icu-config is generated.
42ifeq (${IEEE390},)
43IEEE390=1#M#
44endif
45
46ifeq (${IEEE390}, 1)
47ICU_IEEE          = -Wc,'FLOAT(IEEE)' -DIEEE_754=0#M#
48else
49ICU_IEEE          =#M#
50endif
51
52## Additional flags when building libraries and with threads
53THREADSCPPFLAGS = -D_OPEN_THREADS=3
54
55# For a dynamically called DLL module to share access to the POSIX external
56# variables, with its caller, the DLL module must define these _SHR_* macros.
57SHAREDLIBCPPFLAGS	= -D_SHR_TZNAME -D_SHR_TIMEZONE
58
59# -Wc,expo is used to export all functions
60SHAREDLIBCFLAGS	= -Wc,expo
61SHAREDLIBCXXFLAGS	= -Wc,expo
62
63# TODO: Consider using  -Wc,roc,ros for making the data and strings readonly
64#       -Wc,"ros" seems to work, but not the "roc"
65# The RENT option makes the program reentrant. This may not really have the same
66#       meaning as normal reentrancy on other platforms. See the z/OS documentation
67#       for details. This is the default for C++, but not C.
68# The DLL option must be used by the callee and caller code when using shared libraries.
69# NOCSECT might be used as an optimization option.
70# -+ means accept any file extension as a C++ file. By default only .C is accepted.
71CFLAGS          += -Wc,DLL,ROS,RENT,'ARCH(7)','LOC(POSIX)',NOANSIALIAS,'LANGLVL(EXTENDED)' $(ICU_IEEE)
72CXXFLAGS        += -Wc,DLL,ROS,RTTI,'ARCH(7)','LOC(POSIX)',NOANSIALIAS,'LANGLVL(EXTENDED0X)' $(ICU_IEEE) -+
73ARFLAGS         = -cr
74
75# _MSE_PROTOS usually interacts with _XOPEN_SOURCE. It affects some standard
76# C functions that use wchar_t, and it selects behavior for
77# multibyte extension support (MSE) functions.
78#DEFS            += -D_MSE_PROTOS
79
80ifeq (${OS390_XPLINK}, 1)
81#SH# if [ "x$OS390_XPLINK" = "x1" ]; then
82# These lines must be the last options specified.
83# GOFF is is the strategic object module format for S/390. It is required for XPLINK.
84# NOTEMPINC could be used if ICU starts using templates.
85ICU_XPLINK_C      = -Wc,'xplink(backchain,storeargs),goff'
86ICU_XPLINK_CXX    = -Wc,'xplink(backchain,storeargs),goff' -Wc,'NOTEMPINC'
87ICU_XPLINK_L      = -Wl,xplink
88#SH# fi
89endif
90
91## OS390BATCH
92ifeq (${OS390BATCH},1)
93DEFS            += -DOS390BATCH#M#
94endif
95
96## Commands to generate dependency files
97GEN_DEPS.c=	makedep
98GEN_DEPS.cc=	makedep
99
100## Commands to compile
101# _CXX_STEPS="-1" is a prelink step when compiling C and C++, and
102# it's only needed for long function names
103COMPILE.c       = $(COMPILE_LINK_ENVVAR) $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(ICU_XPLINK_C) -c
104COMPILE.cc      = $(COMPILE_LINK_ENVVAR) $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(ICU_XPLINK_CXX) -c
105
106# Commands to link
107LINK.c=		$(COMPILE_LINK_ENVVAR) $(CC) $(CFLAGS) -Wl,dll $(LDFLAGS) $(ICU_XPLINK_L)
108LINK.cc=	$(COMPILE_LINK_ENVVAR) $(CXX) $(CXXFLAGS) -Wl,dll $(LDFLAGS) $(ICU_XPLINK_L)
109
110## Commands for shared library (dll)
111SHLIB.c=	$(LINK.c)
112SHLIB.cc=	$(LINK.cc)
113
114## Compiler switch to embed a runtime search path
115LD_RPATH=	-I
116
117## Environment variable to set a runtime search path
118LDLIBRARYPATH_ENVVAR = LIBPATH
119
120## An import library (a.k.a. sidedeck) is needed for z/OS and MSVC
121IMPORT_LIB_EXT = .x
122
123## Versioned target for a shared library.
124FINAL_SO_TARGET=  $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
125MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
126
127## Versioned import library names.
128IMPORT_LIB = $(basename $(notdir $(SO_TARGET)))$(IMPORT_LIB_EXT)#M#
129MIDDLE_IMPORT_LIB = $(basename $(notdir $(MIDDLE_SO_TARGET)))$(IMPORT_LIB_EXT)#M#
130FINAL_IMPORT_LIB = $(basename $(notdir $(FINAL_SO_TARGET)))$(IMPORT_LIB_EXT)#M#
131
132## Non-shared intermediate object suffix
133STATIC_O = o
134
135ifeq ($(OS390_STUBDATA),1)
136## Suffix of the subset data library for dual common library support
137STUB_SUFFIX=_stub#M#
138DEFS      += -DOS390_STUBDATA -DU_LIBICUDATA_NAME=\"$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)\"#M#
139endif
140
141ifeq ($(OS390BATCH),1)
142## PDS_NAME_PREFIX sets the prefix of the PDS dataset name while keeping the ICU version number.
143## To use custom names set ICU_PDS_NAME and ICU_PDS_NAME_SUFFIX
144## IXM is used as a name prefix for XML Toolkit, default value
145ifeq ($(PDS_NAME_PREFIX),)
146PDS_NAME_PREFIX= IXMI
147endif
148ifeq ($(ICU_PDS_NAME),)
149PDS_FULL_NAME=${PDS_NAME_PREFIX}${SO_TARGET_VERSION_MAJOR}
150else
151PDS_FULL_NAME=${ICU_PDS_NAME}
152endif
153ifeq ($(OS390_STUBDATA),1)
154BATCH_STUB_TARGET=	"//'${LOADMOD}(${PDS_FULL_NAME}D1${ICU_PDS_NAME_SUFFIX})'"
155BATCH_LIBICUDT=		"//'${LOADEXP}(${PDS_FULL_NAME}D1${ICU_PDS_NAME_SUFFIX})'"
156else
157BATCH_STUB_TARGET=	"//'${LOADMOD}(${PDS_FULL_NAME}DA${ICU_PDS_NAME_SUFFIX})'"
158BATCH_LIBICUDT=		"//'${LOADEXP}(${PDS_FULL_NAME}DA${ICU_PDS_NAME_SUFFIX})'"
159PKGDATA_DEFS        += -DU_LIBICUDATA_NAME=\"$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)\"
160endif
161
162BATCH_COMMON_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}UC${ICU_PDS_NAME_SUFFIX})'"
163BATCH_I18N_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}IN${ICU_PDS_NAME_SUFFIX})'"
164BATCH_IO_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}IO${ICU_PDS_NAME_SUFFIX})'"
165BATCH_LAYOUT_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}LE${ICU_PDS_NAME_SUFFIX})'"
166BATCH_LAYOUTEX_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}LX${ICU_PDS_NAME_SUFFIX})'"
167
168BATCH_LIBICUUC=		"//'${LOADEXP}(${PDS_FULL_NAME}UC${ICU_PDS_NAME_SUFFIX})'"
169BATCH_LIBICUI18N=	"//'${LOADEXP}(${PDS_FULL_NAME}IN${ICU_PDS_NAME_SUFFIX})'"
170BATCH_LIBICUIO=		"//'${LOADEXP}(${PDS_FULL_NAME}IO${ICU_PDS_NAME_SUFFIX})'"
171BATCH_LIBICULE=		"//'${LOADEXP}(${PDS_FULL_NAME}LE${ICU_PDS_NAME_SUFFIX})'"
172BATCH_LIBICULX=		"//'${LOADEXP}(${PDS_FULL_NAME}LX${ICU_PDS_NAME_SUFFIX})'"
173endif
174
175
176## Link commands to link to ICU libs
177LIBICUDT=	$(top_builddir)/stubdata/$(LIBICU)data$(ICULIBSUFFIX)$(STUB_SUFFIX)$(SO_TARGET_VERSION).x
178LIBICUUC=	$(top_builddir)/common/$(LIBICU)uc$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
179LIBICUI18N=	$(top_builddir)/i18n/$(LIBICU)i18n$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
180LIBICULX=	$(top_builddir)/layoutex/$(LIBICU)lx$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
181LIBICUIO=	$(top_builddir)/io/$(LIBICU)io$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
182LIBCTESTFW=	$(top_builddir)/tools/ctestfw/$(LIBICU)test$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
183LIBICUTOOLUTIL=	$(top_builddir)/tools/toolutil/$(LIBICU)tu$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
184
185ifneq (${ICUDATA_CHAR},e)
186#SH# if [ "$ICUDATA_CHAR" != "e" ]; then
187## We're in ASCII mode.
188CFLAGS		+= -Wc,'ascii'
189CXXFLAGS	+= -Wc,'ascii'
190SO = so
191else
192#SH# else
193## We're in EBCDIC mode.
194## Shared object suffix
195SO = dll
196endif
197#SH# fi
198
199## Special 390 rules
200
201## Build archive from object
202%.a : $(OBJECTS)
203	$(AR) $(ARFLAGS) $@ $(OBJECTS)
204
205## Compilation rules
206%.$(STATIC_O): $(srcdir)/%.c
207	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
208%.o: $(srcdir)/%.c
209	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
210
211# This causes escapesrc to be built before other ICU targets.
212NEED_ESCAPING=YES
213
214ifneq ($(SKIP_ESCAPING),)
215%.$(STATIC_O): $(srcdir)/%.cpp
216	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
217%.o: $(srcdir)/%.cpp
218	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
219else
220# convert *.cpp files to _*.cpp with \u / \U escaping
221CLEANFILES += _*.cpp
222
223# the actual escaping
224_%.cpp: $(srcdir)/%.cpp
225	@$(BINDIR)/escapesrc$(EXEEXT) $< $@
226
227%.$(STATIC_O): _%.cpp
228	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
229%.o: _%.cpp
230	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
231endif
232
233## Dependency rules
234%.d : %.u
235	@$(SHELL) -ec 'cat $<  \
236		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
237		[ -s $@ ] || rm -f $@ ; rm -f $<'
238
239%.u : $(srcdir)/%.c
240	@echo "generating dependency information for $<"
241	@$(SHELL) -ec 'touch            $*.u  > /dev/null 2>&1'
242	@$(SHELL) -ec '$(GEN_DEPS.c) -f $*.u $< > /dev/null 2>&1'
243
244%.u : $(srcdir)/%.cpp
245	@echo "generating dependency information for $<"
246	@$(SHELL) -ec 'touch              $*.u  > /dev/null 2>&1'
247	@$(SHELL) -ec '$(GEN_DEPS.cc)  -f $*.u $< > /dev/null 2>&1'
248
249## Versioned libraries rules
250%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
251	$(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
252%.$(SO): %$(SO_TARGET_VERSION).$(SO)
253	$(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
254
255## Install libraries as executable
256INSTALL-L=$(INSTALL_PROGRAM)
257
258## End 390-specific setup
259