michael@0: ## -*-makefile-*- michael@0: ## Copyright (c) 2003-2009 IBM, Ken Foskey, and others. All rights reserved. michael@0: ## michael@0: ## Aix-specific setup (for gcc) michael@0: ## michael@0: ## Please note: AIX does NOT have library versioning per se (there is no 'SONAME' capability). michael@0: ## So, we are using 'windows' style library names, that is, libicuuc20.1.so instead of libicuuc.so.20.1 michael@0: michael@0: # Certain files don't compile in -ansi mode (e.g. umutex.c, toolutil.c, and cdatatst.c) michael@0: CFLAGS += -D_ALL_SOURCE michael@0: michael@0: ## Commands to generate dependency files michael@0: GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS) michael@0: GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) michael@0: michael@0: ## Commands to link michael@0: ## We need to use the C++ linker, even when linking C programs, since michael@0: ## our libraries contain C++ code (C++ static init not called) michael@0: LINK.c= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) michael@0: LINK.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) michael@0: michael@0: ## Shared library options michael@0: LD_SOOPTIONS= -Wl,-bsymbolic michael@0: michael@0: ## Commands to make a shared library michael@0: SHLIB.c= $(AIX_PREDELETE) $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS) michael@0: SHLIB.cc= $(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-bexpall $(LD_SOOPTIONS) michael@0: michael@0: ## Compiler switch to embed a runtime search path michael@0: LD_RPATH= -I michael@0: LD_RPATH_PRE= michael@0: michael@0: ## enable the shared lib loader michael@0: LDFLAGS += -Wl,-bbigtoc michael@0: michael@0: ## These are the library specific LDFLAGS michael@0: LDFLAGSICUDT=-nodefaultlibs -nostdlib michael@0: michael@0: ## We need to delete things prior to linking, or else we'll get michael@0: ## SEVERE ERROR: output file in use .. on AIX. michael@0: ## But, shell script version should NOT delete target as we don't michael@0: ## have $@ in that context. (SH = only shell script, icu-config) michael@0: AIX_PREDELETE=rm -f $@ ; michael@0: #SH# AIX_PREDELETE= michael@0: michael@0: ## Environment variable to set a runtime search path michael@0: LDLIBRARYPATH_ENVVAR = LIBPATH michael@0: michael@0: ## Override Versioned target for a shared library. michael@0: FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO) michael@0: MIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) michael@0: SHARED_OBJECT = $(notdir $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ))) michael@0: SHARED_OBJECT_NO_VERSION = $(basename $(SO_TARGET)).$(SOBJ) michael@0: michael@0: # The following is for Makefile.inc's use. michael@0: ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) michael@0: michael@0: # this one is for icudefs.mk's use michael@0: ifeq ($(ENABLE_SHARED),YES) michael@0: SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR) michael@0: endif michael@0: michael@0: ## Compiler switch to embed a library name. Not present on AIX. michael@0: LD_SONAME = michael@0: michael@0: ## The type of assembly needed when pkgdata is used for generating shared libraries. michael@0: GENCCODE_ASSEMBLY=-a xlc michael@0: michael@0: ## Shared object suffix michael@0: SOBJ= so michael@0: # without the -brtl option, the library names use .a. AIX is funny that way. michael@0: SO= a michael@0: A= a michael@0: michael@0: ## Non-shared intermediate object suffix michael@0: STATIC_O = o michael@0: michael@0: ## Special AIX rules michael@0: michael@0: ## Build archive from shared object michael@0: %.a : %.so michael@0: ln -f $< $(SHARED_OBJECT_NO_VERSION) michael@0: $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION) michael@0: rm -f $(SHARED_OBJECT_NO_VERSION) michael@0: $(LIBDIR)/%.a : %.so michael@0: ln -f $< $(SHARED_OBJECT_NO_VERSION) michael@0: $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION) michael@0: rm -f $(SHARED_OBJECT_NO_VERSION) michael@0: michael@0: ## Build import list from export list michael@0: %.e : %.exp michael@0: @echo "Building an import list for $<" michael@0: @$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@" michael@0: michael@0: ## Compilation rules michael@0: %.$(STATIC_O): $(srcdir)/%.c michael@0: $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< michael@0: %.o: $(srcdir)/%.c michael@0: $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< michael@0: michael@0: %.$(STATIC_O): $(srcdir)/%.cpp michael@0: $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< michael@0: %.o: $(srcdir)/%.cpp michael@0: $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< michael@0: michael@0: michael@0: ## Dependency rules michael@0: %.d: $(srcdir)/%.c michael@0: @echo "generating dependency information for $<" michael@0: @$(SHELL) -ec '$(GEN_DEPS.c) $< \ michael@0: | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ michael@0: [ -s $@ ] || rm -f $@' michael@0: michael@0: %.d: $(srcdir)/%.cpp michael@0: @echo "generating dependency information for $<" michael@0: @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ michael@0: | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ michael@0: [ -s $@ ] || rm -f $@' michael@0: michael@0: ## Versioned libraries rules michael@0: %$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) michael@0: $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@ michael@0: %.$(SO): %$(SO_TARGET_VERSION).$(SO) michael@0: $(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@ michael@0: michael@0: michael@0: ## BIR - bind with internal references [so app data and icu data doesn't collide] michael@0: # LDflags that pkgdata will use michael@0: BIR_LDFLAGS= -Wl,-bE:$(NAME).map,-bnoexpall michael@0: michael@0: # Dependencies [i.e. map files] for the final library michael@0: BIR_DEPS= $(NAME).map michael@0: