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. 42 ifeq (${IEEE390},) 43 IEEE390=1#M# 44 endif 45 46 ifeq (${IEEE390}, 1) 47 ICU_IEEE = -Wc,'FLOAT(IEEE)' -DIEEE_754=0#M# 48 else 49 ICU_IEEE =#M# 50 endif 51 52 ## Additional flags when building libraries and with threads 53 THREADSCPPFLAGS = -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. 57 SHAREDLIBCPPFLAGS = -D_SHR_TZNAME -D_SHR_TIMEZONE 58 59 # -Wc,expo is used to export all functions 60 SHAREDLIBCFLAGS = -Wc,expo 61 SHAREDLIBCXXFLAGS = -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. 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) -+ 73 ARFLAGS = -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 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 88 #SH# fi 89 endif 90 91 ## OS390BATCH 92 ifeq (${OS390BATCH},1) 93 DEFS += -DOS390BATCH#M# 94 endif 95 96 ## Commands to generate dependency files 97 GEN_DEPS.c= makedep 98 GEN_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 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 105 106 # Commands to link 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) 109 110 ## Commands for shared library (dll) 111 SHLIB.c= $(LINK.c) 112 SHLIB.cc= $(LINK.cc) 113 114 ## Compiler switch to embed a runtime search path 115 LD_RPATH= -I 116 117 ## Environment variable to set a runtime search path 118 LDLIBRARYPATH_ENVVAR = LIBPATH 119 120 ## An import library (a.k.a. sidedeck) is needed for z/OS and MSVC 121 IMPORT_LIB_EXT = .x 122 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) 126 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# 131 132 ## Non-shared intermediate object suffix 133 STATIC_O = o 134 135 ifeq ($(OS390_STUBDATA),1) 136 ## Suffix of the subset data library for dual common library support 137 STUB_SUFFIX=_stub#M# 138 DEFS += -DOS390_STUBDATA -DU_LIBICUDATA_NAME=\"$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)\"#M# 139 endif 140 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 147 endif 148 ifeq ($(ICU_PDS_NAME),) 149 PDS_FULL_NAME=${PDS_NAME_PREFIX}${SO_TARGET_VERSION_MAJOR} 150 else 151 PDS_FULL_NAME=${ICU_PDS_NAME} 152 endif 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})'" 156 else 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)\" 160 endif 161 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})'" 167 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})'" 173 endif 174 175 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 184 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' 190 SO = so 191 else 192 #SH# else 193 ## We're in EBCDIC mode. 194 ## Shared object suffix 195 SO = dll 196 endif 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. 212 NEED_ESCAPING=YES 213 214 ifneq ($(SKIP_ESCAPING),) 215 %.$(STATIC_O): $(srcdir)/%.cpp 216 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< 217 %.o: $(srcdir)/%.cpp 218 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< 219 else 220 # convert *.cpp files to _*.cpp with \u / \U escaping 221 CLEANFILES += _*.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 $@ $< 231 endif 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 256 INSTALL-L=$(INSTALL_PROGRAM) 257 258 ## End 390-specific setup 259