llvm-project/lldb/lib/Makefile
Keno Fischer 121c1c54bf Add -lpthread to LLDB shared lib link line unconditionally
Usually -lpthread is included due to LLVM link options,
but when LLVM threading is disabled, this does not happen.
pthread is still needed however because LLDB uses threading
regardless of whether LLVM is built with threading support or not.

Differential Revision: http://reviews.llvm.org/D5431

llvm-svn: 241006
2015-06-29 21:52:45 +00:00

205 lines
6.8 KiB
Makefile

##===- source/Makefile -------------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL := ../../..
LLDB_LEVEL := ..
LIBRARYNAME = lldb
#EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/resources/lldb-framework-exports
NO_BUILD_ARCHIVE = 1
LINK_LIBS_IN_SHARED = 1
SHARED_LIBRARY = 1
ifeq (,$(findstring -DLLDB_DISABLE_PYTHON,$(CXXFLAGS)))
PYTHON_BUILD_FLAGS = $(shell python-config --ldflags)
endif
# Include all archives in liblldb.so file
USEDLIBS = lldbAPI.a \
lldbBreakpoint.a \
lldbCommands.a \
lldbCore.a \
lldbDataFormatters.a \
lldbExpression.a \
lldbHostCommon.a \
lldbInitialize.a \
lldbInitAndLog.a \
lldbInterpreter.a \
lldbPluginABIMacOSX_arm.a \
lldbPluginABIMacOSX_arm64.a \
lldbPluginABIMacOSX_i386.a \
lldbPluginABISysV_arm.a \
lldbPluginABISysV_arm64.a \
lldbPluginABISysV_ppc.a \
lldbPluginABISysV_ppc64.a \
lldbPluginABISysV_mips.a \
lldbPluginABISysV_mips64.a \
lldbPluginABISysV_i386.a \
lldbPluginABISysV_x86_64.a \
lldbPluginABISysV_hexagon.a \
lldbPluginDisassemblerLLVM.a \
lldbPluginDynamicLoaderStatic.a \
lldbPluginDynamicLoaderPOSIX.a \
lldbPluginDynamicLoaderHexagon.a \
lldbPluginDynamicLoaderMacOSX.a \
lldbPluginEmulateInstructionARM.a \
lldbPluginEmulateInstructionARM64.a \
lldbPluginEmulateInstructionMIPS.a \
lldbPluginEmulateInstructionMIPS64.a \
lldbPluginInstrumentationRuntimeAddressSanitizer.a \
lldbPluginLanguageRuntimeCPlusPlusItaniumABI.a \
lldbPluginLanguageRuntimeObjCAppleObjCRuntime.a \
lldbPluginLanguageRuntimeRenderScriptRuntime.a \
lldbPluginMemoryHistoryASan.a \
lldbPluginObjectContainerBSDArchive.a \
lldbPluginObjectContainerUniversalMachO.a \
lldbPluginObjectFileELF.a \
lldbPluginObjectFileJIT.a \
lldbPluginSymbolVendorELF.a \
lldbPluginObjectFilePECOFF.a \
lldbPluginOperatingSystemPython.a \
lldbPluginPlatformGDBServer.a \
lldbPluginProcessGDBRemote.a \
lldbPluginSymbolFileDWARF.a \
lldbPluginSymbolFileSymtab.a \
lldbPluginSystemRuntimeMacOSX.a \
lldbPluginUnwindAssemblyInstEmulation.a \
lldbPluginUnwindAssemblyx86.a \
lldbPluginUtility.a \
lldbSymbol.a \
lldbTarget.a \
lldbUtility.a \
clangAnalysis.a \
clangAST.a \
clangBasic.a \
clangCodeGen.a \
clangFrontend.a \
clangDriver.a \
clangEdit.a \
clangLex.a \
clangParse.a \
clangSema.a \
clangSerialization.a \
LLVMMCDisassembler.a \
LLVMProfileData.a \
lldbPluginPlatformMacOSX.a \
lldbPluginPlatformLinux.a \
lldbPluginPlatformWindows.a \
lldbPluginPlatformFreeBSD.a \
lldbPluginPlatformPOSIX.a \
lldbPluginPlatformKalimba.a \
lldbPluginPlatformAndroid.a
# Because GCC requires RTTI enabled for lldbCore (see source/Core/Makefile) it is
# necessary to also link the clang rewriter libraries so vtable references can
# be resolved correctly, if we are building with GCC.
ifeq (g++,$(shell basename $(CXX) | cut -c 1-4))
USEDLIBS += clangRewrite.a \
clangRewriteFrontend.a
endif
include $(LLDB_LEVEL)/../../Makefile.config
LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
instrumentation ipo irreader selectiondag mc mcjit \
linker option
ifeq ($(HOST_OS),Darwin)
USEDLIBS += lldbHostMacOSX.a \
lldbHostPosix.a \
lldbPluginDynamicLoaderDarwinKernel.a \
lldbPluginObjectFileMachO.a \
lldbPluginSymbolVendorMacOSX.a \
lldbPluginProcessDarwin.a \
lldbPluginProcessMachCore.a \
lldbPluginProcessElfCore.a \
lldbPluginJITLoaderGDB.a
endif
ifeq ($(HOST_OS),Linux)
USEDLIBS += lldbHostLinux.a \
lldbHostPosix.a \
lldbPluginProcessLinux.a \
lldbPluginProcessPOSIX.a \
lldbPluginProcessElfCore.a \
lldbPluginJITLoaderGDB.a
endif
ifeq ($(HOST_OS),MingW)
USEDLIBS += lldbHostWindows.a \
lldbPluginProcessElfCore.a \
lldbPluginJITLoaderGDB.a
endif
ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
USEDLIBS += lldbHostFreeBSD.a \
lldbHostPosix.a \
lldbPluginProcessPOSIX.a \
lldbPluginProcessFreeBSD.a \
lldbPluginProcessElfCore.a \
lldbPluginJITLoaderGDB.a
endif
include $(LEVEL)/Makefile.common
ifeq ($(HOST_OS),MingW)
LLVMLibsOptions += -lws2_32
# Include everything from the .a's into the shared library.
ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
-Wl,--no-whole-archive
endif
ifeq ($(HOST_OS),Darwin)
LLVMLibsOptions += -Wl,-all_load
# set dylib internal version number to llvmCore submission number
ifdef LLDB_SUBMIT_VERSION
LLVMLibsOptions += -Wl,-current_version \
-Wl,$(LLDB_SUBMIT_VERSION).$(LLDB_SUBMIT_SUBVERSION) \
-Wl,-compatibility_version -Wl,1
endif
# extra options to override libtool defaults
LLVMLibsOptions += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks
LLVMLibsOptions += -framework Foundation -framework CoreFoundation
LLVMLibsOptions += -framework CoreServices -framework Carbon -framework Security
LLVMLibsOptions += -framework DebugSymbols $(PYTHON_BUILD_FLAGS) -lobjc
LLVMLibsOptions += -lxml2 -ledit -lpanel -lcurses
ifneq ($(EXPORTED_SYMBOL_FILE),)
LLVMLibsOptions += -Wl,-exported_symbols_list -Wl,"$(EXPORTED_SYMBOL_FILE)"
endif
# Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
ifneq ($(DARWIN_VERS),8)
LLVMLibsOptions += -Wl,-install_name \
-Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
endif
endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
# Include everything from the .a's into the shared library.
ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
-Wl,--no-whole-archive
# Don't allow unresolved symbols.
LLVMLibsOptions += -Wl,--no-undefined
# Link in python
LLVMLibsOptions += $(PYTHON_BUILD_FLAGS) -lrt -ledit -lncurses -lpanel -lpthread
LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
endif
ifeq ($(HOST_OS),FreeBSD)
# Include everything from the .a's into the shared library.
ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
-Wl,--no-whole-archive
# Allow unresolved symbols.
LLVMLibsOptions += -Wl,--allow-shlib-undefined
# Link in python
LLVMLibsOptions += $(PYTHON_BUILD_FLAGS) -lrt -L/usr/local/lib -lexecinfo \
-ledit -lncurses -lpanel -lpthread
endif