Use a special path to place the .o files in.
[oota-llvm.git] / tools / lto / Makefile
index 46925e77de2cc73fd3a9e53e823369a667b4f488..4a468dedf59f91fe23aebe75d2fe2120415885de 100644 (file)
@@ -7,22 +7,15 @@
 # 
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../..
-LIBRARYNAME = LTO
+LEVEL := ../..
+LIBRARYNAME := LTO
+LINK_COMPONENTS := all-targets ipo scalaropts linker bitreader bitwriter \
+                   mcdisassembler vectorize
+LINK_LIBS_IN_SHARED := 1
+SHARED_LIBRARY := 1
 
 EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/lto.exports
 
-# Include this here so we can get the configuration of the targets
-# that have been configured for construction. We have to do this 
-# early so we can set up LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
-
-LINK_LIBS_IN_SHARED = 1
-SHARED_LIBRARY = 1
-
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader \
-       bitwriter mcdisassembler
-
 include $(LEVEL)/Makefile.common
 
 ifdef LLVM_VERSION_INFO
@@ -56,4 +49,12 @@ ifeq ($(HOST_OS),Darwin)
                             -Wl,-install_name \
                             -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
     endif
+
+    # If we're doing an Apple-style build, add the LTO object path.
+    ifeq ($(RC_BUILDIT),YES)
+       ObjDir             := $(shell mkdir -p ${OBJROOT}/dSYMs)
+       TempFile           := $(shell mktemp ${ObjDir}/llvm-lto.XXXXXX)
+       LLVMLibsOptions    := $(LLVMLibsOptions) \
+                             -Wl,-object_path_lto -Wl,$(TempFile)
+    endif
 endif