• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## -*-makefile-*-
2## Aix-specific setup (for Visual Age 5+)
3## Copyright (c) 1999-2009, International Business Machines Corporation and
4## others. All Rights Reserved.
5
6## Commands to generate dependency files
7GEN_DEPS.c=	$(CC) -E -M $(DEFS) $(CPPFLAGS)
8GEN_DEPS.cc=	$(CXX) -E -M $(DEFS) $(CPPFLAGS)
9
10# -qroconst make the strings readonly, which is usually the default.
11#           This helps in the data library,
12# -qproto assumes all functions are prototyped (for optimization)
13CFLAGS += -qproto -qroconst
14CXXFLAGS += -qproto -qroconst
15
16# If you readd this line, you must change the SO value
17#LDFLAGS += -brtl
18
19ifeq ($(UCLN_NO_AUTO_CLEANUP),0)
20# set up init point.
21UCLN_FINI =  ucln_fini$(TARGET_STUBNAME)_$(SO_TARGET_VERSION_MAJOR)$(ICULIBSUFFIXCNAME)
22CPPFLAGS_FINI = -DUCLN_FINI=$(UCLN_FINI)
23LDFLAGS_FINI = -binitfini::$(UCLN_FINI)
24
25CPPFLAGSICUUC += $(CPPFLAGS_FINI)
26LDFLAGSICUUC += $(LDFLAGS_FINI)
27CPPFLAGSICUIO += $(CPPFLAGS_FINI)
28LDFLAGSICUIO += $(LDFLAGS_FINI)
29CPPFLAGSICUI18N += $(CPPFLAGS_FINI)
30LDFLAGSICUI18N += $(LDFLAGS_FINI)
31CPPFLAGSCTESTFW += $(CPPFLAGS_FINI)
32LDFLAGSCTESTFW += $(LDFLAGS_FINI)
33
34# ICUUC, ICUIO, ICUI18N, CTESTFW
35endif
36
37## We need to delete things prior to linking, or else we'll get
38## SEVERE ERROR: output file in use ..  on AIX.
39## But, shell script version should NOT delete target as we don't
40## have $@ in that context.  (SH = only shell script, icu-config)
41AIX_PREDELETE=rm -f $@ ;
42#SH# AIX_PREDELETE=
43
44## Commands to link
45## We need to use the C++ linker, even when linking C programs, since
46##  our libraries contain C++ code (C++ static init not called)
47LINK.c=		$(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
48LINK.cc=	$(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
49
50## Commands to make a shared library
51## -G means -berok -brtl -bnortllib -bnosymbolic -bnoautoexp
52## -bh:8 means halt on errors or worse.  We don't display warnings about
53##      duplicate inline symbols.
54SHLIB.c=	$(AIX_PREDELETE) $(CXX) -qmkshrobj -G $(LDFLAGS)
55SHLIB.cc=	$(AIX_PREDELETE) $(CXX) -qmkshrobj -G $(LDFLAGS)
56
57## Compiler switch to embed a runtime search path
58LD_RPATH=	-I
59LD_RPATH_PRE=
60
61## Environment variable to set a runtime search path
62LDLIBRARYPATH_ENVVAR = LIBPATH
63
64# The following is for Makefile.inc's use.
65ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
66
67# this one is for icudefs.mk's use
68ifeq ($(ENABLE_SHARED),YES)
69SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
70endif
71
72LD_SONAME =
73
74## The type of assembly needed when pkgdata is used for generating shared libraries.
75GENCCODE_ASSEMBLY=-a xlc
76
77## Shared object suffix
78SOBJ=	so
79# without the -brtl option, the library names use .a. AIX is funny that way.
80SO=	a
81## Non-shared intermediate object suffix
82STATIC_O = o
83
84## Override Versioned target for a shared library.
85FINAL_SO_TARGET=  $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
86MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
87SHARED_OBJECT = $(notdir $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ)))
88SHARED_OBJECT_NO_VERSION=  $(basename $(SO_TARGET)).$(SOBJ)
89
90## Build archive from shared object
91%.a : %.so
92	ln -f $< $(SHARED_OBJECT_NO_VERSION)
93	$(AIX_PREDELETE) $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION)
94	rm -f $(SHARED_OBJECT_NO_VERSION)
95$(LIBDIR)/%.a : %.so
96	ln -f $< $(SHARED_OBJECT_NO_VERSION)
97	$(AIX_PREDELETE) $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION)
98	rm -f $(SHARED_OBJECT_NO_VERSION)
99
100## Build import list from export list
101%.e : %.exp
102	@echo "Building an import list for $<"
103	@$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@"
104
105## Compilation rules
106%.$(STATIC_O): $(srcdir)/%.c
107	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
108%.o: $(srcdir)/%.c
109	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
110
111%.$(STATIC_O): $(srcdir)/%.cpp
112	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
113%.o: $(srcdir)/%.cpp
114	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
115
116
117## Dependency rules
118%.d : %.u
119	@$(SHELL) -ec 'cat $<  \
120		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
121		[ -s $@ ] || rm -f $@ ; rm -f $<'
122
123%.u : $(srcdir)/%.c
124	@echo "generating dependency information for $<"
125	@$(SHELL) -ec '$(GEN_DEPS.c) $< > /dev/null'
126
127%.u : $(srcdir)/%.cpp
128	@echo "generating dependency information for $<"
129	@$(SHELL) -ec '$(GEN_DEPS.cc) $< > /dev/null'
130
131## Versioned libraries rules
132%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
133	$(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
134%.$(SO): %$(SO_TARGET_VERSION).$(SO)
135	$(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
136
137## End Aix-specific setup
138