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