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