Home | History | Annotate | Download | only in lto
      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 LINK_COMPONENTS := all-targets ipo scalaropts linker bitreader bitwriter \
     13                    mcdisassembler vectorize
     14 LINK_LIBS_IN_SHARED := 1
     15 SHARED_LIBRARY := 1
     16 
     17 EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/lto.exports
     18 
     19 include $(LEVEL)/Makefile.common
     20 
     21 ifdef LLVM_VERSION_INFO
     22 CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"'
     23 endif
     24 
     25 ifeq ($(HOST_OS),Darwin)
     26     # 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 
     34     # set dylib internal version number to llvmCore submission number
     35     ifdef LLVM_SUBMIT_VERSION
     36         LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
     37                         -Wl,$(LTO_LIBRARY_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
     38                         -Wl,-compatibility_version -Wl,1
     39     endif
     40     # extra options to override libtool defaults 
     41     LLVMLibsOptions    := $(LLVMLibsOptions)  \
     42                          -Wl,-dead_strip
     43 
     44     # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
     45     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
     46     ifneq ($(DARWIN_VERS),8)
     47        LLVMLibsOptions    := $(LLVMLibsOptions)  \
     48                             -Wl,-install_name \
     49                             -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
     50     endif
     51 
     52     # If we're doing an Apple-style build, add the LTO object path.
     53     ifeq ($(RC_XBS),YES)
     54        TempFile        := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
     55        LLVMLibsOptions := $(LLVMLibsOptions) \
     56                           -Wl,-object_path_lto -Wl,$(TempFile)
     57     endif
     58 endif
     59