Makefile revision 8535403ee0e6bd3f1e56236e3dc5d007c5c9c02b
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
10LEVEL = ../..
11LIBRARYNAME = LTO
12
13EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/lto.exports
14
15# Include this here so we can get the configuration of the targets
16# that have been configured for construction. We have to do this 
17# early so we can set up LINK_COMPONENTS before including Makefile.rules
18include $(LEVEL)/Makefile.config
19
20LINK_LIBS_IN_SHARED = 1
21SHARED_LIBRARY = 1
22
23LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader bitwriter
24
25include $(LEVEL)/Makefile.common
26
27ifdef LLVM_VERSION_INFO
28CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"'
29endif
30
31ifeq ($(HOST_OS),Darwin)
32    # Special hack to allow libLTO to have an offset version number.
33    ifdef LLVM_LTO_VERSION_OFFSET
34        LTO_LIBRARY_VERSION := $(shell expr $(LLVM_SUBMIT_VERSION) + \
35                                            $(LLVM_LTO_VERSION_OFFSET))
36    else
37        LTO_LIBRARY_VERSION := $(LLVM_SUBMIT_VERSION)
38    endif
39
40    # set dylib internal version number to llvmCore submission number
41    ifdef LLVM_SUBMIT_VERSION
42        LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
43                        -Wl,$(LTO_LIBRARY_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
44                        -Wl,-compatibility_version -Wl,1
45    endif
46    # extra options to override libtool defaults 
47    LLVMLibsOptions    := $(LLVMLibsOptions)  \
48                         -Wl,-dead_strip \
49                         -Wl,-seg1addr -Wl,0xE0000000 
50
51    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
52    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
53    ifneq ($(DARWIN_VERS),8)
54       LLVMLibsOptions    := $(LLVMLibsOptions)  \
55                            -Wl,-install_name \
56                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
57    endif
58endif
59