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.
8 ###################################################################
10 ###################################################################
11 # Before you try to run the Makefile, make sure you have the #
12 # environment variables set. #
14 # If you are going to do the OS390BATCH build, make sure you have #
15 # the OS390BATCH environment variable set. #
17 # export OS390BATCH=1 #
19 # To build a version of ICU that does not use IEEE Floating point #
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. #
31 # export OS390_STUBDATA=1 #
33 # To build a version of ICU which exploits the C/C++ compiler #
34 # and runtime Extra Performance Linkage (XPLINK), specify #
36 # export OS390_XPLINK=1 #
38 ###################################################################
40 # TODO: Fix this configuration so that icu-config will work!
41 # If statements don't work well when icu-config is generated.
47 ICU_IEEE = -Wc,'FLOAT(IEEE)' -DIEEE_754=0#M#
52 ## Additional flags when building libraries and with threads
53 THREADSCPPFLAGS = -D_OPEN_THREADS=3
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.
57 SHAREDLIBCPPFLAGS = -D_SHR_TZNAME -D_SHR_TIMEZONE
59 # -Wc,expo is used to export all functions
60 SHAREDLIBCFLAGS = -Wc,expo
61 SHAREDLIBCXXFLAGS = -Wc,expo
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.
71 CFLAGS += -Wc,DLL,ROS,RENT,'ARCH(7)','LOC(POSIX)',NOANSIALIAS,'LANGLVL(EXTENDED)' $(ICU_IEEE)
72 CXXFLAGS += -Wc,DLL,ROS,RTTI,'ARCH(7)','LOC(POSIX)',NOANSIALIAS,'LANGLVL(EXTENDED0X)' $(ICU_IEEE) -+
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
80 ifeq (${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.
85 ICU_XPLINK_C = -Wc,'xplink(backchain,storeargs),goff'
86 ICU_XPLINK_CXX = -Wc,'xplink(backchain,storeargs),goff' -Wc,'NOTEMPINC'
87 ICU_XPLINK_L = -Wl,xplink
92 ifeq (${OS390BATCH},1)
93 DEFS += -DOS390BATCH#M#
96 ## Commands to generate dependency files
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
103 COMPILE.c = $(COMPILE_LINK_ENVVAR) $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(ICU_XPLINK_C) -c
104 COMPILE.cc = $(COMPILE_LINK_ENVVAR) $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(ICU_XPLINK_CXX) -c
107 LINK.c= $(COMPILE_LINK_ENVVAR) $(CC) $(CFLAGS) -Wl,dll $(LDFLAGS) $(ICU_XPLINK_L)
108 LINK.cc= $(COMPILE_LINK_ENVVAR) $(CXX) $(CXXFLAGS) -Wl,dll $(LDFLAGS) $(ICU_XPLINK_L)
110 ## Commands for shared library (dll)
114 ## Compiler switch to embed a runtime search path
117 ## Environment variable to set a runtime search path
118 LDLIBRARYPATH_ENVVAR = LIBPATH
120 ## An import library (a.k.a. sidedeck) is needed for z/OS and MSVC
123 ## Versioned target for a shared library.
124 FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
125 MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
127 ## Versioned import library names.
128 IMPORT_LIB = $(basename $(notdir $(SO_TARGET)))$(IMPORT_LIB_EXT)#M#
129 MIDDLE_IMPORT_LIB = $(basename $(notdir $(MIDDLE_SO_TARGET)))$(IMPORT_LIB_EXT)#M#
130 FINAL_IMPORT_LIB = $(basename $(notdir $(FINAL_SO_TARGET)))$(IMPORT_LIB_EXT)#M#
132 ## Non-shared intermediate object suffix
135 ifeq ($(OS390_STUBDATA),1)
136 ## Suffix of the subset data library for dual common library support
138 DEFS += -DOS390_STUBDATA -DU_LIBICUDATA_NAME=\"$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)\"#M#
141 ifeq ($(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
145 ifeq ($(PDS_NAME_PREFIX),)
146 PDS_NAME_PREFIX= IXMI
148 ifeq ($(ICU_PDS_NAME),)
149 PDS_FULL_NAME=${PDS_NAME_PREFIX}${SO_TARGET_VERSION_MAJOR}
151 PDS_FULL_NAME=${ICU_PDS_NAME}
153 ifeq ($(OS390_STUBDATA),1)
154 BATCH_STUB_TARGET= "//'${LOADMOD}(${PDS_FULL_NAME}D1${ICU_PDS_NAME_SUFFIX})'"
155 BATCH_LIBICUDT= "//'${LOADEXP}(${PDS_FULL_NAME}D1${ICU_PDS_NAME_SUFFIX})'"
157 BATCH_STUB_TARGET= "//'${LOADMOD}(${PDS_FULL_NAME}DA${ICU_PDS_NAME_SUFFIX})'"
158 BATCH_LIBICUDT= "//'${LOADEXP}(${PDS_FULL_NAME}DA${ICU_PDS_NAME_SUFFIX})'"
159 PKGDATA_DEFS += -DU_LIBICUDATA_NAME=\"$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)\"
162 BATCH_COMMON_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}UC${ICU_PDS_NAME_SUFFIX})'"
163 BATCH_I18N_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}IN${ICU_PDS_NAME_SUFFIX})'"
164 BATCH_IO_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}IO${ICU_PDS_NAME_SUFFIX})'"
165 BATCH_LAYOUT_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}LE${ICU_PDS_NAME_SUFFIX})'"
166 BATCH_LAYOUTEX_TARGET="//'${LOADMOD}(${PDS_FULL_NAME}LX${ICU_PDS_NAME_SUFFIX})'"
168 BATCH_LIBICUUC= "//'${LOADEXP}(${PDS_FULL_NAME}UC${ICU_PDS_NAME_SUFFIX})'"
169 BATCH_LIBICUI18N= "//'${LOADEXP}(${PDS_FULL_NAME}IN${ICU_PDS_NAME_SUFFIX})'"
170 BATCH_LIBICUIO= "//'${LOADEXP}(${PDS_FULL_NAME}IO${ICU_PDS_NAME_SUFFIX})'"
171 BATCH_LIBICULE= "//'${LOADEXP}(${PDS_FULL_NAME}LE${ICU_PDS_NAME_SUFFIX})'"
172 BATCH_LIBICULX= "//'${LOADEXP}(${PDS_FULL_NAME}LX${ICU_PDS_NAME_SUFFIX})'"
176 ## Link commands to link to ICU libs
177 LIBICUDT= $(top_builddir)/stubdata/$(LIBICU)data$(ICULIBSUFFIX)$(STUB_SUFFIX)$(SO_TARGET_VERSION).x
178 LIBICUUC= $(top_builddir)/common/$(LIBICU)uc$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
179 LIBICUI18N= $(top_builddir)/i18n/$(LIBICU)i18n$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
180 LIBICULX= $(top_builddir)/layoutex/$(LIBICU)lx$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
181 LIBICUIO= $(top_builddir)/io/$(LIBICU)io$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
182 LIBCTESTFW= $(top_builddir)/tools/ctestfw/$(LIBICU)test$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
183 LIBICUTOOLUTIL= $(top_builddir)/tools/toolutil/$(LIBICU)tu$(ICULIBSUFFIX)$(SO_TARGET_VERSION).x
185 ifneq (${ICUDATA_CHAR},e)
186 #SH# if [ "$ICUDATA_CHAR" != "e" ]; then
187 ## We're in ASCII mode.
188 CFLAGS += -Wc,'ascii'
189 CXXFLAGS += -Wc,'ascii'
193 ## We're in EBCDIC mode.
194 ## Shared object suffix
201 ## Build archive from object
203 $(AR) $(ARFLAGS) $@ $(OBJECTS)
206 %.$(STATIC_O): $(srcdir)/%.c
207 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
209 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
211 # This causes escapesrc to be built before other ICU targets.
214 ifneq ($(SKIP_ESCAPING),)
215 %.$(STATIC_O): $(srcdir)/%.cpp
216 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
218 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
220 # convert *.cpp files to _*.cpp with \u / \U escaping
223 # the actual escaping
224 _%.cpp: $(srcdir)/%.cpp
225 @$(BINDIR)/escapesrc$(EXEEXT) $< $@
227 %.$(STATIC_O): _%.cpp
228 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
230 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
235 @$(SHELL) -ec 'cat $< \
236 | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
237 [ -s $@ ] || rm -f $@ ; rm -f $<'
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'
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'
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) $@
255 ## Install libraries as executable
256 INSTALL-L=$(INSTALL_PROGRAM)
258 ## End 390-specific setup