2 ## Copyright (c) 2003-2009 IBM, Ken Foskey, and others. All rights reserved.
4 ## Aix-specific setup (for gcc)
6 ## Please note: AIX does NOT have library versioning per se (there is no 'SONAME' capability).
7 ## So, we are using 'windows' style library names, that is, libicuuc20.1.so instead of libicuuc.so.20.1
9 # Certain files don't compile in -ansi mode (e.g. umutex.c, toolutil.c, and cdatatst.c)
10 CFLAGS += -D_ALL_SOURCE
12 ## Commands to generate dependency files
13 GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS)
14 GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
17 ## We need to use the C++ linker, even when linking C programs, since
18 ## our libraries contain C++ code (C++ static init not called)
19 LINK.c= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
20 LINK.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
22 ## Shared library options
23 LD_SOOPTIONS= -Wl,-bsymbolic
25 ## Commands to make a shared library
26 SHLIB.c= $(AIX_PREDELETE) $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS)
27 SHLIB.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS)
29 ## Compiler switch to embed a runtime search path
33 ## enable the shared lib loader
34 LDFLAGS += -Wl,-bbigtoc
36 ## These are the library specific LDFLAGS
37 LDFLAGSICUDT=-nodefaultlibs -nostdlib
39 ## We need to delete things prior to linking, or else we'll get
40 ## SEVERE ERROR: output file in use .. on AIX.
41 ## But, shell script version should NOT delete target as we don't
42 ## have $@ in that context. (SH = only shell script, icu-config)
43 AIX_PREDELETE=rm -f $@ ;
46 ## Environment variable to set a runtime search path
47 LDLIBRARYPATH_ENVVAR = LIBPATH
49 ## Override Versioned target for a shared library.
50 FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
51 MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
52 SHARED_OBJECT = $(notdir $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ)))
53 SHARED_OBJECT_NO_VERSION = $(basename $(SO_TARGET)).$(SOBJ)
55 # The following is for Makefile.inc's use.
56 ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
58 # this one is for icudefs.mk's use
59 ifeq ($(ENABLE_SHARED),YES)
60 SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
63 ## Compiler switch to embed a library name. Not present on AIX.
66 ## The type of assembly needed when pkgdata is used for generating shared libraries.
67 GENCCODE_ASSEMBLY=-a xlc
69 ## Shared object suffix
71 # without the -brtl option, the library names use .a. AIX is funny that way.
75 ## Non-shared intermediate object suffix
80 ## Build archive from shared object
82 ln -f $< $(SHARED_OBJECT_NO_VERSION)
83 $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION)
84 rm -f $(SHARED_OBJECT_NO_VERSION)
86 ln -f $< $(SHARED_OBJECT_NO_VERSION)
87 $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION)
88 rm -f $(SHARED_OBJECT_NO_VERSION)
90 ## Build import list from export list
92 @echo "Building an import list for $<"
93 @$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@"
96 %.$(STATIC_O): $(srcdir)/%.c
97 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
99 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
101 %.$(STATIC_O): $(srcdir)/%.cpp
102 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
104 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
109 @echo "generating dependency information for $<"
110 @$(SHELL) -ec '$(GEN_DEPS.c) $< \
111 | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
112 [ -s $@ ] || rm -f $@'
115 @echo "generating dependency information for $<"
116 @$(SHELL) -ec '$(GEN_DEPS.cc) $< \
117 | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
118 [ -s $@ ] || rm -f $@'
120 ## Versioned libraries rules
121 %$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
122 $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
123 %.$(SO): %$(SO_TARGET_VERSION).$(SO)
124 $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
127 ## BIR - bind with internal references [so app data and icu data doesn't collide]
128 # LDflags that pkgdata will use
129 BIR_LDFLAGS= -Wl,-bE:$(NAME).map,-bnoexpall
131 # Dependencies [i.e. map files] for the final library
132 BIR_DEPS= $(NAME).map