blob: eb5276823921c9c3a7dbfe74b4dd8ea166006b06 [file] [log] [blame]
Greg Clayton54e7afa2010-07-09 20:39:50 +00001##===- source/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
10LEVEL := ../../..
11LLDB_LEVEL := ..
12
13LIBRARYNAME = lldb
14
Filipe Cabecinhas93024d92012-05-29 13:41:50 +000015#EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/resources/lldb-framework-exports
Greg Clayton54e7afa2010-07-09 20:39:50 +000016NO_BUILD_ARCHIVE = 1
17LINK_LIBS_IN_SHARED = 1
18SHARED_LIBRARY = 1
19
Johnny Chen00876122011-05-19 23:09:48 +000020PYTHON_BUILD_FLAGS = $(shell python-config --ldflags)
Greg Clayton1a2f3112011-02-05 02:32:19 +000021
Filipe Cabecinhas93024d92012-05-29 13:41:50 +000022# Include all archives in liblldb.so file
Greg Clayton54e7afa2010-07-09 20:39:50 +000023USEDLIBS = lldbAPI.a \
24 lldbBreakpoint.a \
25 lldbCommands.a \
26 lldbCore.a \
Filipe Cabecinhas30c187c2013-01-30 00:28:58 +000027 lldbDataFormatters.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000028 lldbExpression.a \
Greg Clayton8f3b21d2010-09-07 20:11:56 +000029 lldbHostCommon.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000030 lldbInitAndLog.a \
31 lldbInterpreter.a \
Peter Collingbourneb7f59452011-05-19 18:32:34 +000032 lldbPluginABIMacOSX_arm.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000033 lldbPluginABIMacOSX_i386.a \
34 lldbPluginABISysV_x86_64.a \
35 lldbPluginDisassemblerLLVM.a \
Stephen Wilson8be525a2011-03-08 03:57:00 +000036 lldbPluginDynamicLoaderStatic.a \
Filipe Cabecinhas93024d92012-05-29 13:41:50 +000037 lldbPluginDynamicLoaderPOSIX.a \
Stephen Wilsonec113d42011-04-08 02:01:35 +000038 lldbPluginEmulateInstructionARM.a \
Charles Davis1e58a392011-05-19 23:53:23 +000039 lldbPluginLanguageRuntimeCPlusPlusItaniumABI.a \
40 lldbPluginLanguageRuntimeObjCAppleObjCRuntime.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000041 lldbPluginObjectContainerBSDArchive.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000042 lldbPluginObjectFileELF.a \
Michael Sartaina807cee2013-07-01 19:45:50 +000043 lldbPluginSymbolVendorELF.a \
Greg Claytonfa407ad2011-10-11 16:42:21 +000044 lldbPluginObjectFilePECOFF.a \
Filipe Cabecinhas915da352012-08-28 13:59:38 +000045 lldbPluginOperatingSystemPython.a \
Stephen Wilson3967cef2011-03-26 00:32:59 +000046 lldbPluginPlatformGDBServer.a \
47 lldbPluginProcessGDBRemote.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000048 lldbPluginSymbolFileDWARF.a \
49 lldbPluginSymbolFileSymtab.a \
Peter Collingbourne59d4cb82011-05-19 17:34:58 +000050 lldbPluginUnwindAssemblyInstEmulation.a \
51 lldbPluginUnwindAssemblyx86.a \
Stephen Wilson64dd0d72011-01-06 22:11:47 +000052 lldbPluginUtility.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000053 lldbSymbol.a \
54 lldbTarget.a \
55 lldbUtility.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000056 clangAnalysis.a \
57 clangAST.a \
58 clangBasic.a \
59 clangCodeGen.a \
60 clangFrontend.a \
61 clangDriver.a \
Benjamin Kramer9930b332012-03-14 11:03:46 +000062 clangEdit.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000063 clangLex.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000064 clangParse.a \
65 clangSema.a \
Stephen Wilson64dd0d72011-01-06 22:11:47 +000066 clangSerialization.a \
Greg Claytoned605712012-02-28 18:25:00 +000067 LLVMMCDisassembler.a \
68 lldbPluginPlatformMacOSX.a \
69 lldbPluginPlatformLinux.a \
70 lldbPluginPlatformFreeBSD.a
Greg Clayton54e7afa2010-07-09 20:39:50 +000071
Daniel Malea8bc4f6e2012-12-10 21:05:57 +000072# Because GCC requires RTTI enabled for lldbCore (see source/Core/Makefile) it is
73# necessary to also link the clang rewriter libraries so vtable references can
74# be resolved correctly, if we are building with GCC.
Greg Claytondbe390e2013-05-17 20:56:55 +000075ifeq (g++,$(shell basename $(CXX) | colrm 4))
Daniel Malea8bc4f6e2012-12-10 21:05:57 +000076 USEDLIBS += clangRewriteCore.a \
77 clangRewriteFrontend.a
78endif
79
Eli Friedman26f93ce2010-07-09 22:11:43 +000080include $(LLDB_LEVEL)/../../Makefile.config
81
82LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
Rafael Espindola5d4f6a72013-06-14 23:00:27 +000083 instrumentation ipo irreader selectiondag jit mc mcjit \
84 linker option
Eli Friedman26f93ce2010-07-09 22:11:43 +000085
86ifeq ($(HOST_OS),Darwin)
87 USEDLIBS += lldbHostMacOSX.a \
88 lldbPluginDynamicLoaderMacOSX.a \
Daniel Dunbar8e584ec2011-10-31 22:51:08 +000089 lldbPluginDynamicLoaderDarwinKernel.a \
Eli Friedman26f93ce2010-07-09 22:11:43 +000090 lldbPluginObjectContainerUniversalMachO.a \
91 lldbPluginObjectFileMachO.a \
Stephen Wilsonef6635b2011-03-10 03:08:28 +000092 lldbPluginSymbolVendorMacOSX.a \
Johnny Chen7637a3a2012-02-24 18:02:59 +000093 lldbPluginProcessDarwin.a \
94 lldbPluginProcessMachCore.a
Eli Friedman26f93ce2010-07-09 22:11:43 +000095endif
96
97ifeq ($(HOST_OS),Linux)
Jason Molenda4a55d752012-10-04 02:16:06 +000098 USEDLIBS += lldbHostLinux.a \
Johnny Chen7e996472012-01-05 19:17:38 +000099 lldbPluginProcessLinux.a \
Jason Molenda4a55d752012-10-04 02:16:06 +0000100 lldbPluginProcessPOSIX.a \
Ashok Thirumurthif6f52692013-07-17 16:06:12 +0000101 lldbPluginDynamicLoaderMacOSX.a \
102 lldbPluginProcessElfCore.a
Eli Friedman26f93ce2010-07-09 22:11:43 +0000103endif
104
Sylvestre Ledrufa2cd912013-07-01 08:21:36 +0000105ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
Johnny Chen4b663292011-08-02 20:52:42 +0000106 USEDLIBS += lldbHostFreeBSD.a \
Johnny Chen7e996472012-01-05 19:17:38 +0000107 lldbPluginProcessPOSIX.a \
Ashok Thirumurthif6f52692013-07-17 16:06:12 +0000108 lldbPluginProcessFreeBSD.a \
109 lldbPluginProcessElfCore.a
Johnny Chen4b663292011-08-02 20:52:42 +0000110endif
111
Greg Clayton54e7afa2010-07-09 20:39:50 +0000112include $(LEVEL)/Makefile.common
113
Greg Clayton54e7afa2010-07-09 20:39:50 +0000114ifeq ($(HOST_OS),Darwin)
Eli Friedman26f93ce2010-07-09 22:11:43 +0000115 LLVMLibsOptions += -Wl,-all_load
Greg Clayton54e7afa2010-07-09 20:39:50 +0000116 # set dylib internal version number to llvmCore submission number
117 ifdef LLDB_SUBMIT_VERSION
118 LLVMLibsOptions += -Wl,-current_version \
119 -Wl,$(LLDB_SUBMIT_VERSION).$(LLDB_SUBMIT_SUBVERSION) \
120 -Wl,-compatibility_version -Wl,1
121 endif
122 # extra options to override libtool defaults
Greg Clayton54e7afa2010-07-09 20:39:50 +0000123 LLVMLibsOptions += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks
Charles Davis1e58a392011-05-19 23:53:23 +0000124 LLVMLibsOptions += -framework Foundation -framework CoreFoundation
Bill Wendling5a45f242012-04-05 06:20:13 +0000125 LLVMLibsOptions += -framework CoreServices -framework Carbon -framework Security
Greg Clayton1a2f3112011-02-05 02:32:19 +0000126 LLVMLibsOptions += -framework DebugSymbols $(PYTHON_BUILD_FLAGS) -lobjc
Filipe Cabecinhasb9f6fd82012-10-31 23:02:00 +0000127 LLVMLibsOptions += -lxml2
Filipe Cabecinhas93024d92012-05-29 13:41:50 +0000128 ifneq ($(EXPORTED_SYMBOL_FILE),)
129 LLVMLibsOptions += -Wl,-exported_symbols_list -Wl,"$(EXPORTED_SYMBOL_FILE)"
130 endif
Greg Clayton54e7afa2010-07-09 20:39:50 +0000131 # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
132 DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
133 ifneq ($(DARWIN_VERS),8)
Daniel Dunbar2888f552011-10-31 22:50:30 +0000134 LLVMLibsOptions += -Wl,-install_name \
Greg Clayton54e7afa2010-07-09 20:39:50 +0000135 -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
136 endif
137endif
138
Sylvestre Ledrufa2cd912013-07-01 08:21:36 +0000139ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
Greg Clayton54e7afa2010-07-09 20:39:50 +0000140 # Include everything from the .a's into the shared library.
Eli Friedman26f93ce2010-07-09 22:11:43 +0000141 ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
Greg Clayton54e7afa2010-07-09 20:39:50 +0000142 -Wl,--no-whole-archive
143 # Don't allow unresolved symbols.
144 LLVMLibsOptions += -Wl,--no-undefined
Eli Friedman26f93ce2010-07-09 22:11:43 +0000145 # Link in python
Filipe Cabecinhas93024d92012-05-29 13:41:50 +0000146 LLVMLibsOptions += $(PYTHON_BUILD_FLAGS) -lrt
Sylvestre Ledru5f6f3e22013-01-17 16:59:32 +0000147 LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
Greg Clayton54e7afa2010-07-09 20:39:50 +0000148endif
Johnny Chen4b663292011-08-02 20:52:42 +0000149
150ifeq ($(HOST_OS),FreeBSD)
151 # Include everything from the .a's into the shared library.
152 ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
153 -Wl,--no-whole-archive
Johnny Chen7e996472012-01-05 19:17:38 +0000154 # Allow unresolved symbols.
155 LLVMLibsOptions += -Wl,--allow-shlib-undefined
Johnny Chen4b663292011-08-02 20:52:42 +0000156 # Link in python
Filipe Cabecinhas93024d92012-05-29 13:41:50 +0000157 LLVMLibsOptions += $(PYTHON_BUILD_FLAGS) -lrt -L/usr/local/lib -lexecinfo
Johnny Chen4b663292011-08-02 20:52:42 +0000158endif