Makefile revision e73a31f667ad2fe03e25c97ac45b58c30d7f07c3
14ee2ad04344446e610172a0e73949212923014dfSebastian Redl##===- tools/lto/Makefile ----------------------------------*- Makefile -*-===##
22cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor# 
32cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor#                     The LLVM Compiler Infrastructure
42cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor#
52cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor# This file is distributed under the University of Illinois Open Source
62cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor# License. See LICENSE.TXT for details.
72cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor# 
82cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor##===----------------------------------------------------------------------===##
92cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor
10a4232eb646d89e7d52424bb42eb87d9061f39e63Sebastian RedlLEVEL = ../..
112cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas GregorLIBRARYNAME = LTO
122cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor
132cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor# Include this here so we can get the configuration of the targets
147faa2ec03a7ef120ac165bb45b6c70a8b20c9f1cSebastian Redl# that have been configured for construction. We have to do this 
150eca89e9890db4d8336ce762a5b359a1d58ca02bArgyrios Kyrtzidis# early so we can set up LINK_COMPONENTS before including Makefile.rules
16e737f5041a36d0befb39ffeed8d50ba15916d3daDouglas Gregorinclude $(LEVEL)/Makefile.config
17e737f5041a36d0befb39ffeed8d50ba15916d3daDouglas Gregor
182cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas GregorLINK_LIBS_IN_SHARED = 1
192cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas GregorSHARED_LIBRARY = 1
202cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas GregorCXXFLAGS = -fno-rtti
212a7fb27913999d132cf9e10e03dc5271faa2e9d3John McCall
2289eaf3af92c72c0c1aae807644e39cabc461d685Argyrios KyrtzidisLINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader bitwriter
230b7489194f9f89fac39d57211c1e7953ae50251fDouglas Gregor
247a1fad38256eb4c5129359be85ba1ea1678eb5c9John McCallinclude $(LEVEL)/Makefile.common
252cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor
26a1ee0c548b8aa4aaf93d1917e304e3da13171a08John McCallifeq ($(HOST_OS),Darwin)
276ab7cd853e9c15cf986a8a7c3db1f8d20e275409Sebastian Redl    # set dylib internal version number to llvmCore submission number
287c5d24efcd2e505b5739f7def08dfe25ce59a1b2Chris Lattner    ifdef LLVM_SUBMIT_VERSION
296a5a23f8e7fb65e028c8092bc1d1a1d9dfe2e9bcDouglas Gregor        LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
307c5d24efcd2e505b5739f7def08dfe25ce59a1b2Chris Lattner                        -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
3183d63c78810556d26b62ac4cbae2eda6cdd2570cSteve Naroff                        -Wl,-compatibility_version -Wl,1
3214f79002e58556798e86168c63e48d533287eda5Douglas Gregor    endif
333251ceb90b3fec68e86d6dcfa58836e20a7205c3Douglas Gregor    # extra options to override libtool defaults 
3414f79002e58556798e86168c63e48d533287eda5Douglas Gregor    LLVMLibsOptions    := $(LLVMLibsOptions)  \
35bd94500d3aa60092fb0f1e90f53fb0d03fa502a8Douglas Gregor                         -avoid-version \
362bec0410d268779f601bd509e0302a500af7ac6aDouglas Gregor                         -Wl,-exported_symbols_list -Wl,$(PROJ_SRC_DIR)/lto.exports \
37ab41e63821dc60ad144d0684df8d79a9eef86b75Douglas Gregor                         -Wl,-dead_strip \
3817fc223395d51be582fc666bb6ea21bd1dff26dcDouglas Gregor                         -Wl,-seg1addr -Wl,0xE0000000 
3917fc223395d51be582fc666bb6ea21bd1dff26dcDouglas Gregor
402596e429a61602312bdd149786045b8a90cd2d10Daniel Dunbar    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
412cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
4214f79002e58556798e86168c63e48d533287eda5Douglas Gregor    ifneq ($(DARWIN_VERS),8)
43b64c19365deab788753d29c9bc881253c3f16f37Douglas Gregor       LLVMLibsOptions    := $(LLVMLibsOptions)  \
443c304bd9ec2b4611572d4cbae9e1727bbecb5dc9Chris Lattner                            -no-undefined -Wl,-install_name \
452cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregor                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
468538e8d43a3a9bd439c987c0de37bcbf035dd391Sebastian Redl    endif
472cf2634ffdb4f7c8d46cef3f8e60a55993f1c57aDouglas Gregorendif
48ade5000c8763f4bec41f452d7efa3a9b2a6d4712Sebastian Redl