Home | History | Annotate | Download | only in config
      1 ## -*-makefile-*-
      2 ## OS400-specific setup (for cross build)
      3 ## Copyright (c) 1999-2013, International Business Machines Corporation and
      4 ## others. All Rights Reserved.
      5 
      6 # This otherwise breaks on OS400 - can't find "shell"
      7 CURR_FULL_DIR=.
      8 CURR_SRCCODE_FULL_DIR=.
      9 
     10 GEN_DEPS.c=	$(CC1) -E -M $(DEFS) $(CPPFLAGS)
     11 GEN_DEPS.cc=	$(CXX1) -E -M $(DEFS) $(CPPFLAGS)
     12 
     13 THREADSCPPFLAGS = -D_MULTI_THREADED
     14 
     15 # put this in the environment to get threading
     16 THREADSENVFLAGS = QIBM_MULTI_THREADED=Y ;
     17 
     18 ## Commands to compile
     19 # -qTERASPACE: large pointers
     20 # -qPFROPT=*STRDONLY: Strings are read-only
     21 COMPILE.c=	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c -qTERASPACE=*YES -qSTGMDL=*INHERIT -qPFROPT=*STRDONLY
     22 COMPILE.cc=	$(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c -qTERASPACE=*YES -qSTGMDL=*INHERIT -qPFROPT=*STRDONLY -qRTTIALL
     23 
     24 ## ICULD program - run bldiculd.sh in icu/as_is/os400/ to build it
     25 ICULD=/qsys.lib/$(OUTPUTDIR).lib/iculd.pgm
     26 
     27 ## Commands to link
     28 ## We need to use the C++ linker, even when linking C programs, since
     29 ##  our libraries contain C++ code (C++ static init not called)
     30 LINK.c=		$(ICULD)  $(CXXFLAGS) $(LDFLAGS) -qOPTION='*DUPPROC *DUPVAR'
     31 LINK.cc=	$(ICULD) $(CXXFLAGS) $(LDFLAGS) -qOPTION='*DUPPROC *DUPVAR'
     32 
     33 ## Commands to make a shared library
     34 # -qALWLIBUPD: It allows the compiled service program to have dependencies on
     35 #	service programs in a different library than that specified originally
     36 #	by CRTSRVPGM after having used the UPDSRVPGM command.
     37 #	Similar to -fPIC and -install_name on other compilers, but different.
     38 SHLIB.c=   ld -v -qOPTION='*DUPPROC *DUPVAR' -qALWLIBUPD=*YES
     39 SHLIB.cc=	 ld -v -qOPTION='*DUPPROC *DUPVAR' -qALWLIBUPD=*YES
     40 AR = qar
     41 ARFLAGS = -cuv
     42 
     43 ## Compiler switch to embed a runtime search path
     44 LD_RPATH=	-I
     45 LD_RPATH_PRE=	-I
     46 
     47 ## Make target to rebind the common library
     48 ## to the actual data versus the stub data
     49 POST_DATA_BUILD = os400-data-rebind
     50 
     51 # The stubdata directory is the same directory as the normal data library.
     52 STUBDATA_LIBDIR = $(LIBDIR)/
     53 
     54 ## Versioned target for a shared library.
     55 FINAL_SO_TARGET = $(SO_TARGET)
     56 MIDDLE_SO_TARGET = 
     57 
     58 # this one is for icudefs.mk's use
     59 ifeq ($(ENABLE_SHARED),YES)
     60 SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
     61 endif
     62 
     63 # this one is for the individual make files and linking
     64 ICULIBSUFFIX = $(SO_TARGET_VERSION_SUFFIX)
     65 
     66 ##  object suffix
     67 TO=		o
     68 
     69 ## Shared object suffix
     70 SO=	so
     71 ## Non-shared intermediate object suffix
     72 STATIC_O = o
     73 
     74 ## Platform command to remove or move executable target
     75 RMV = del
     76 ## Platform commands to remove or move executable and library targets
     77 INSTALL-S =  cp -fph
     78 INSTALL-L = $(INSTALL-S)
     79 
     80 # Stub name overrides for iSeries
     81 DATA_STUBNAME = dt
     82 I18N_STUBNAME = in
     83 CTESTFW_STUBNAME = tf
     84 
     85 ## Link commands to link to ICU service programs
     86 LIBICUDT = $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).$(SO)
     87 LIBICUUC = $(LIBDIR)/$(LIBICU)$(COMMON_STUBNAME)$(ICULIBSUFFIX).$(SO)
     88 LIBICUI18N = $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).$(SO)
     89 LIBICULE = $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).$(SO)
     90 LIBICULX = $(LIBDIR)/$(LIBICU)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX).$(SO)
     91 LIBCTESTFW = $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX).$(SO)
     92 LIBICUTOOLUTIL = $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).$(SO)
     93 LIBICUIO= $(LIBDIR)/$(LIBICU)$(IO_STUBNAME)$(ICULIBSUFFIX).$(SO)
     94 
     95 ## Special OS400 rules
     96 
     97 ## Build archive from shared object
     98 %.a : %.o
     99 	$(AR) $(ARFLAGS) $@ $<
    100 
    101 ## Build import list from export list
    102 %.e : %.exp
    103 	@echo "Building an import list for $<"
    104 	@$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@"
    105 
    106 ## Compilation rules
    107 %.$(STATIC_O): $(srcdir)/%.c
    108 	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
    109 %.o: $(srcdir)/%.c
    110 	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
    111 
    112 %.$(STATIC_O): $(srcdir)/%.cpp
    113 	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
    114 %.o: $(srcdir)/%.cpp
    115 	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
    116 
    117 %.qwobj : $(srcdir)/%.c
    118 	$(COMPILE.c) -o $@ $<
    119 
    120 %.qwobj : $(srcdir)/%.cpp
    121 	$(COMPILE.cc) -o $@ $<
    122 
    123 ## Dependency rules
    124 %.d : %.u
    125 #	@$(SHELL) -ec 'cat $<  \
    126 #		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
    127 #		[ -s $@ ] || rm -f $@ ; rm -f $<'
    128 
    129 %.u : $(srcdir)/%.c
    130 	@echo "generating dependency information for $<"
    131 #	@$(SHELL) -ec 'touch            $*.u  > /dev/null 2>&1'
    132 #	@$(SHELL) -ec '$(GEN_DEPS.c) -f $*.u $< > /dev/null 2>&1'
    133 
    134 %.u : $(srcdir)/%.cpp
    135 	@echo "generating dependency information for $<"
    136 #	@$(SHELL) -ec 'touch              $*.u  > /dev/null 2>&1'
    137 #	@$(SHELL) -ec '$(GEN_DEPS.cc)  -f $*.u $< > /dev/null 2>&1'
    138 
    139 ## End OS400-specific setup
    140