blob: e6f2182191647117262df1594f36242d89762538 [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 \
Greg Claytonfa407ad2011-10-11 16:42:21 +000043 lldbPluginObjectFilePECOFF.a \
Filipe Cabecinhas915da352012-08-28 13:59:38 +000044 lldbPluginOperatingSystemPython.a \
Stephen Wilson3967cef2011-03-26 00:32:59 +000045 lldbPluginPlatformGDBServer.a \
46 lldbPluginProcessGDBRemote.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000047 lldbPluginSymbolFileDWARF.a \
48 lldbPluginSymbolFileSymtab.a \
Peter Collingbourne59d4cb82011-05-19 17:34:58 +000049 lldbPluginUnwindAssemblyInstEmulation.a \
50 lldbPluginUnwindAssemblyx86.a \
Stephen Wilson64dd0d72011-01-06 22:11:47 +000051 lldbPluginUtility.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000052 lldbSymbol.a \
53 lldbTarget.a \
54 lldbUtility.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000055 clangAnalysis.a \
56 clangAST.a \
57 clangBasic.a \
58 clangCodeGen.a \
59 clangFrontend.a \
60 clangDriver.a \
Benjamin Kramer9930b332012-03-14 11:03:46 +000061 clangEdit.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000062 clangLex.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000063 clangParse.a \
64 clangSema.a \
Stephen Wilson64dd0d72011-01-06 22:11:47 +000065 clangSerialization.a \
Greg Claytoned605712012-02-28 18:25:00 +000066 LLVMMCDisassembler.a \
67 lldbPluginPlatformMacOSX.a \
68 lldbPluginPlatformLinux.a \
69 lldbPluginPlatformFreeBSD.a
Greg Clayton54e7afa2010-07-09 20:39:50 +000070
Daniel Malea8bc4f6e2012-12-10 21:05:57 +000071# Because GCC requires RTTI enabled for lldbCore (see source/Core/Makefile) it is
72# necessary to also link the clang rewriter libraries so vtable references can
73# be resolved correctly, if we are building with GCC.
Greg Claytondbe390e2013-05-17 20:56:55 +000074ifeq (g++,$(shell basename $(CXX) | colrm 4))
Daniel Malea8bc4f6e2012-12-10 21:05:57 +000075 USEDLIBS += clangRewriteCore.a \
76 clangRewriteFrontend.a
77endif
78
Eli Friedman26f93ce2010-07-09 22:11:43 +000079include $(LLDB_LEVEL)/../../Makefile.config
80
81LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
Daniel Malea00566372013-03-28 17:08:09 +000082 instrumentation ipo irreader selectiondag jit mc mcjit linker
Eli Friedman26f93ce2010-07-09 22:11:43 +000083
84ifeq ($(HOST_OS),Darwin)
85 USEDLIBS += lldbHostMacOSX.a \
86 lldbPluginDynamicLoaderMacOSX.a \
Daniel Dunbar8e584ec2011-10-31 22:51:08 +000087 lldbPluginDynamicLoaderDarwinKernel.a \
Eli Friedman26f93ce2010-07-09 22:11:43 +000088 lldbPluginObjectContainerUniversalMachO.a \
89 lldbPluginObjectFileMachO.a \
Stephen Wilsonef6635b2011-03-10 03:08:28 +000090 lldbPluginSymbolVendorMacOSX.a \
Johnny Chen7637a3a2012-02-24 18:02:59 +000091 lldbPluginProcessDarwin.a \
92 lldbPluginProcessMachCore.a
Eli Friedman26f93ce2010-07-09 22:11:43 +000093endif
94
95ifeq ($(HOST_OS),Linux)
Jason Molenda4a55d752012-10-04 02:16:06 +000096 USEDLIBS += lldbHostLinux.a \
Johnny Chen7e996472012-01-05 19:17:38 +000097 lldbPluginProcessLinux.a \
Jason Molenda4a55d752012-10-04 02:16:06 +000098 lldbPluginProcessPOSIX.a \
Sylvestre Ledruaefeaa42013-05-13 10:18:51 +000099 lldbPluginDynamicLoaderMacOSX.a
Eli Friedman26f93ce2010-07-09 22:11:43 +0000100endif
101
Johnny Chen4b663292011-08-02 20:52:42 +0000102ifeq ($(HOST_OS),FreeBSD)
103 USEDLIBS += lldbHostFreeBSD.a \
Johnny Chen7e996472012-01-05 19:17:38 +0000104 lldbPluginProcessPOSIX.a \
Greg Claytoned605712012-02-28 18:25:00 +0000105 lldbPluginProcessFreeBSD.a
Johnny Chen4b663292011-08-02 20:52:42 +0000106endif
107
Greg Clayton54e7afa2010-07-09 20:39:50 +0000108include $(LEVEL)/Makefile.common
109
Greg Clayton54e7afa2010-07-09 20:39:50 +0000110ifeq ($(HOST_OS),Darwin)
Eli Friedman26f93ce2010-07-09 22:11:43 +0000111 LLVMLibsOptions += -Wl,-all_load
Greg Clayton54e7afa2010-07-09 20:39:50 +0000112 # set dylib internal version number to llvmCore submission number
113 ifdef LLDB_SUBMIT_VERSION
114 LLVMLibsOptions += -Wl,-current_version \
115 -Wl,$(LLDB_SUBMIT_VERSION).$(LLDB_SUBMIT_SUBVERSION) \
116 -Wl,-compatibility_version -Wl,1
117 endif
118 # extra options to override libtool defaults
Greg Clayton54e7afa2010-07-09 20:39:50 +0000119 LLVMLibsOptions += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks
Charles Davis1e58a392011-05-19 23:53:23 +0000120 LLVMLibsOptions += -framework Foundation -framework CoreFoundation
Bill Wendling5a45f242012-04-05 06:20:13 +0000121 LLVMLibsOptions += -framework CoreServices -framework Carbon -framework Security
Greg Clayton1a2f3112011-02-05 02:32:19 +0000122 LLVMLibsOptions += -framework DebugSymbols $(PYTHON_BUILD_FLAGS) -lobjc
Filipe Cabecinhasb9f6fd82012-10-31 23:02:00 +0000123 LLVMLibsOptions += -lxml2
Filipe Cabecinhas93024d92012-05-29 13:41:50 +0000124 ifneq ($(EXPORTED_SYMBOL_FILE),)
125 LLVMLibsOptions += -Wl,-exported_symbols_list -Wl,"$(EXPORTED_SYMBOL_FILE)"
126 endif
Greg Clayton54e7afa2010-07-09 20:39:50 +0000127 # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
128 DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
129 ifneq ($(DARWIN_VERS),8)
Daniel Dunbar2888f552011-10-31 22:50:30 +0000130 LLVMLibsOptions += -Wl,-install_name \
Greg Clayton54e7afa2010-07-09 20:39:50 +0000131 -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
132 endif
133endif
134
Sylvestre Ledru5f6f3e22013-01-17 16:59:32 +0000135ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU))
Greg Clayton54e7afa2010-07-09 20:39:50 +0000136 # Include everything from the .a's into the shared library.
Eli Friedman26f93ce2010-07-09 22:11:43 +0000137 ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
Greg Clayton54e7afa2010-07-09 20:39:50 +0000138 -Wl,--no-whole-archive
139 # Don't allow unresolved symbols.
140 LLVMLibsOptions += -Wl,--no-undefined
Eli Friedman26f93ce2010-07-09 22:11:43 +0000141 # Link in python
Filipe Cabecinhas93024d92012-05-29 13:41:50 +0000142 LLVMLibsOptions += $(PYTHON_BUILD_FLAGS) -lrt
Sylvestre Ledru5f6f3e22013-01-17 16:59:32 +0000143 LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
Greg Clayton54e7afa2010-07-09 20:39:50 +0000144endif
Johnny Chen4b663292011-08-02 20:52:42 +0000145
146ifeq ($(HOST_OS),FreeBSD)
147 # Include everything from the .a's into the shared library.
148 ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
149 -Wl,--no-whole-archive
Johnny Chen7e996472012-01-05 19:17:38 +0000150 # Allow unresolved symbols.
151 LLVMLibsOptions += -Wl,--allow-shlib-undefined
Johnny Chen4b663292011-08-02 20:52:42 +0000152 # Link in python
Filipe Cabecinhas93024d92012-05-29 13:41:50 +0000153 LLVMLibsOptions += $(PYTHON_BUILD_FLAGS) -lrt -L/usr/local/lib -lexecinfo
Johnny Chen4b663292011-08-02 20:52:42 +0000154endif