blob: fd2b8a0119ee379dfd1e14b06e052d578dcf562d [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
15#EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/../resources/lldb-framework-exports
16NO_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
Greg Clayton54e7afa2010-07-09 20:39:50 +000022# Include all archives in liblldb.a files
23USEDLIBS = lldbAPI.a \
24 lldbBreakpoint.a \
25 lldbCommands.a \
26 lldbCore.a \
27 lldbExpression.a \
Greg Clayton8f3b21d2010-09-07 20:11:56 +000028 lldbHostCommon.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000029 lldbInitAndLog.a \
30 lldbInterpreter.a \
Peter Collingbourneb7f59452011-05-19 18:32:34 +000031 lldbPluginABIMacOSX_arm.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000032 lldbPluginABIMacOSX_i386.a \
33 lldbPluginABISysV_x86_64.a \
34 lldbPluginDisassemblerLLVM.a \
Stephen Wilson8be525a2011-03-08 03:57:00 +000035 lldbPluginDynamicLoaderStatic.a \
Stephen Wilsonec113d42011-04-08 02:01:35 +000036 lldbPluginEmulateInstructionARM.a \
Charles Davis1e58a392011-05-19 23:53:23 +000037 lldbPluginLanguageRuntimeCPlusPlusItaniumABI.a \
38 lldbPluginLanguageRuntimeObjCAppleObjCRuntime.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000039 lldbPluginObjectContainerBSDArchive.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000040 lldbPluginObjectFileELF.a \
Greg Claytonfa407ad2011-10-11 16:42:21 +000041 lldbPluginObjectFilePECOFF.a \
Stephen Wilson3967cef2011-03-26 00:32:59 +000042 lldbPluginPlatformGDBServer.a \
43 lldbPluginProcessGDBRemote.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000044 lldbPluginSymbolFileDWARF.a \
45 lldbPluginSymbolFileSymtab.a \
Peter Collingbourne59d4cb82011-05-19 17:34:58 +000046 lldbPluginUnwindAssemblyInstEmulation.a \
47 lldbPluginUnwindAssemblyx86.a \
Stephen Wilson64dd0d72011-01-06 22:11:47 +000048 lldbPluginUtility.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000049 lldbSymbol.a \
50 lldbTarget.a \
51 lldbUtility.a \
Greg Clayton54e7afa2010-07-09 20:39:50 +000052 clangAnalysis.a \
53 clangAST.a \
54 clangBasic.a \
55 clangCodeGen.a \
56 clangFrontend.a \
57 clangDriver.a \
58 clangIndex.a \
59 clangLex.a \
60 clangRewrite.a \
61 clangParse.a \
62 clangSema.a \
Stephen Wilson64dd0d72011-01-06 22:11:47 +000063 clangSerialization.a \
Johnny Chen1bcd1382011-08-23 22:36:23 +000064 LLVMMCDisassembler.a
Greg Clayton54e7afa2010-07-09 20:39:50 +000065
Eli Friedman26f93ce2010-07-09 22:11:43 +000066include $(LLDB_LEVEL)/../../Makefile.config
67
68LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
Daniel Dunbarfd0c1f42011-11-01 17:32:01 +000069 instrumentation ipo selectiondag jit mc mcjit linker
Eli Friedman26f93ce2010-07-09 22:11:43 +000070
71ifeq ($(HOST_OS),Darwin)
72 USEDLIBS += lldbHostMacOSX.a \
73 lldbPluginDynamicLoaderMacOSX.a \
Daniel Dunbar8e584ec2011-10-31 22:51:08 +000074 lldbPluginDynamicLoaderDarwinKernel.a \
Eli Friedman26f93ce2010-07-09 22:11:43 +000075 lldbPluginObjectContainerUniversalMachO.a \
76 lldbPluginObjectFileMachO.a \
Daniel Dunbar8f4cdb42011-10-31 22:51:11 +000077 lldbPluginOperatingSystemDarwinKernel.a \
Stephen Wilsonef6635b2011-03-10 03:08:28 +000078 lldbPluginSymbolVendorMacOSX.a \
Johnny Chen4b663292011-08-02 20:52:42 +000079 lldbPluginPlatformMacOSX.a \
Daniel Dunbar8f4cdb42011-10-31 22:51:11 +000080 lldbPluginProcessDarwin.a
Eli Friedman26f93ce2010-07-09 22:11:43 +000081endif
82
83ifeq ($(HOST_OS),Linux)
Johnny Chen7e996472012-01-05 19:17:38 +000084 USEDLIBS += lldbPluginProcessPOSIX.a \
85 lldbPluginProcessLinux.a \
86 lldbPluginDynamicLoaderPOSIX.a \
Stephen Wilson76fd5dd2011-03-23 01:58:26 +000087 lldbPluginPlatformLinux.a \
88 lldbHostLinux.a
Eli Friedman26f93ce2010-07-09 22:11:43 +000089endif
90
Johnny Chen4b663292011-08-02 20:52:42 +000091ifeq ($(HOST_OS),FreeBSD)
92 USEDLIBS += lldbHostFreeBSD.a \
Johnny Chen7e996472012-01-05 19:17:38 +000093 lldbPluginDynamicLoaderPOSIX.a \
94 lldbPluginProcessPOSIX.a \
95 lldbPluginProcessFreeBSD.a \
96 lldbPluginPlatformFreeBSD.a
Johnny Chen4b663292011-08-02 20:52:42 +000097endif
98
Greg Clayton54e7afa2010-07-09 20:39:50 +000099include $(LEVEL)/Makefile.common
100
Greg Clayton54e7afa2010-07-09 20:39:50 +0000101ifeq ($(HOST_OS),Darwin)
Eli Friedman26f93ce2010-07-09 22:11:43 +0000102 LLVMLibsOptions += -Wl,-all_load
Greg Clayton54e7afa2010-07-09 20:39:50 +0000103 # set dylib internal version number to llvmCore submission number
104 ifdef LLDB_SUBMIT_VERSION
105 LLVMLibsOptions += -Wl,-current_version \
106 -Wl,$(LLDB_SUBMIT_VERSION).$(LLDB_SUBMIT_SUBVERSION) \
107 -Wl,-compatibility_version -Wl,1
108 endif
109 # extra options to override libtool defaults
Greg Clayton54e7afa2010-07-09 20:39:50 +0000110 LLVMLibsOptions += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks
Charles Davis1e58a392011-05-19 23:53:23 +0000111 LLVMLibsOptions += -framework Foundation -framework CoreFoundation
112 LLVMLibsOptions += -framework CoreServices -framework Carbon
Greg Clayton1a2f3112011-02-05 02:32:19 +0000113 LLVMLibsOptions += -framework DebugSymbols $(PYTHON_BUILD_FLAGS) -lobjc
Greg Clayton980d0672010-07-12 23:14:00 +0000114 LLVMLibsOptions += -Wl,-exported_symbols_list -Wl,"$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/resources/lldb-framework-exports"
Greg Clayton54e7afa2010-07-09 20:39:50 +0000115 # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
116 DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
117 ifneq ($(DARWIN_VERS),8)
Daniel Dunbar2888f552011-10-31 22:50:30 +0000118 LLVMLibsOptions += -Wl,-install_name \
Greg Clayton54e7afa2010-07-09 20:39:50 +0000119 -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
120 endif
121endif
122
Johnny Chen4b663292011-08-02 20:52:42 +0000123ifeq ($(HOST_OS),Linux)
Greg Clayton54e7afa2010-07-09 20:39:50 +0000124 # Include everything from the .a's into the shared library.
Eli Friedman26f93ce2010-07-09 22:11:43 +0000125 ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
Greg Clayton54e7afa2010-07-09 20:39:50 +0000126 -Wl,--no-whole-archive
127 # Don't allow unresolved symbols.
128 LLVMLibsOptions += -Wl,--no-undefined
Eli Friedman26f93ce2010-07-09 22:11:43 +0000129 # Link in python
Stephen Wilsonec113d42011-04-08 02:01:35 +0000130 LD.Flags += $(PYTHON_BUILD_FLAGS) -lrt
Greg Clayton54e7afa2010-07-09 20:39:50 +0000131endif
Johnny Chen4b663292011-08-02 20:52:42 +0000132
133ifeq ($(HOST_OS),FreeBSD)
134 # Include everything from the .a's into the shared library.
135 ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
136 -Wl,--no-whole-archive
Johnny Chen7e996472012-01-05 19:17:38 +0000137 # Allow unresolved symbols.
138 LLVMLibsOptions += -Wl,--allow-shlib-undefined
Johnny Chen4b663292011-08-02 20:52:42 +0000139 # Link in python
140 LD.Flags += $(PYTHON_BUILD_FLAGS) -lrt -L/usr/local/lib -lexecinfo
141endif