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