3120aa52c953afb7e778081652fa7acc7bab8f18
[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
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
16 include $(LEVEL)/Makefile.config
17
18 LINK_LIBS_IN_SHARED = 1
19 SHARED_LIBRARY = 1
20
21 LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader bitwriter
22
23 include $(LEVEL)/Makefile.common
24
25 ifeq ($(HOST_OS),Darwin)
26     # set dylib internal version number to llvmCore submission number
27     ifdef LLVM_SUBMIT_VERSION
28         LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
29                         -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
30                         -Wl,-compatibility_version -Wl,1
31     endif
32     # extra options to override libtool defaults 
33     LLVMLibsOptions    := $(LLVMLibsOptions)  \
34                          -avoid-version \
35                          -Wl,-exported_symbols_list -Wl,$(PROJ_SRC_DIR)/lto.exports \
36                          -Wl,-dead_strip \
37                          -Wl,-seg1addr -Wl,0xE0000000 
38
39     # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
40     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
41     ifneq ($(DARWIN_VERS),8)
42        LLVMLibsOptions    := $(LLVMLibsOptions)  \
43                             -no-undefined -Wl,-install_name \
44                             -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
45     endif
46 endif