| Jeffrey Yasskin | f6afae2 | 2010-02-18 02:36:02 +0000 | [diff] [blame^] | 1 | ##===- tools/shlib/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 = LLVM$(LLVMVersion) | 
 | 12 |  | 
 | 13 | NO_BUILD_ARCHIVE = 1 | 
 | 14 | LINK_LIBS_IN_SHARED = 1 | 
 | 15 | SHARED_LIBRARY = 1 | 
 | 16 |  | 
 | 17 | include $(LEVEL)/Makefile.common | 
 | 18 |  | 
 | 19 | # Include all archives in libLLVM.(so|dylib) except the ones that have | 
 | 20 | # their own dynamic libraries. | 
 | 21 | Archives := $(wildcard $(LibDir)/libLLVM*.a) | 
 | 22 | SharedLibraries := $(wildcard $(LibDir)/libLLVM*$(SHLIBEXT)) | 
 | 23 | IncludeInLibLlvm := $(filter-out $(basename $(SharedLibraries)).a, $(Archives)) | 
 | 24 | LLVMLibsOptions := $(IncludeInLibLlvm:$(LibDir)/lib%.a=-l%) | 
 | 25 | LLVMLibsPaths   := $(IncludeInLibLlvm) | 
 | 26 |  | 
 | 27 | $(LibName.SO): $(LLVMLibsPaths) | 
 | 28 |  | 
 | 29 | ifeq ($(HOST_OS),Darwin) | 
 | 30 |     # set dylib internal version number to llvmCore submission number | 
 | 31 |     ifdef LLVM_SUBMIT_VERSION | 
 | 32 |         LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \ | 
 | 33 |                         -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) \ | 
 | 34 |                         -Wl,-compatibility_version -Wl,1 | 
 | 35 |     endif | 
 | 36 |     # Include everything from the .a's into the shared library. | 
 | 37 |     LLVMLibsOptions    := $(LLVMLibsOptions)  \ | 
 | 38 |                           -Wl,-all_load | 
 | 39 |     # extra options to override libtool defaults  | 
 | 40 |     LLVMLibsOptions    := $(LLVMLibsOptions)  \ | 
 | 41 |                          -avoid-version \ | 
 | 42 |                          -Wl,-dead_strip \ | 
 | 43 |                          -Wl,-seg1addr -Wl,0xE0000000  | 
 | 44 |  | 
 | 45 |     # 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)  \ | 
 | 49 |                             -Wl,-install_name \ | 
 | 50 |                             -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)" | 
 | 51 |     endif | 
 | 52 | endif | 
 | 53 |  | 
 | 54 | ifeq ($(HOST_OS), Linux) | 
 | 55 |     # Include everything from the .a's into the shared library. | 
 | 56 |     LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \ | 
 | 57 |                        -Wl,--no-whole-archive | 
 | 58 |     # Don't allow unresolved symbols, and warn if we'll need to modify | 
 | 59 |     # the text segment when loading libLLVM.so. | 
 | 60 |     LLVMLibsOptions += -Wl,--no-undefined,--warn-shared-textrel | 
 | 61 | endif |