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