Home | History | Annotate | Download | only in config
      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
     12 BUILD_HOST_ICU=AIX_GCC
     13 
     14 # Certain files don't compile in -ansi mode (e.g. umutex.c, toolutil.c, and cdatatst.c)
     15 CFLAGS += -D_ALL_SOURCE
     16 
     17 ## Commands to generate dependency files
     18 GEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
     19 GEN_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)
     24 LINK.c=		$(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) 
     25 LINK.cc=	$(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS) 
     26 
     27 ## Shared library options
     28 LD_SOOPTIONS= -Wl,-bsymbolic
     29 
     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)
     33 
     34 ## Compiler switch to embed a runtime search path
     35 LD_RPATH=	-I
     36 LD_RPATH_PRE=	
     37 
     38 ## enable the shared lib loader
     39 LDFLAGS += -Wl,-bbigtoc
     40 
     41 ## These are the library specific LDFLAGS
     42 LDFLAGSICUDT=-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)
     48 AIX_PREDELETE=rm -f $@ ; 
     49 #SH# AIX_PREDELETE=
     50 
     51 ## Environment variable to set a runtime search path
     52 LDLIBRARYPATH_ENVVAR = LIBPATH
     53 
     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)
     59 
     60 # The following is for Makefile.inc's use.
     61 ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
     62 
     63 # this one is for icudefs.mk's use
     64 ifeq ($(ENABLE_SHARED),YES)
     65 SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
     66 endif
     67 
     68 ## Compiler switch to embed a library name. Not present on AIX.
     69 LD_SONAME = 
     70 
     71 ## The type of assembly needed when pkgdata is used for generating shared libraries.
     72 GENCCODE_ASSEMBLY=-a xlc
     73 
     74 ## Shared object suffix
     75 SOBJ=   so
     76 # without the -brtl option, the library names use .a. AIX is funny that way.
     77 SO=	a
     78 A=	a
     79 
     80 ## Non-shared intermediate object suffix
     81 STATIC_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
    134 BIR_LDFLAGS= -Wl,-bE:$(NAME).map,-bnoexpall
    135 
    136 # Dependencies [i.e. map files] for the final library
    137 BIR_DEPS= $(NAME).map
    138 
    139