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" 7CURR_FULL_DIR=. 8CURR_SRCCODE_FULL_DIR=. 9 10GEN_DEPS.c= $(CC1) -E -M $(DEFS) $(CPPFLAGS) 11GEN_DEPS.cc= $(CXX1) -E -M $(DEFS) $(CPPFLAGS) 12 13THREADSCPPFLAGS = -D_MULTI_THREADED 14 15# put this in the environment to get threading 16THREADSENVFLAGS = QIBM_MULTI_THREADED=Y ; 17 18## Commands to compile 19# -qTERASPACE: large pointers 20# -qPFROPT=*STRDONLY: Strings are read-only 21COMPILE.c= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c -qTERASPACE=*YES -qSTGMDL=*INHERIT -qPFROPT=*STRDONLY 22COMPILE.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 25ICULD=/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) 30LINK.c= $(ICULD) $(CXXFLAGS) $(LDFLAGS) -qOPTION='*DUPPROC *DUPVAR' 31LINK.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. 38SHLIB.c= ld -v -qOPTION='*DUPPROC *DUPVAR' -qALWLIBUPD=*YES 39SHLIB.cc= ld -v -qOPTION='*DUPPROC *DUPVAR' -qALWLIBUPD=*YES 40AR = qar 41ARFLAGS = -cuv 42 43## Compiler switch to embed a runtime search path 44LD_RPATH= -I 45LD_RPATH_PRE= -I 46 47## Make target to rebind the common library 48## to the actual data versus the stub data 49POST_DATA_BUILD = os400-data-rebind 50 51# The stubdata directory is the same directory as the normal data library. 52STUBDATA_LIBDIR = $(LIBDIR)/ 53 54## Versioned target for a shared library. 55FINAL_SO_TARGET = $(SO_TARGET) 56MIDDLE_SO_TARGET = 57 58# this one is for icudefs.mk's use 59ifeq ($(ENABLE_SHARED),YES) 60SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR) 61endif 62 63# this one is for the individual make files and linking 64ICULIBSUFFIX = $(SO_TARGET_VERSION_SUFFIX) 65 66## object suffix 67TO= o 68 69## Shared object suffix 70SO= so 71## Non-shared intermediate object suffix 72STATIC_O = o 73 74## Platform command to remove or move executable target 75RMV = del 76## Platform commands to remove or move executable and library targets 77INSTALL-S = cp -fph 78INSTALL-L = $(INSTALL-S) 79 80# Stub name overrides for iSeries 81DATA_STUBNAME = dt 82I18N_STUBNAME = in 83CTESTFW_STUBNAME = tf 84 85## Link commands to link to ICU service programs 86LIBICUDT = $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).$(SO) 87LIBICUUC = $(LIBDIR)/$(LIBICU)$(COMMON_STUBNAME)$(ICULIBSUFFIX).$(SO) 88LIBICUI18N = $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).$(SO) 89LIBICULE = $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).$(SO) 90LIBICULX = $(LIBDIR)/$(LIBICU)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX).$(SO) 91LIBCTESTFW = $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX).$(SO) 92LIBICUTOOLUTIL = $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).$(SO) 93LIBICUIO= $(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