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