[Lldb-commits] [lldb] r199543 - Make lldb build with Makefiles on OS X.
Todd Fiala
tfiala at google.com
Sat Jan 18 00:05:35 PST 2014
Author: tfiala
Date: Sat Jan 18 02:05:32 2014
New Revision: 199543
URL: http://llvm.org/viewvc/llvm-project?rev=199543&view=rev
Log:
Make lldb build with Makefiles on OS X.
This change does the following:
* Adds Makefile build scripts to debug server.
* Fixes a few small mistakes in the other makefiles.
* Modifies generate-vers.pl slightly to also work for debugserver.
* Changes the OS X, non-framework python search path from libdir to
libdir/python2.X/site-packages where it is installed by the build
system (also where it is installed on other operating systems).
Patch by Keno Fischer.
Added:
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/Makefile
lldb/trunk/tools/debugserver/Makefile
lldb/trunk/tools/debugserver/scripts/Makefile
lldb/trunk/tools/debugserver/source/MacOSX/Makefile
lldb/trunk/tools/debugserver/source/MacOSX/i386/Makefile
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/Makefile
lldb/trunk/tools/debugserver/source/Makefile
Modified:
lldb/trunk/lib/Makefile
lldb/trunk/scripts/generate-vers.pl
lldb/trunk/source/CMakeLists.txt
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Makefile
lldb/trunk/source/Plugins/Makefile
lldb/trunk/tools/Makefile
lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl
Modified: lldb/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=199543&r1=199542&r2=199543&view=diff
==============================================================================
--- lldb/trunk/lib/Makefile (original)
+++ lldb/trunk/lib/Makefile Sat Jan 18 02:05:32 2014
@@ -96,7 +96,8 @@ ifeq ($(HOST_OS),Darwin)
lldbPluginObjectFileMachO.a \
lldbPluginSymbolVendorMacOSX.a \
lldbPluginProcessDarwin.a \
- lldbPluginProcessMachCore.a
+ lldbPluginProcessMachCore.a \
+ lldbPluginSystemRuntimeMacOSX.a
endif
ifeq ($(HOST_OS),Linux)
Modified: lldb/trunk/scripts/generate-vers.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/generate-vers.pl?rev=199543&r1=199542&r2=199543&view=diff
==============================================================================
--- lldb/trunk/scripts/generate-vers.pl (original)
+++ lldb/trunk/scripts/generate-vers.pl Sat Jan 18 02:05:32 2014
@@ -2,11 +2,11 @@
sub usage()
{
- print "Usage: generate-vers.pl /path/toproject.pbxproj";
+ print "Usage: generate-vers.pl /path/toproject.pbxproj program_name";
exit(0);
}
-(scalar @ARGV == 1) or usage();
+(scalar @ARGV == 2) or usage();
open $pbxproj, $ARGV[0] or die "Couldn't open ".$ARGV[0];
@@ -51,6 +51,6 @@ $lowercase_name = lc $product_name;
close $pbxproj;
-$file_string = " const unsigned char liblldb_coreVersionString[] __attribute__ ((used)) = \"@(#)PROGRAM:".$uppercase_name." PROJECT:".$lowercase_name."-".$lldb_version_string."\" \"\\n\"; const double liblldb_coreVersionNumber __attribute__ ((used)) = (double)".$lldb_version.".".$lldb_train.";\n";
+$file_string = " const unsigned char ".$ARGV[1]."VersionString[] __attribute__ ((used)) = \"@(#)PROGRAM:".$uppercase_name." PROJECT:".$lowercase_name."-".$lldb_version_string."\" \"\\n\"; const double ".$ARGV[1]."VersionNumber __attribute__ ((used)) = (double)".$lldb_version.".".$lldb_train.";\n";
print $file_string;
Modified: lldb/trunk/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=199543&r1=199542&r2=199543&view=diff
==============================================================================
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Sat Jan 18 02:05:32 2014
@@ -110,7 +110,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Darwin"
set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
- ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
+ ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
> ${LLDB_VERS_GENERATED_FILE})
set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=199543&r1=199542&r2=199543&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Sat Jan 18 02:05:32 2014
@@ -1118,19 +1118,23 @@ Host::GetLLDBPath (PathType path_type, F
{
framework_pos += strlen("LLDB.framework");
::strncpy (framework_pos, "/Resources/Python", PATH_MAX - (framework_pos - raw_path));
- }
-#else
- llvm::SmallString<256> python_version_dir;
- llvm::raw_svector_ostream os(python_version_dir);
- os << "/python" << PY_MAJOR_VERSION << '.' << PY_MINOR_VERSION << "/site-packages";
- os.flush();
+ }
+ else
+ {
+#endif
+ llvm::SmallString<256> python_version_dir;
+ llvm::raw_svector_ostream os(python_version_dir);
+ os << "/python" << PY_MAJOR_VERSION << '.' << PY_MINOR_VERSION << "/site-packages";
+ os.flush();
- // We may get our string truncated. Should we protect
- // this with an assert?
+ // We may get our string truncated. Should we protect
+ // this with an assert?
- ::strncat(raw_path, python_version_dir.c_str(),
- sizeof(raw_path) - strlen(raw_path) - 1);
+ ::strncat(raw_path, python_version_dir.c_str(),
+ sizeof(raw_path) - strlen(raw_path) - 1);
+#if defined (__APPLE__)
+ }
#endif
FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path));
g_lldb_python_dir.SetCString(resolved_path);
Modified: lldb/trunk/source/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Makefile?rev=199543&r1=199542&r2=199543&view=diff
==============================================================================
--- lldb/trunk/source/Makefile (original)
+++ lldb/trunk/source/Makefile Sat Jan 18 02:05:32 2014
@@ -25,7 +25,7 @@ include $(LLDB_LEVEL)/Makefile
ifeq ($(HOST_OS),Darwin)
LLDB_vers.c: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj
- "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj" > LLDB_vers.c
+ "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj" liblldb_core > LLDB_vers.c
else
LLDB_REVISION := $(strip \
$(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(LLVM_SRC_ROOT)/tools/lldb))
Modified: lldb/trunk/source/Plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Makefile?rev=199543&r1=199542&r2=199543&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Makefile (original)
+++ lldb/trunk/source/Plugins/Makefile Sat Jan 18 02:05:32 2014
@@ -30,6 +30,7 @@ DIRS += ObjectContainer/Universal-Mach-O
DIRS += SymbolVendor/MacOSX
#DIRS += Process/MacOSX-User
DIRS += Process/mach-core
+DIRS += SystemRuntime/MacOSX
endif
ifeq ($(HOST_OS),Linux)
Added: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/Makefile?rev=199543&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/Makefile (added)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/Makefile Sat Jan 18 02:05:32 2014
@@ -0,0 +1,14 @@
+##===- source/Plugins/SystemRuntime/MacOSX ----*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginSystemRuntimeMacOSX
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
Modified: lldb/trunk/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/Makefile?rev=199543&r1=199542&r2=199543&view=diff
==============================================================================
--- lldb/trunk/tools/Makefile (original)
+++ lldb/trunk/tools/Makefile Sat Jan 18 02:05:32 2014
@@ -24,4 +24,8 @@ ifneq ($(HOST_OS),MingW)
DIRS += driver lldb-platform
endif
+ifeq ($(HOST_OS),Darwin)
+DIRS += debugserver
+endif
+
include $(LLDB_LEVEL)/Makefile
Added: lldb/trunk/tools/debugserver/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/Makefile?rev=199543&view=auto
==============================================================================
--- lldb/trunk/tools/debugserver/Makefile (added)
+++ lldb/trunk/tools/debugserver/Makefile Sat Jan 18 02:05:32 2014
@@ -0,0 +1,13 @@
+##===- tools/debugserver/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+LLDB_LEVEL := ../..
+
+DIRS := scripts source
+
+include $(LLDB_LEVEL)/Makefile
\ No newline at end of file
Added: lldb/trunk/tools/debugserver/scripts/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/scripts/Makefile?rev=199543&view=auto
==============================================================================
--- lldb/trunk/tools/debugserver/scripts/Makefile (added)
+++ lldb/trunk/tools/debugserver/scripts/Makefile Sat Jan 18 02:05:32 2014
@@ -0,0 +1,21 @@
+##===- tools/debugserver/scripts/Makefile ------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../..
+
+include $(LLDB_LEVEL)/Makefile
+
+DBCONFIG_FILE = "$(PROJ_OBJ_DIR)/../DNBConfig.h"
+
+$(DBCONFIG_FILE):
+ SCRIPT_OUTPUT_FILE_0=$(DBCONFIG_FILE) perl $(PROJ_SRC_DIR)/dbgnub-config.pl
+
+all:: $(DBCONFIG_FILE)
+
+.PHONY: all
\ No newline at end of file
Modified: lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl?rev=199543&r1=199542&r2=199543&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl (original)
+++ lldb/trunk/tools/debugserver/scripts/dbgnub-config.pl Sat Jan 18 02:05:32 2014
@@ -33,7 +33,7 @@ my $key;
my $val;
while (($key, $val) = each %ENV)
{
- $val =~ s/\n/\n\/\/ /;
+ $val =~ s/\n/\n\/\/ /g;
printf CONFIG "// %s = %s\n", $key, $val;
}
print CONFIG "//" . "-" x 72 . "\n";
Added: lldb/trunk/tools/debugserver/source/MacOSX/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/Makefile?rev=199543&view=auto
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/Makefile (added)
+++ lldb/trunk/tools/debugserver/source/MacOSX/Makefile Sat Jan 18 02:05:32 2014
@@ -0,0 +1,54 @@
+##===- tools/debugserver/source/MacOSX/Makefile ------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+LLDB_LEVEL := ../../../..
+
+DIRS := i386 x86_64
+
+TOOLNAME = debugserver
+
+CODESIGN_TOOLS := 1
+
+TOOL_CODESIGN_IDENTITY := lldb_codesign
+
+LLVMLibsOptions += -llldbDebugserverCommon -llldbUtility -llldbDebugserverMacOSX_I386 -llldbDebugserverMacOSX_X86_64 \
+ -framework Foundation -framework CoreFoundation
+
+GENERATED_MACH_SOURCES = $(PROJ_OBJ_DIR)/mach_excServer.c $(PROJ_OBJ_DIR)/mach_excUser.c
+
+SOURCES := CFBundle.cpp \
+ CFData.cpp \
+ CFString.cpp \
+ MachException.cpp \
+ MachProcess.cpp \
+ MachTask.cpp \
+ MachThread.cpp \
+ MachThreadList.cpp \
+ MachVMMemory.cpp \
+ MachVMRegion.cpp
+
+BUILT_SOURCES = $(GENERATED_MACH_SOURCES) $(PROJ_OBJ_DIR)/HasAVX.o
+
+CPP.Flags += -I$(PROJ_OBJ_DIR)/../.. -I$(PROJ_SRC_DIR)/..
+
+LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(PROJ_SRC_DIR)/../../resources/lldb-debugserver-Info.plist
+
+include $(LLDB_LEVEL)/Makefile
+
+ObjectsO += $(PROJ_OBJ_DIR)/HasAVX.o
+
+$(PROJ_OBJ_DIR)/HasAVX.o: $(PROJ_SRC_DIR)/HasAVX.s
+ $(Echo) "Compiling HasAVX.s for $(BuildMode) build" $(PIC_FLAG)
+ $(CC) $(TargetCommonOpts) $(CompileCommonOpts) -c $< -o $@
+
+ifeq ($(HOST_OS),Darwin)
+LLVMLibsOptions += -Wl,-rpath, at loader_path/../lib/
+endif
+
+$(GENERATED_MACH_SOURCES):
+ mig -I$(PROJ_OBJ_DIR)/../.. $(PROJ_SRC_DIR)/dbgnub-mig.defs
\ No newline at end of file
Added: lldb/trunk/tools/debugserver/source/MacOSX/i386/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/Makefile?rev=199543&view=auto
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/Makefile (added)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/Makefile Sat Jan 18 02:05:32 2014
@@ -0,0 +1,19 @@
+##===- tools/debugserver/source/MacOSX/i386/Makefile -------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../../..
+
+LIBRARYNAME := lldbDebugserverMacOSX_I386
+BUILD_ARCHIVE = 1
+
+SOURCES := DNBArchImplI386.cpp
+
+include $(LLDB_LEVEL)/Makefile
+
+CPP.Flags += -I$(PROJ_SRC_DIR)/.. -I$(PROJ_SRC_DIR)/../.. -I$(PROJ_OBJ_DIR)/../../..
\ No newline at end of file
Added: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/Makefile?rev=199543&view=auto
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/Makefile (added)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/Makefile Sat Jan 18 02:05:32 2014
@@ -0,0 +1,19 @@
+##===- tools/debugserver/source/MacOSX/i386/Makefile -------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../../..
+
+LIBRARYNAME := lldbDebugserverMacOSX_X86_64
+BUILD_ARCHIVE = 1
+
+SOURCES := DNBArchImplX86_64.cpp
+
+include $(LLDB_LEVEL)/Makefile
+
+CPP.Flags += -I$(PROJ_SRC_DIR)/.. -I$(PROJ_SRC_DIR)/../.. -I$(PROJ_OBJ_DIR)/../../..
\ No newline at end of file
Added: lldb/trunk/tools/debugserver/source/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/Makefile?rev=199543&view=auto
==============================================================================
--- lldb/trunk/tools/debugserver/source/Makefile (added)
+++ lldb/trunk/tools/debugserver/source/Makefile Sat Jan 18 02:05:32 2014
@@ -0,0 +1,46 @@
+##===- tools/debugserver/source/Makefile -------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+LLDB_LEVEL := ../../..
+
+LIBRARYNAME := lldbDebugserverCommon
+BUILD_ARCHIVE = 1
+
+SOURCES := debugserver.cpp \
+ DNBArch.cpp \
+ DNBBreakpoint.cpp \
+ DNB.cpp \
+ DNBDataRef.cpp \
+ DNBError.cpp \
+ DNBLog.cpp \
+ DNBRegisterInfo.cpp \
+ DNBThreadResumeActions.cpp \
+ libdebugserver.cpp \
+ PseudoTerminal.cpp \
+ PThreadEvent.cpp \
+ PThreadMutex.cpp \
+ RNBContext.cpp \
+ RNBRemote.cpp \
+ RNBServices.cpp \
+ RNBSocket.cpp \
+ SysSignal.cpp \
+ TTYState.cpp
+
+include $(LLDB_LEVEL)/Makefile
+
+ifeq ($(HOST_OS),Darwin)
+DIRS := MacOSX/i386 MacOSX/x86_64 MacOSX
+CPP.Flags += -I$(PROJ_SRC_DIR)/MacOSX
+CPP.Flags += -I$(PROJ_OBJ_DIR)/..
+BUILT_SOURCES = debugserver_vers.c
+endif
+
+ifeq ($(HOST_OS),Darwin)
+debugserver_vers.c: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl $(PROJ_SRC_DIR)/../debugserver.xcodeproj/project.pbxproj
+ "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl" "$(PROJ_SRC_DIR)/../debugserver.xcodeproj/project.pbxproj" debugserver > debugserver_vers.c
+endif
More information about the lldb-commits
mailing list