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