1## -*-makefile-*- 2## Copyright (c) 2003-2015 IBM, Ken Foskey, and others. All rights reserved. 3## 4## Aix-specific setup (for gcc) 5## 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 8 9# When building stubdata, special considerations need to be made when building on AIX with GCC 10BUILD_HOST_ICU=AIX_GCC 11 12# Certain files don't compile in -ansi mode (e.g. umutex.c, toolutil.c, and cdatatst.c) 13CFLAGS += -D_ALL_SOURCE 14 15## Commands to generate dependency files 16GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS) 17GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) 18 19## Commands to link 20## We need to use the C++ linker, even when linking C programs, since 21## our libraries contain C++ code (C++ static init not called) 22LINK.c= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) 23LINK.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) 24 25## Shared library options 26LD_SOOPTIONS= -Wl,-bsymbolic 27 28## Commands to make a shared library 29SHLIB.c= $(AIX_PREDELETE) $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS) 30SHLIB.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS) 31 32## Compiler switch to embed a runtime search path 33LD_RPATH= -I 34LD_RPATH_PRE= 35 36## enable the shared lib loader 37LDFLAGS += -Wl,-bbigtoc 38 39## These are the library specific LDFLAGS 40LDFLAGSICUDT=-nodefaultlibs -nostdlib 41 42## We need to delete things prior to linking, or else we'll get 43## SEVERE ERROR: output file in use .. on AIX. 44## But, shell script version should NOT delete target as we don't 45## have $@ in that context. (SH = only shell script, icu-config) 46AIX_PREDELETE=rm -f $@ ; 47#SH# AIX_PREDELETE= 48 49## Environment variable to set a runtime search path 50LDLIBRARYPATH_ENVVAR = LIBPATH 51 52## Override Versioned target for a shared library. 53FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO) 54MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) 55SHARED_OBJECT = $(notdir $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ))) 56SHARED_OBJECT_NO_VERSION = $(basename $(SO_TARGET)).$(SOBJ) 57 58# The following is for Makefile.inc's use. 59ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) 60 61# this one is for icudefs.mk's use 62ifeq ($(ENABLE_SHARED),YES) 63SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR) 64endif 65 66## Compiler switch to embed a library name. Not present on AIX. 67LD_SONAME = 68 69## The type of assembly needed when pkgdata is used for generating shared libraries. 70GENCCODE_ASSEMBLY=-a xlc 71 72## Shared object suffix 73SOBJ= so 74# without the -brtl option, the library names use .a. AIX is funny that way. 75SO= a 76A= a 77 78## Non-shared intermediate object suffix 79STATIC_O = o 80 81## Special AIX rules 82 83## Build archive from shared object 84%.a : %.so 85 ln -f $< $(SHARED_OBJECT_NO_VERSION) 86 $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION) 87 rm -f $(SHARED_OBJECT_NO_VERSION) 88$(LIBDIR)/%.a : %.so 89 ln -f $< $(SHARED_OBJECT_NO_VERSION) 90 $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION) 91 rm -f $(SHARED_OBJECT_NO_VERSION) 92 93## Build import list from export list 94%.e : %.exp 95 @echo "Building an import list for $<" 96 @$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@" 97 98## Compilation rules 99%.$(STATIC_O): $(srcdir)/%.c 100 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< 101%.o: $(srcdir)/%.c 102 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< 103 104%.$(STATIC_O): $(srcdir)/%.cpp 105 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< 106%.o: $(srcdir)/%.cpp 107 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< 108 109 110## Dependency rules 111%.d: $(srcdir)/%.c 112 @echo "generating dependency information for $<" 113 @$(SHELL) -ec '$(GEN_DEPS.c) $< \ 114 | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ 115 [ -s $@ ] || rm -f $@' 116 117%.d: $(srcdir)/%.cpp 118 @echo "generating dependency information for $<" 119 @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ 120 | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ 121 [ -s $@ ] || rm -f $@' 122 123## Versioned libraries rules 124%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) 125 $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@ 126%.$(SO): %$(SO_TARGET_VERSION).$(SO) 127 $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@ 128 129 130## BIR - bind with internal references [so app data and icu data doesn't collide] 131# LDflags that pkgdata will use 132BIR_LDFLAGS= -Wl,-bE:$(NAME).map,-bnoexpall 133 134# Dependencies [i.e. map files] for the final library 135BIR_DEPS= $(NAME).map 136 137