16f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## -*-makefile-*-
26f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Darwin-specific setup (Darwin is the Mac OS X developer preview, successor
36f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## to Rhapsody, aka Mac OS X Server)
46f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Copyright (c) 1999-2012 International Business Machines Corporation and
56f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## others. All Rights Reserved.
66f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
76f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Flags for position independent code
86f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHAREDLIBCFLAGS = -dynamic
96f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHAREDLIBCXXFLAGS = -dynamic
106f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHAREDLIBCPPFLAGS =
116f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
126f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# Do not export internal methods by default
136f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLIBCFLAGS += -fvisibility=hidden
146f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLIBCXXFLAGS += -fvisibility=hidden
156f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
166f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# Pad out the paths to the maximum possible length
176f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLD_FLAGS += -headerpad_max_install_names
186f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
196f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# We do not need to see the stderr message that the archive was made.
206f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgARFLAGS += -c
216f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
226f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Commands to compile
236f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCOMPILE.c=	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -fno-common -c
246f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgCOMPILE.cc=	$(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -fno-common -c
256f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
266f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Commands to make a shared library
276f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHLIB.c=	$(CC) -dynamiclib -dynamic $(CFLAGS) $(LDFLAGS) $(LD_SOOPTIONS)
286f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSHLIB.cc=	$(CXX) -dynamiclib -dynamic $(CXXFLAGS) $(LDFLAGS) $(LD_SOOPTIONS)
296f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
306f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Compiler switches to embed a library name and version information
316f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgifeq ($(ENABLE_RPATH),YES)
326f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name $(libdir)/$(notdir $(MIDDLE_SO_TARGET))
336f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgelse
346f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name $(notdir $(MIDDLE_SO_TARGET))
356f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgendif
366f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
376f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Compiler switch to embed a runtime search path
386f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLD_RPATH=
396f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLD_RPATH_PRE= -Wl,-rpath,
406f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
416f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Environment variable to set a runtime search path
426f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgLDLIBRARYPATH_ENVVAR = DYLD_LIBRARY_PATH
436f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
446f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgGENCCODE_ASSEMBLY=-a gcc-darwin
456f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
466f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Shared object suffix
476f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSO=		dylib
486f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Non-shared intermediate object suffix
496f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSTATIC_O = ao
506f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
516f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Override Versioned target for a shared library.
526f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgFINAL_SO_TARGET=  $(basename $(SO_TARGET)).$(SO_TARGET_VERSION).$(SO)
536f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgMIDDLE_SO_TARGET= $(basename $(SO_TARGET)).$(SO_TARGET_VERSION_MAJOR).$(SO)
546f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
556f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Compilation and dependency rules
566f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.$(STATIC_O): $(srcdir)/%.c
576f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -MMD -MT "$*.d $*.o $*.$(STATIC_O)" -o $@ $<)
586f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.o: $(srcdir)/%.c
596f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(call SILENT_COMPILE,$(strip $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS)) -MMD -MT "$*.d $*.o $*.$(STATIC_O)" -o $@ $<)
606f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
616f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.$(STATIC_O): $(srcdir)/%.cpp
626f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -MMD -MT "$*.d $*.o $*.$(STATIC_O)" -o $@ $<)
636f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.o: $(srcdir)/%.cpp
646f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS)) -MMD -MT "$*.d $*.o $*.$(STATIC_O)" -o $@ $<)
656f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
666f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Versioned libraries rules
676f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
686f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.$(SO_TARGET_VERSION_MAJOR).$(SO): %.$(SO_TARGET_VERSION).$(SO)
696f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(RM) $@ && ln -s ${<F} $@
706f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org%.$(SO): %.$(SO_TARGET_VERSION_MAJOR).$(SO)
716f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org	$(RM) $@ && ln -s ${*F}.$(SO_TARGET_VERSION).$(SO) $@
726f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
736f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# tzcode option
746f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgTZORIG_EXTRA_CFLAGS=-DSTD_INSPIRED
756f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
766f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org# genren opts
776f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgGENREN_PL_OPTS=-x Mach-O -n '-g' -p '| c++filt'
786f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
796f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## Remove shared library 's'
806f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSTATIC_PREFIX_WHEN_USED = 
816f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.orgSTATIC_PREFIX = 
826f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org
836f31ac30b9092fd02a8c97e5216cf53f3e4fae4jshin@chromium.org## End Darwin-specific setup
84