Makefile revision e57cb731532cfe91788823cd5b5b847311bd3920
12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)##===- tools/lto/Makefile ----------------------------------*- Makefile -*-===##
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# 
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#                     The LLVM Compiler Infrastructure
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# This file is distributed under the University of Illinois Open Source
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# License. See LICENSE.TXT for details.
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)# 
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)##===----------------------------------------------------------------------===##
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)LEVEL := ../..
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)LIBRARYNAME := LTO
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)LINK_COMPONENTS := all-targets ipo scalaropts linker bitreader bitwriter \
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                   mcdisassembler vectorize
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)LINK_LIBS_IN_SHARED := 1
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)SHARED_LIBRARY := 1
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
17f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/lto.exports
18f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)include $(LEVEL)/Makefile.common
20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)ifdef LLVM_VERSION_INFO
22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"'
23f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)endif
24f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
25f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)ifeq ($(HOST_OS),Darwin)
26f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    # Special hack to allow libLTO to have an offset version number.
27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    ifdef LLVM_LTO_VERSION_OFFSET
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)        LTO_LIBRARY_VERSION := $(shell expr $(LLVM_SUBMIT_VERSION) + \
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                            $(LLVM_LTO_VERSION_OFFSET))
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    else
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)        LTO_LIBRARY_VERSION := $(LLVM_SUBMIT_VERSION)
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    endif
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    # set dylib internal version number to llvmCore submission number
35f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    ifdef LLVM_SUBMIT_VERSION
36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)        LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                        -Wl,$(LTO_LIBRARY_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                        -Wl,-compatibility_version -Wl,1
392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    endif
402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    # extra options to override libtool defaults 
412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    LLVMLibsOptions    := $(LLVMLibsOptions)  \
422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                         -Wl,-dead_strip \
432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                         -Wl,-seg1addr -Wl,0xE0000000 
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    ifneq ($(DARWIN_VERS),8)
48f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)       LLVMLibsOptions    := $(LLVMLibsOptions)  \
497dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                            -Wl,-install_name \
502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    endif
522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    # If we're doing an Apple-style build, add the LTO object path.
542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    ifeq ($(RC_BUILDIT),YES)
55f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)       ObjDir             := $(shell mkdir -p ${OBJROOT}/dSYMs)
567dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch       TempFile           := $(shell mktemp ${ObjDir}/llvm-lto.XXXXXX)
572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)       LLVMLibsOptions    := $(LLVMLibsOptions) \
582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                             -Wl,-object_path_lto -Wl,$(TempFile)
59eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    endif
60eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochendif
61eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch