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