2 ## Copyright (C) 2016 and later: Unicode, Inc. and others.
3 ## License & terms of use: http://www.unicode.org/copyright.html
4 ## Copyright (c) 2003-2015 IBM, Ken Foskey, and others. All rights reserved.
6 ## Aix-specific setup (for gcc)
8 ## Please note: AIX does NOT have library versioning per se (there is no 'SONAME' capability).
9 ## So, we are using 'windows' style library names, that is, libicuuc20.1.so instead of libicuuc.so.20.1
11 # When building stubdata, special considerations need to be made when building on AIX with GCC
12 BUILD_HOST_ICU=AIX_GCC
14 # Certain files don't compile in -ansi mode (e.g. umutex.c, toolutil.c, and cdatatst.c)
15 CFLAGS += -D_ALL_SOURCE
17 ## Commands to generate dependency files
18 GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS)
19 GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
22 ## We need to use the C++ linker, even when linking C programs, since
23 ## our libraries contain C++ code (C++ static init not called)
24 LINK.c= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
25 LINK.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
27 ## Shared library options
28 LD_SOOPTIONS= -Wl,-bsymbolic
30 ## Commands to make a shared library
31 SHLIB.c= $(AIX_PREDELETE) $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS)
32 SHLIB.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS)
34 ## Compiler switch to embed a runtime search path
38 ## enable the shared lib loader
39 LDFLAGS += -Wl,-bbigtoc
41 ## These are the library specific LDFLAGS
42 LDFLAGSICUDT=-nodefaultlibs -nostdlib
44 ## We need to delete things prior to linking, or else we'll get
45 ## SEVERE ERROR: output file in use .. on AIX.
46 ## But, shell script version should NOT delete target as we don't
47 ## have $@ in that context. (SH = only shell script, icu-config)
48 AIX_PREDELETE=rm -f $@ ;
51 ## Environment variable to set a runtime search path
52 LDLIBRARYPATH_ENVVAR = LIBPATH
54 ## Override Versioned target for a shared library.
55 FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
56 MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
57 SHARED_OBJECT = $(notdir $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ)))
58 SHARED_OBJECT_NO_VERSION = $(basename $(SO_TARGET)).$(SOBJ)
60 # The following is for Makefile.inc's use.
61 ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
63 # this one is for icudefs.mk's use
64 ifeq ($(ENABLE_SHARED),YES)
65 SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
68 ## Compiler switch to embed a library name. Not present on AIX.
71 ## The type of assembly needed when pkgdata is used for generating shared libraries.
72 GENCCODE_ASSEMBLY=-a xlc
74 ## Shared object suffix
76 # without the -brtl option, the library names use .a. AIX is funny that way.
80 ## Non-shared intermediate object suffix
85 ## Build archive from shared object
87 ln -f $< $(SHARED_OBJECT_NO_VERSION)
88 $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION)
89 rm -f $(SHARED_OBJECT_NO_VERSION)
91 ln -f $< $(SHARED_OBJECT_NO_VERSION)
92 $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION)
93 rm -f $(SHARED_OBJECT_NO_VERSION)
95 ## Build import list from export list
97 @echo "Building an import list for $<"
98 @$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@"
101 %.$(STATIC_O): $(srcdir)/%.c
102 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
104 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
106 %.$(STATIC_O): $(srcdir)/%.cpp
107 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
109 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
114 @echo "generating dependency information for $<"
115 @$(SHELL) -ec '$(GEN_DEPS.c) $< \
116 | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
117 [ -s $@ ] || rm -f $@'
120 @echo "generating dependency information for $<"
121 @$(SHELL) -ec '$(GEN_DEPS.cc) $< \
122 | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
123 [ -s $@ ] || rm -f $@'
125 ## Versioned libraries rules
126 %$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
127 $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
128 %.$(SO): %$(SO_TARGET_VERSION).$(SO)
129 $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
132 ## BIR - bind with internal references [so app data and icu data doesn't collide]
133 # LDflags that pkgdata will use
134 BIR_LDFLAGS= -Wl,-bE:$(NAME).map,-bnoexpall
136 # Dependencies [i.e. map files] for the final library
137 BIR_DEPS= $(NAME).map