Home | History | Annotate | Download | only in libclang
      1 ##===- tools/libclang/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 CLANG_LEVEL := ../..
     11 LIBRARYNAME = clang
     12 
     13 EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/libclang.exports
     14 
     15 LINK_LIBS_IN_SHARED = 1
     16 SHARED_LIBRARY = 1
     17 
     18 include $(CLANG_LEVEL)/../../Makefile.config
     19 LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
     20 USEDLIBS = clangFrontend.a clangDriver.a \
     21 	   clangTooling.a \
     22 	   clangSerialization.a \
     23 	   clangParse.a clangSema.a \
     24 	   clangARCMigrate.a clangRewriteFrontend.a clangRewriteCore.a \
     25 	   clangAnalysis.a clangEdit.a \
     26 	   clangAST.a clangLex.a clangBasic.a \
     27 	   clangFormat.a
     28 
     29 include $(CLANG_LEVEL)/Makefile
     30 
     31 # Add soname to the library.
     32 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU GNU/kFreeBSD))
     33         LDFLAGS += -Wl,-soname,lib$(LIBRARYNAME)$(SHLIBEXT)
     34 endif
     35 
     36 ##===----------------------------------------------------------------------===##
     37 # FIXME: This is copied from the 'lto' makefile.  Should we share this?
     38 ##===----------------------------------------------------------------------===##
     39 
     40 ifeq ($(HOST_OS),Darwin)
     41     LLVMLibsOptions += -Wl,-compatibility_version,1
     42 
     43     # Set dylib internal version number to submission number.
     44     ifdef LLVM_SUBMIT_VERSION
     45         LLVMLibsOptions += -Wl,-current_version \
     46                            -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION)
     47     endif
     48 
     49     # Extra options to override libtool defaults.
     50     LLVMLibsOptions += -Wl,-dead_strip
     51 
     52     # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
     53     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
     54     ifneq ($(DARWIN_VERS),8)
     55        LLVMLibsOptions += -Wl,-install_name \
     56                           -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
     57     endif
     58 
     59     # If we're doing an Apple-style build, add the LTO object path.
     60     ifeq ($(RC_XBS),YES)
     61        TempFile        := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/clang-lto.XXXXXX)
     62        LLVMLibsOptions += -Wl,-object_path_lto -Wl,$(TempFile)
     63     endif
     64 endif
     65