16f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## -*-makefile-*-
26f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Aix-specific setup (for Visual Age 5+)
36f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Copyright (c) 1999-2010, International Business Machines Corporation and
46f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## others. All Rights Reserved.
56f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
66f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Commands to generate dependency files
76f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgGEN_DEPS.c=	$(CC) -E -M $(DEFS) $(CPPFLAGS)
86f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgGEN_DEPS.cc=	$(CXX) -E -M $(DEFS) $(CPPFLAGS)
96f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
106f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# -qroconst make the strings readonly, which is usually the default.
116f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#           This helps in the data library,
126f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# -qproto assumes all functions are prototyped (for optimization)
136f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# -qrtti turns on compiler RTTI, required beginning with ICU 4.6
146f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCFLAGS += -qproto -qroconst
156f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCXXFLAGS += -qproto -qroconst -qrtti
166f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
176f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# If you readd this line, you must change the SO value
186f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#LDFLAGS += -brtl
196f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
206f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgifeq ($(UCLN_NO_AUTO_CLEANUP),0)
216f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# set up init point.
226f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgUCLN_FINI =  ucln_fini$(TARGET_STUBNAME)_$(SO_TARGET_VERSION_MAJOR)$(ICULIBSUFFIXCNAME)
236f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCPPFLAGS_FINI = -DUCLN_FINI=$(UCLN_FINI)
246f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLDFLAGS_FINI = -binitfini::$(UCLN_FINI)
256f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
266f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCPPFLAGSICUUC += $(CPPFLAGS_FINI)
276f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLDFLAGSICUUC += $(LDFLAGS_FINI)
286f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCPPFLAGSICUIO += $(CPPFLAGS_FINI)
296f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLDFLAGSICUIO += $(LDFLAGS_FINI)
306f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCPPFLAGSICUI18N += $(CPPFLAGS_FINI)
316f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLDFLAGSICUI18N += $(LDFLAGS_FINI)
326f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCPPFLAGSCTESTFW += $(CPPFLAGS_FINI)
336f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLDFLAGSCTESTFW += $(LDFLAGS_FINI)
346f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
356f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# ICUUC, ICUIO, ICUI18N, CTESTFW
366f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgendif
376f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
386f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## We need to delete things prior to linking, or else we'll get
396f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## SEVERE ERROR: output file in use ..  on AIX. 
406f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## But, shell script version should NOT delete target as we don't
416f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## have $@ in that context.  (SH = only shell script, icu-config)
426f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgAIX_PREDELETE=rm -f $@ ; 
436f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org#SH# AIX_PREDELETE=
446f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
456f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Commands to link
466f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## We need to use the C++ linker, even when linking C programs, since
476f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org##  our libraries contain C++ code (C++ static init not called)
486f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLINK.c=		$(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
496f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLINK.cc=	$(AIX_PREDELETE) $(CXX) $(CXXFLAGS) $(LDFLAGS)
506f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
516f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Commands to make a shared library
526f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## -G means -berok -brtl -bnortllib -bnosymbolic -bnoautoexp
536f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## -bh:8 means halt on errors or worse.  We don't display warnings about
546f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org##      duplicate inline symbols.
556f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHLIB.c=	$(AIX_PREDELETE) $(CXX) -qmkshrobj -G $(LDFLAGS)
566f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHLIB.cc=	$(AIX_PREDELETE) $(CXX) -qmkshrobj -G $(LDFLAGS)
576f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
586f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Compiler switch to embed a runtime search path
596f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLD_RPATH=	-I
606f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLD_RPATH_PRE=	
616f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
626f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Environment variable to set a runtime search path
636f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLDLIBRARYPATH_ENVVAR = LIBPATH
646f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
656f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# The following is for Makefile.inc's use.
666f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
676f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
686f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# this one is for icudefs.mk's use
696f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgifeq ($(ENABLE_SHARED),YES)
706f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
716f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgendif
726f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
736f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLD_SONAME = 
746f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
756f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## The type of assembly needed when pkgdata is used for generating shared libraries.
766f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgGENCCODE_ASSEMBLY=-a xlc
776f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
786f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Shared object suffix
796f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSOBJ=	so
806f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# without the -brtl option, the library names use .a. AIX is funny that way.
816f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSO=	a
826f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Non-shared intermediate object suffix
836f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSTATIC_O = o
846f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
856f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Override Versioned target for a shared library.
866f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgFINAL_SO_TARGET=  $(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
876f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgMIDDLE_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
886f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHARED_OBJECT = $(notdir $(FINAL_SO_TARGET:.$(SO)=.$(SOBJ)))
896f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHARED_OBJECT_NO_VERSION=  $(basename $(SO_TARGET)).$(SOBJ)
906f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
916f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Build archive from shared object
926f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.a : %.so
936f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	ln -f $< $(SHARED_OBJECT_NO_VERSION) 
946f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(AIX_PREDELETE) $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION)
956f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	rm -f $(SHARED_OBJECT_NO_VERSION)
966f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org$(LIBDIR)/%.a : %.so
976f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	ln -f $< $(SHARED_OBJECT_NO_VERSION) 
986f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(AIX_PREDELETE) $(AR) $(ARFLAGS) $@ $(SHARED_OBJECT_NO_VERSION)
996f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	rm -f $(SHARED_OBJECT_NO_VERSION)
1006f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1016f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Build import list from export list
1026f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.e : %.exp
1036f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	@echo "Building an import list for $<"
1046f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	@$(SHELL) -ec "echo '#! $*.a($*.so)' | cat - $< > $@"
1056f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1066f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Compilation rules
1076f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.$(STATIC_O): $(srcdir)/%.c
1086f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
1096f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.o: $(srcdir)/%.c
1106f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
1116f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1126f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.$(STATIC_O): $(srcdir)/%.cpp
1136f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
1146f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.o: $(srcdir)/%.cpp
1156f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
1166f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1176f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1186f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Dependency rules
1196f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.d : %.u
1206f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	@$(SHELL) -ec 'cat $<  \
1216f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
1226f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org		[ -s $@ ] || rm -f $@ ; rm -f $<'
1236f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1246f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.u : $(srcdir)/%.c
1256f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	@echo "generating dependency information for $<"
1266f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	@$(GEN_DEPS.c) $< > /dev/null
1276f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1286f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.u : $(srcdir)/%.cpp
1296f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	@echo "generating dependency information for $<"
1306f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	@$(GEN_DEPS.cc) $< > /dev/null
1316f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1326f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Versioned libraries rules
1336f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
1346f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
1356f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.$(SO): %$(SO_TARGET_VERSION).$(SO)
1366f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(RM) $@ && ln -s ${*F}$(SO_TARGET_VERSION).$(SO) $@
1376f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
1386f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## End Aix-specific setup
139