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