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
19## We need to delete things prior to linking, or else we'll get
20## SEVERE ERROR: output file in use ..  on AIX. 
21## But, shell script version should NOT delete target as we don't
22## have $@ in that context.  (SH = only shell script, icu-config)
23AIX_PREDELETE=rm -f $@ ; 
24#SH# AIX_PREDELETE=
25
26## Commands to link
27## We need to use the C++ linker, even when linking C programs, since
28##  our libraries contain C++ code (C++ static init not called)
29LINK.c=		$(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
30LINK.cc=	$(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
31
32## Commands to make a shared library
33## -G means -berok -brtl -bnortllib -bnosymbolic -bnoautoexp
34## -bh:8 means halt on errors or worse.  We don't display warnings about
35##      duplicate inline symbols.
36SHLIB.c=	$(AIX_PREDELETE) $(CXX) -qmkshrobj -G $(LDFLAGS)
37SHLIB.cc=	$(AIX_PREDELETE) $(CXX) -qmkshrobj -G $(LDFLAGS)
38
39## Compiler switch to embed a runtime search path
40LD_RPATH=	-I
41LD_RPATH_PRE=	
42
43## Environment variable to set a runtime search path
44LDLIBRARYPATH_ENVVAR = LIBPATH
45
46# The following is for Makefile.inc's use.
47ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
48
49# this one is for icudefs.mk's use
50ifeq ($(ENABLE_SHARED),YES)
51SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
52endif
53
54LD_SONAME = 
55
56## The type of assembly needed when pkgdata is used for generating shared libraries.
57GENCCODE_ASSEMBLY=-a xlc
58
59## Shared object suffix
60SOBJ=	so
61# without the -brtl option, the library names use .a. AIX is funny that way.
62SO=	a
63## Non-shared intermediate object suffix
64STATIC_O = o
65
66## Override Versioned target for a shared library.
67FINAL_SO_TARGET=  $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
68MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
69SHARED_OBJECT = $(notdir $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ)))
70
71## Build archive from shared object
72%.a : %.so
73	$(AIX_PREDELETE) $(AR) $(ARFLAGS) $@ $<
74$(LIBDIR)/%.a : %.so
75	$(AIX_PREDELETE) $(AR) $(ARFLAGS) $@ $<
76
77## Build import list from export list
78%.e : %.exp
79	@echo "Building an import list for $<"
80	@$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@"
81
82## Compilation rules
83%.$(STATIC_O): $(srcdir)/%.c
84	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
85%.o: $(srcdir)/%.c
86	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
87
88%.$(STATIC_O): $(srcdir)/%.cpp
89	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
90%.o: $(srcdir)/%.cpp
91	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
92
93
94## Dependency rules
95%.d : %.u
96	@$(SHELL) -ec 'cat $<  \
97		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
98		[ -s $@ ] || rm -f $@ ; rm -f $<'
99
100%.u : $(srcdir)/%.c
101	@echo "generating dependency information for $<"
102	@$(SHELL) -ec '$(GEN_DEPS.c) $< > /dev/null'
103
104%.u : $(srcdir)/%.cpp
105	@echo "generating dependency information for $<"
106	@$(SHELL) -ec '$(GEN_DEPS.cc) $< > /dev/null'
107
108## Versioned libraries rules
109%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
110	$(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
111%.$(SO): %$(SO_TARGET_VERSION).$(SO)
112	$(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
113
114## End Aix-specific setup
115