Close list item tag, to conform with the style in this file. It's optional
[oota-llvm.git] / Makefile.rules
index a048f941ad170922726cf79e5400754a5074c4be..56d3a8739edefb302cc6c641d73dcb36a7aaa32f 100644 (file)
@@ -444,7 +444,10 @@ endif
 endif
 
 ifeq ($(OS),Darwin)
-  SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle
+  DARWIN_VERSION := `sw_vers -productVersion`
+  SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle \
+                    -mmacosx-version-min=$(DARWIN_VERSION)
+  CompileCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
 else
   SharedLinkOptions=-shared
 endif
@@ -453,7 +456,7 @@ endif
 # Options To Invoke Tools
 #----------------------------------------------------------
 
-CompileCommonOpts := -pedantic -Wall -W -Wwrite-strings -Wno-long-long \
+CompileCommonOpts += -pedantic -Wall -W -Wwrite-strings -Wno-long-long \
                      -Wunused -Wno-unused-parameter $(EXTRA_OPTIONS)
 
 ifeq ($(OS),HP-UX)
@@ -477,10 +480,10 @@ ifdef UNIVERSAL
   endif
   UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
   CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
-  Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS:%=-XCClinker %)
+  Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS)
   ifdef UNIVERSAL_SDK_PATH
     CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
-    Relink.Flags      += -XCClinker -isysroot -XCClinker $(UNIVERSAL_SDK_PATH)
+    Relink.Flags      += -isysroot $(UNIVERSAL_SDK_PATH)
   endif
 
   # Building universal cannot compute dependencies automatically.
@@ -977,7 +980,7 @@ all-local:: $(LibName.O)
 
 $(LibName.O): $(ObjectsO) $(LibDir)/.dir
        $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
-       $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlibs -nostartfiles -o $@ $(ObjectsO)
+       $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlib -nostartfiles -o $@ $(ObjectsO)
 
 clean-local::
 ifneq ($(strip $(LibName.O)),)
@@ -1063,6 +1066,24 @@ else
 ToolBuildPath   := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT)
 endif
 
+#---------------------------------------------------------
+# Prune Exports
+#---------------------------------------------------------
+
+# If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
+# not exporting all of the weak symbols from the binary.  This reduces dyld
+# startup time by 4x on darwin in some cases.
+ifdef TOOL_NO_EXPORTS
+ifeq ($(OS),Darwin)
+LD.Flags += -Wl,-exported_symbol -Wl,_main
+endif
+
+ifeq ($(OS), $(filter $(OS), Linux NetBSD FreeBSD))
+LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
+endif
+endif
+
+
 #---------------------------------------------------------
 # Provide targets for building the tools
 #---------------------------------------------------------