1cfff028f6f00ba7420b4a53a6f837156634cb11
[oota-llvm.git] / tools / lto / Makefile
1 ##===- tools/lto/Makefile ----------------------------------*- Makefile -*-===##
2
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
7
8 ##===----------------------------------------------------------------------===##
9
10 LEVEL := ../..
11 LIBRARYNAME := LTO
12 LINK_COMPONENTS := all-targets core lto mc mcdisassembler support
13 LINK_LIBS_IN_SHARED := 1
14 SHARED_LIBRARY := 1
15
16 EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/lto.exports
17
18 include $(LEVEL)/Makefile.common
19
20 ifdef LLVM_VERSION_INFO
21 CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"'
22 endif
23
24 ifeq ($(HOST_OS),Darwin)
25     # Special hack to allow libLTO to have an offset version number.
26     ifdef LLVM_LTO_VERSION_OFFSET
27         LTO_LIBRARY_VERSION := $(shell expr $(LLVM_SUBMIT_VERSION) + \
28                                             $(LLVM_LTO_VERSION_OFFSET))
29     else
30         LTO_LIBRARY_VERSION := $(LLVM_SUBMIT_VERSION)
31     endif
32
33     # set dylib internal version number to llvmCore submission number
34     ifdef LLVM_SUBMIT_VERSION
35         LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
36                         -Wl,$(LTO_LIBRARY_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
37                         -Wl,-compatibility_version -Wl,1
38     endif
39
40     # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
41     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
42     ifneq ($(DARWIN_VERS),8)
43        LLVMLibsOptions    := $(LLVMLibsOptions)  \
44                             -Wl,-install_name \
45                             -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
46     endif
47
48     # If we're doing an Apple-style build, add the LTO object path.
49     ifeq ($(RC_XBS),YES)
50        TempFile        := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
51        LLVMLibsOptions := $(LLVMLibsOptions) \
52                           -Wl,-object_path_lto -Wl,$(TempFile)
53     endif
54 endif