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