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