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