Makefile revision 48bf8f0c3ade7f55dedb6d0c2142f1e064a95668
19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall##===- tools/lto/Makefile ----------------------------------*- Makefile -*-===##
29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# 
39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#                     The LLVM Compiler Infrastructure
49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#
59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# This file is distributed under the University of Illinois Open Source
69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# License. See LICENSE.TXT for details.
79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# 
89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall##===----------------------------------------------------------------------===##
99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallLEVEL = ../..
119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallLIBRARYNAME = LTO
129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallEXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/lto.exports
149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# Include this here so we can get the configuration of the targets
169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# that have been configured for construction. We have to do this 
179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# early so we can set up LINK_COMPONENTS before including Makefile.rules
189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallinclude $(LEVEL)/Makefile.config
199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallLINK_LIBS_IN_SHARED = 1
219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallSHARED_LIBRARY = 1
229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallLINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader bitwriter
249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallinclude $(LEVEL)/Makefile.common
269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallifeq ($(HOST_OS),Darwin)
289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    # Special hack to allow libLTO to have an offset version number.
299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    ifdef LLVM_LTO_VERSION_OFFSET
309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall        LTO_LIBRARY_VERSION := $(shell expr $(LLVM_SUBMIT_VERSION) + \
319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                                            $(LLVM_LTO_VERSION_OFFSET))
329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    else
339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall        LTO_LIBRARY_VERSION := $(LLVM_SUBMIT_VERSION)
349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    endif
359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    # set dylib internal version number to llvmCore submission number
379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    ifdef LLVM_SUBMIT_VERSION
389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall        LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                        -Wl,$(LTO_LIBRARY_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                        -Wl,-compatibility_version -Wl,1
419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    endif
429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    # extra options to override libtool defaults 
439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    LLVMLibsOptions    := $(LLVMLibsOptions)  \
449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                         -avoid-version \
459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                         -Wl,-dead_strip \
469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                         -Wl,-seg1addr -Wl,0xE0000000 
479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    ifneq ($(DARWIN_VERS),8)
519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall       LLVMLibsOptions    := $(LLVMLibsOptions)  \
529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                            -no-undefined -Wl,-install_name \
539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    endif
559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallendif
569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall