blob: ab2e16e5fab625cf22ed892916d96f7240045dd1 [file] [log] [blame]
Devang Patel5a7fb692008-07-18 23:47:27 +00001##===- tools/lto/Makefile ----------------------------------*- Makefile -*-===##
Nick Kledzik77595fc2008-02-26 20:26:43 +00002#
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
Daniel Dunbar8c39c962011-10-18 19:27:24 +000010LEVEL := ../..
11LIBRARYNAME := LTO
12LINK_COMPONENTS := all-targets ipo scalaropts linker bitreader bitwriter \
Hal Finkelde5e5ec2012-02-01 03:51:43 +000013 mcdisassembler vectorize
Daniel Dunbar8c39c962011-10-18 19:27:24 +000014LINK_LIBS_IN_SHARED := 1
15SHARED_LIBRARY := 1
Nick Kledzik77595fc2008-02-26 20:26:43 +000016
Dan Gohman7c52f2e2010-04-15 23:08:00 +000017EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/lto.exports
Dan Gohmanb16b53b2010-04-15 20:54:25 +000018
Nick Kledzik77595fc2008-02-26 20:26:43 +000019include $(LEVEL)/Makefile.common
20
Daniel Dunbar85354032010-10-15 22:46:15 +000021ifdef LLVM_VERSION_INFO
22CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"'
23endif
24
Anton Korobeynikove55db742009-08-18 00:40:33 +000025ifeq ($(HOST_OS),Darwin)
Daniel Dunbar48bf8f02010-07-16 01:41:38 +000026 # Special hack to allow libLTO to have an offset version number.
27 ifdef LLVM_LTO_VERSION_OFFSET
28 LTO_LIBRARY_VERSION := $(shell expr $(LLVM_SUBMIT_VERSION) + \
29 $(LLVM_LTO_VERSION_OFFSET))
30 else
31 LTO_LIBRARY_VERSION := $(LLVM_SUBMIT_VERSION)
32 endif
33
Nick Kledzik77595fc2008-02-26 20:26:43 +000034 # set dylib internal version number to llvmCore submission number
35 ifdef LLVM_SUBMIT_VERSION
36 LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
Daniel Dunbar48bf8f02010-07-16 01:41:38 +000037 -Wl,$(LTO_LIBRARY_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
Nick Kledzik4ed55ce2008-02-29 02:01:34 +000038 -Wl,-compatibility_version -Wl,1
Nick Kledzik77595fc2008-02-26 20:26:43 +000039 endif
40 # extra options to override libtool defaults
41 LLVMLibsOptions := $(LLVMLibsOptions) \
Nick Kledzik873570e2008-03-02 06:33:06 +000042 -Wl,-dead_strip \
43 -Wl,-seg1addr -Wl,0xE0000000
Nick Kledzik77595fc2008-02-26 20:26:43 +000044
Nick Kledzik873570e2008-03-02 06:33:06 +000045 # 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) \
Daniel Dunbarb259c012010-07-31 21:32:56 +000049 -Wl,-install_name \
Nick Kledzik873570e2008-03-02 06:33:06 +000050 -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
51 endif
Bill Wendling10181ae2012-10-03 23:52:10 +000052
53 # If we're doing an Apple-style build, add the LTO object path.
Bill Wendlingee740dd2013-02-13 19:44:08 +000054 ifeq ($(RC_XBS),YES)
Bill Wendlingc33b9302012-10-10 05:29:15 +000055 TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
56 LLVMLibsOptions := $(LLVMLibsOptions) \
57 -Wl,-object_path_lto -Wl,$(TempFile)
Bill Wendling10181ae2012-10-03 23:52:10 +000058 endif
Nick Kledzik77595fc2008-02-26 20:26:43 +000059endif