From c281a3bf431083706eeef2c60fb7af2e1812eef1 Mon Sep 17 00:00:00 2001 From: Filipe Cabecinhas Date: Thu, 1 Nov 2012 18:55:16 +0000 Subject: [PATCH] Makefile patches from Charles Davis and Daniel Malea (+ one or two tweaks). llvm-svn: 167242 --- lldb/scripts/Python/build-swig-Python.sh | 61 ++++-- .../scripts/Python/finish-swig-Python-LLDB.sh | 44 ++++- lldb/scripts/Python/modify-python-lldb.py | 2 +- lldb/scripts/build-swig-wrapper-classes.sh | 31 ++- lldb/scripts/finish-swig-wrapper-classes.sh | 25 ++- lldb/source/Interpreter/Makefile | 176 +----------------- lldb/test/Makefile | 4 +- 7 files changed, 142 insertions(+), 201 deletions(-) diff --git a/lldb/scripts/Python/build-swig-Python.sh b/lldb/scripts/Python/build-swig-Python.sh index 59394f9cc0ea..efbc7485a6cb 100755 --- a/lldb/scripts/Python/build-swig-Python.sh +++ b/lldb/scripts/Python/build-swig-Python.sh @@ -4,22 +4,39 @@ # SRC_ROOT is the root of the lldb source tree. # TARGET_DIR is where the lldb framework/shared library gets put. -# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script +# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script # put the lldb.py file it was generated from running SWIG. # PREFIX is the root directory used to determine where third-party modules # for scripting languages should be installed. -# debug_flag (optional) determines whether or not this script outputs +# debug_flag (optional) determines whether or not this script outputs # additional information when running. SRC_ROOT=$1 TARGET_DIR=$2 CONFIG_BUILD_DIR=$3 PYTHON_INSTALL_DIR=$4 -debug_flag=$5 +debug_flag=$5 SWIG=$6 +makefile_flag=$7 +dependency_flag=$8 -os_name=`uname -s` -if [ "$os_name" = "Darwin" ] +if [ -n "$makefile_flag" -a "$makefile_flag" = "-m" ] +then + MakefileCalled=1 + if [ -n "$dependency_flag" -a "$dependency_flag" = "-M" ] + then + GenerateDependencies=1 + swig_depend_file="${TARGET_DIR}/LLDBWrapPython.cpp.d" + SWIG_DEPEND_OPTIONS="-MMD -MF \"${swig_depend_file}.tmp\"" + else + GenerateDependencies=0 + fi +else + MakefileCalled=0 + GenerateDependencies=0 +fi + +if [ $MakefileCalled -eq 0 ] then swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp else @@ -263,20 +280,26 @@ fi python_version=`/usr/bin/env python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'` -if [ "$os_name" = "Darwin" ] +if [ $MakefileCalled -eq 0 ] then - framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python" + framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb" else - framework_python_dir="${PYTHON_INSTALL_DIR}/python${python_version}" + if [ -n "${PYTHON_INSTALL_DIR}" ] + then + framework_python_dir=`/usr/bin/env python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False, \"${PYTHON_INSTALL_DIR}\");"`/lldb + else + framework_python_dir=`/usr/bin/env python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False);"`/lldb + fi fi +[ -n "${CONFIG_BUILD_DIR}" ] || CONFIG_BUILD_DIR=${framework_python_dir} if [ ! -L "${framework_python_dir}/_lldb.so" ] then NeedToUpdate=1 fi -if [ ! -f "${framework_python_dir}/lldb.py" ] +if [ ! -f "${framework_python_dir}/__init__.py" ] then NeedToUpdate=1 fi @@ -297,7 +320,18 @@ fi # Build the SWIG C++ wrapper file for Python. -$SWIG -c++ -shadow -python -threads -I"/usr/include" -I"${SRC_ROOT}/include" -I./. -outdir "${CONFIG_BUILD_DIR}" -o "${swig_output_file}" "${swig_input_file}" +if [ $GenerateDependencies -eq 1 ] +then + if $SWIG -c++ -shadow -python -threads -I"${SRC_ROOT}/include" -I./. -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -MMD -MF "${swig_depend_file}.tmp" -outdir "${CONFIG_BUILD_DIR}" -o "${swig_output_file}" "${swig_input_file}" + then + mv -f "${swig_depend_file}.tmp" "${swig_depend_file}" + else + rm -f "${swig_depend_file}.tmp" + exit 1 + fi +else + $SWIG -c++ -shadow -python -threads -I"${SRC_ROOT}/include" -I./. -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -outdir "${CONFIG_BUILD_DIR}" -o "${swig_output_file}" "${swig_input_file}" || exit $? +fi # Implement the iterator protocol and/or eq/ne operators for some lldb objects. # Append global variable to lldb Python module. @@ -312,7 +346,12 @@ fi if [ -f "${current_dir}/edit-swig-python-wrapper-file.py" ] then - python ${current_dir}/edit-swig-python-wrapper-file.py + if [ $MakefileCalled -eq 1 ] + then + python ${current_dir}/edit-swig-python-wrapper-file.py "${TARGET_DIR}" + else + python ${current_dir}/edit-swig-python-wrapper-file.py + fi if [ -f "${swig_output_file}.edited" ] then mv "${swig_output_file}.edited" ${swig_output_file} diff --git a/lldb/scripts/Python/finish-swig-Python-LLDB.sh b/lldb/scripts/Python/finish-swig-Python-LLDB.sh index 12ffb412567d..8c1fb4e51076 100755 --- a/lldb/scripts/Python/finish-swig-Python-LLDB.sh +++ b/lldb/scripts/Python/finish-swig-Python-LLDB.sh @@ -5,10 +5,10 @@ # For the Python script interpreter (external to liblldb) to be able to import # and use the lldb module, there must be two files, lldb.py and _lldb.so, that # it can find. lldb.py is generated by SWIG at the same time it generates the -# C++ file. _lldb.so is actually a symlink file that points to the +# C++ file. _lldb.so is actually a symlink file that points to the # LLDB shared library/framework. # -# The Python script interpreter needs to be able to automatically find +# The Python script interpreter needs to be able to automatically find # these two files. On Darwin systems it searches in the LLDB.framework, as # well as in all the normal Python search paths. On non-Darwin systems # these files will need to be put someplace where Python will find them. @@ -20,11 +20,11 @@ # SRC_ROOT is the root of the lldb source tree. # TARGET_DIR is where the lldb framework/shared library gets put. -# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script +# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script # put the lldb.py file it was generated from running SWIG. # PYTHON_INSTALL_DIR is where non-Darwin systems want to put the .py and .so # files so that Python can find them automatically. -# debug_flag (optional) determines whether or not this script outputs +# debug_flag (optional) determines whether or not this script outputs # additional information when running. SRC_ROOT=$1 @@ -32,6 +32,7 @@ TARGET_DIR=$2 CONFIG_BUILD_DIR=$3 PYTHON_INSTALL_DIR=$4 debug_flag=$5 +makefile_flag=$6 # If we don't want Python, then just do nothing here. # Note, at present iOS doesn't have Python, so if you're building for iOS be sure to @@ -46,6 +47,13 @@ else Debug=0 fi +if [ -n "$makefile_flag" -a "$makefile_flag" = "-m" ] +then + MakefileCalled=1 +else + MakefileCalled=0 +fi + OS_NAME=`uname -s` PYTHON_VERSION=`/usr/bin/env python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'` @@ -56,12 +64,19 @@ then echo "The Python version is $PYTHON_VERSION" fi +if [ ${OS_NAME} = "Darwin" ] +then + SOEXT=".dylib" +else + SOEXT=".so" +fi + # # Determine where to put the files. -if [ ${OS_NAME} = "Darwin" ] +if [ $MakefileCalled -eq 0 ] then - # We are on a Darwin system, so all the lldb Python files can go + # We are being built by Xcode, so all the lldb Python files can go # into the LLDB.framework/Resources/Python subdirectory. if [ ! -d "${TARGET_DIR}/LLDB.framework" ] @@ -79,13 +94,20 @@ then framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb" else - # We are on a non-Darwin system, so use the PYTHON_INSTALL_DIR argument, + # We are being built by LLVM, so use the PYTHON_INSTALL_DIR argument, # and append the python version directory to the end of it. Depending on # the system other stuff may need to be put here as well. - framework_python_dir="${PYTHON_INSTALL_DIR}/python${PYTHON_VERSION}/lldb" + if [ -n "${PYTHON_INSTALL_DIR}" ] + then + framework_python_dir=`/usr/bin/env python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False, \"${PYTHON_INSTALL_DIR}\");"`/lldb + else + framework_python_dir=`/usr/bin/env python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False);"`/lldb + fi fi +[ -n "${CONFIG_BUILD_DIR}" ] || CONFIG_BUILD_DIR=${framework_python_dir} + # # Look for the directory in which to put the Python files; if it does not # already exist, attempt to make it. @@ -130,10 +152,12 @@ then then echo "Creating symlink for _lldb.so" fi - if [ ${OS_NAME} = "Darwin" ] + cd "${framework_python_dir}" + if [ $MakefileCalled -eq 0 ] then - cd "${framework_python_dir}" ln -s "../../../LLDB" _lldb.so + else + ln -s "../../../liblldb${SOEXT}" _lldb.so fi else if [ $Debug -eq 1 ] diff --git a/lldb/scripts/Python/modify-python-lldb.py b/lldb/scripts/Python/modify-python-lldb.py index 75f97e78ba9e..4345ea26bba9 100644 --- a/lldb/scripts/Python/modify-python-lldb.py +++ b/lldb/scripts/Python/modify-python-lldb.py @@ -386,7 +386,7 @@ for line in content.splitlines(): new_content.add_line(section_iter % d[cls+'-section']) new_content.add_line(compile_unit_iter % d[cls+'-compile-unit']) new_content.add_line(d[cls+'-symbol-in-section']) - + # This special purpose iterator is for SBValue only!!! if cls == "SBValue": new_content.add_line(linked_list_iter_def) diff --git a/lldb/scripts/build-swig-wrapper-classes.sh b/lldb/scripts/build-swig-wrapper-classes.sh index 3f0bc2a29d55..ed3f8f7fb23a 100755 --- a/lldb/scripts/build-swig-wrapper-classes.sh +++ b/lldb/scripts/build-swig-wrapper-classes.sh @@ -26,19 +26,44 @@ SRC_ROOT=$1 TARGET_DIR=$2 CONFIG_BUILD_DIR=$3 PREFIX=$4 -debug_flag=$5 + +shift 4 # # Check to see if we are in debug-mode or not. # -if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ] +if [ -n "$1" -a "$1" = "-debug" ] then + debug_flag="$1" Debug=1 + shift else + debug_flag="" Debug=0 fi +# +# Check to see if we were called from the Makefile system. If we were, check +# if the caller wants swig to generate a dependency file. +# + +if [ -n "$1" -a "$1" = "-m" ] +then + makefile_flag="$1" + shift + if [ -n "$1" -a "$1" = "-M" ] + then + dependency_flag="$1" + shift + else + dependency_flag="" + fi +else + makefile_flag="" + dependency_flag="" +fi + # # Verify that 'lldb.swig' exists. # @@ -119,7 +144,7 @@ do echo "Executing $curlang build script..." fi - ./build-swig-${curlang}.sh "$SRC_ROOT" "$TARGET_DIR" "$CONFIG_BUILD_DIR" "${PREFIX}" "${debug_flag}" "${SWIG}" + ./build-swig-${curlang}.sh "$SRC_ROOT" "$TARGET_DIR" "$CONFIG_BUILD_DIR" "${PREFIX}" "${debug_flag}" "${SWIG}" "${makefile_flag}" "${dependency_flag}" || exit $? fi fi done diff --git a/lldb/scripts/finish-swig-wrapper-classes.sh b/lldb/scripts/finish-swig-wrapper-classes.sh index 4c9ef999adc8..f0bca4bf18e2 100755 --- a/lldb/scripts/finish-swig-wrapper-classes.sh +++ b/lldb/scripts/finish-swig-wrapper-classes.sh @@ -3,9 +3,9 @@ # finish-swig-wrapper-classes.sh # # For each scripting language liblldb supports, we need to create the -# appropriate Script Bridge wrapper classes for that language so that +# appropriate Script Bridge wrapper classes for that language so that # users can call Script Bridge functions from within the script interpreter. -# +# # We use SWIG to create a C++ file containing the appropriate wrapper classes # and funcitons for each scripting language, before liblldb is built (thus # the C++ file can be compiled into liblldb. In some cases, additional work @@ -26,18 +26,29 @@ SRC_ROOT=$1 TARGET_DIR=$2 CONFIG_BUILD_DIR=$3 PREFIX=$4 -debug_flag=$5 -if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ] +shift 4 + +if [ -n "$1" -a "$1" = "-debug" ] then + debug_flag=$1 Debug=1 + shift else + debug_flag="" Debug=0 fi +if [ -n "$1" -a "$1" = "-m" ] +then + makefile_flag="$1" + shift +else + makefile_flag="" +fi # -# For each scripting language, see if a post-processing script for that +# For each scripting language, see if a post-processing script for that # language exists, and if so, call it. # # For now the only language we support is Python, but we expect this to @@ -76,8 +87,8 @@ do echo "Executing $curlang post-processing script..." fi - - ./finish-swig-${curlang}-LLDB.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}" + + ./finish-swig-${curlang}-LLDB.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}" "${makefile_flag}" fi fi done diff --git a/lldb/source/Interpreter/Makefile b/lldb/source/Interpreter/Makefile index 18181fcb2768..b9ffd0e5c458 100644 --- a/lldb/source/Interpreter/Makefile +++ b/lldb/source/Interpreter/Makefile @@ -18,177 +18,19 @@ include $(LLDB_LEVEL)/Makefile # edit-swig-python-wrapper-file.py needs $(SRCROOT) export SRCROOT := $(PROJ_SRC_DIR)/$(LLDB_LEVEL) -TARGET_DIR := $(PROJ_OBJ_DIR) -PYTHON_DIR := $(LibDir)/python/lldb -ifeq ($(HOST_OS),Darwin) -PYTHON_DEST_DIR := $(DESTDIR)/$(call realpath,/Library/Python/$(shell python -c 'import sys; print sys.version[:3]')/site-packages)/lldb -else -PYTHON_DEST_DIR := $(DESTDIR)/$(call realpath,$(shell python -c 'import sys; print sys.exec_prefix')/lib/python$(shell python -c 'import sys; print sys.version[:3]')/site-packages)/lldb -endif -LLDB_SWIG_INCLUDE_DIRS:= -I"$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/include" -I./. -LIBLLDB := $(LibDir)/liblldb$(SHLIBEXT) -INST_LIBLLDB := $(PROJ_libdir)/liblldb$(SHLIBEXT) +PYTHON_DIR := $(PROJ_OBJ_ROOT)/$(BuildMode) -# Subpackages of the main LLDB package -LLDB_SUBPACKAGES := FORMATTERS FORMATTERS_CPP FORMATTERS_OBJC RUNTIME RUNTIME_OBJC UTILS -# lldb.formatters -LLDB_PACKAGE_FORMATTERS := formatters -LLDB_PACKAGE_FORMATTERS_FILES := $(addprefix \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/summaries/cocoa/, \ - cache.py metrics.py attrib_fromdict.py Logger.py) -# lldb.formatters.cpp -LLDB_PACKAGE_FORMATTERS_CPP := formatters/cpp -LLDB_PACKAGE_FORMATTERS_CPP_FILES := $(addprefix \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/synthetic/,gnu_libstdcpp.py libcxx.py) -# lldb.formatters.objc -LLDB_PACKAGE_FORMATTERS_OBJC := formatters/objc -LLDB_PACKAGE_FORMATTERS_OBJC_FILES := \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/summaries/cocoa/Selector.py \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/summaries/objc.py \ - $(addprefix $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/summaries/cocoa/, \ - Class.py CFArray.py CFBag.py CFBinaryHeap.py CFBitVector.py \ - CFDictionary.py CFString.py NSBundle.py NSData.py NSDate.py \ - NSException.py NSIndexSet.py NSMachPort.py NSNotification.py \ - NSNumber.py NSSet.py NSURL.py \ - ) -# lldb.runtime -LLDB_PACKAGE_RUNTIME := runtime -LLDB_PACKAGE_RUNTIME_FILES := -# lldb.runtime.objc -LLDB_PACKAGE_RUNTIME_OBJC := runtime/objc -LLDB_PACKAGE_RUNTIME_OBJC_FILES := \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/summaries/cocoa/objc_runtime.py -# lldb.utils -LLDB_PACKAGE_UTILS := utils -LLDB_PACKAGE_UTILS_FILES := \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/python/symbolication.py - -ifeq ($(HOST_OS),Darwin) -# Additional packages for Darwin/Mac OS X -LLDB_SUBPACKAGES += MACOSX -# lldb.macosx -LLDB_PACKAGE_MACOSX := macosx -LLDB_PACKAGE_MACOSX_FILES := $(addprefix \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/, python/crashlog.py darwin/heap_find/heap.py \ -) -endif - -LLDB_ALL_SUBPACKAGE_FILES := $(foreach subpackage,$(LLDB_SUBPACKAGES),$(LLDB_PACKAGE_$(subpackage)_FILES)) -LLDB_ALL_INSTALLED_SUBPACKAGE_FILES := $(foreach subpackage,$(LLDB_SUBPACKAGES),$(addprefix $(LLDB_PACKAGE_$(subpackage))/,$(notdir $(LLDB_PACKAGE_$(subpackage)_FILES)))) - -comma := , -LLDB_COPY_PACKAGE = $(Verb) \ -$(foreach subpackage,$(LLDB_SUBPACKAGES), \ - init_file="$(PYTHON_DIR)/$(LLDB_PACKAGE_$(subpackage))/__init__.py"; \ - $(MKDIR) "$(PYTHON_DIR)/$(LLDB_PACKAGE_$(subpackage))"; \ - $(foreach file,$(LLDB_PACKAGE_$(subpackage)_FILES), \ - $(CP) "$(file)" "$(PYTHON_DIR)/$(LLDB_PACKAGE_$(subpackage))"; \ - ) \ - echo "__all__ = [$(patsubst %,\"%\"$(comma),\ - $(basename $(notdir $(LLDB_PACKAGE_$(subpackage)_FILES))))]" >$$init_file; \ - echo "for x in __all__:" >>$$init_file; \ - echo " __import__('lldb.$(subst /,.,$(LLDB_PACKAGE_$(subpackage))).'+x)" >>$$init_file; \ -) - -LLDB_INSTALL_SUBPACKAGES = $(Verb) \ -$(foreach subpackage,$(LLDB_SUBPACKAGES), \ - $(MKDIR) $(PYTHON_DEST_DIR)/$(LLDB_PACKAGE_$(subpackage)); \ - $(DataInstall) $(PYTHON_DIR)/$(LLDB_PACKAGE_$(subpackage))/__init__.py \ - $(PYTHON_DEST_DIR)/$(LLDB_PACKAGE_$(subpackage))/__init__.py; \ -) \ -$(foreach file,$(LLDB_ALL_INSTALLED_SUBPACKAGE_FILES), \ - $(DataInstall) $(PYTHON_DIR)/$(file) $(PYTHON_DEST_DIR)/$(file); \ -) - -ifeq ($(HOST_OS),Darwin) -# Install the heap_find sources, too. -LLDB_INSTALL_SUBPACKAGES += $(MKDIR) $(PYTHON_DEST_DIR)/macosx/heap/; \ -$(DataInstall) $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/darwin/heap_find/heap/heap_find.cpp \ - $(PYTHON_DEST_DIR)/macosx/heap/heap_find.cpp; \ -$(DataInstall) $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/examples/darwin/heap_find/heap/Makefile \ - $(PYTHON_DEST_DIR)/macosx/heap/Makefile; -endif - -# We need Swig to process stdint.h, but by default it will not inspect system -# include directories. The following should cover the standard locations on -# most platforms. -LLDB_SWIG_INCLUDE_DIRS += -I"/usr/local/include" -LLDB_SWIG_INCLUDE_DIRS += -I"/usr/include" - -# On Darwin, stdint.h might only be in the compiler subdirectory. Unfortunately, -# swig doesn't currently seem able to understand Clang's stdint.h, so we have to -# point at the GCC one. -ifeq ($(HOST_OS),Darwin) -LLDB_SWIG_INCLUDE_DIRS += -I"/usr/include/gcc/darwin/4.2" -endif - -ifndef DISABLE_AUTO_DEPENDENCIES - -SWIG_DEPEND_OPTIONS = -MMD -MF "$(PROJ_OBJ_DIR)/$*.cpp.d.tmp" -CPP_DEPEND_MOVEFILE = then $(MV) -f "$(PROJ_OBJ_DIR)/$*.cpp.d.tmp" "$(PROJ_OBJ_DIR)/$*.cpp.d"; \ - else $(RM) -f "$(PROJ_OBJ_DIR)/$*.cpp.d.tmp"; exit 1; fi - -LLDBWrapPython.cpp: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py \ - $(wildcard $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/interface/*.i) +LLDBWrapPython.cpp lldb.py: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py \ + $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py \ + $(wildcard $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/interface/*.i) $(Echo) Generating LLDBWrapPython.cpp - $(Verb) $(MKDIR) $(PYTHON_DIR) - $(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/build-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(TARGET_DIR)" "$(PYTHON_DIR)" "$(PYTHON_DIR)" - $(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/finish-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(TARGET_DIR)" "$(PYTHON_DIR)" "$(PYTHON_DIR)" -# $(Verb) if swig -c++ -shadow -python $(LLDB_SWIG_INCLUDE_DIRS) \ -# -D__STDC_LIMIT_MACROS -outdir "$(PYTHON_DIR)" \ -# $(SWIG_DEPEND_OPTIONS) \ -# -o LLDBWrapPython.cpp "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/lldb.swig" ; \ -# $(CPP_DEPEND_MOVEFILE) -# $(Verb) python "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py" \ -# "$(PYTHON_DIR)" -# $(Verb) python "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py" \ -# "$(PROJ_OBJ_DIR)" -# $(Verb) if test -f "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.edited"; then \ -# $(MV) "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.edited" \ -# "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp"; fi -# $(Verb) $(MV) "$(PYTHON_DIR)/lldb.py" "$(PYTHON_DIR)/__init__.py" -# $(Verb) $(CP) "$(PROJ_SRC_DIR)/embedded_interpreter.py" "$(PYTHON_DIR)" -# $(Verb) $(RM) -f $(PYTHON_DIR)/_lldb.so -# $(Verb) $(AliasTool) $(LIBLLDB) $(PYTHON_DIR)/_lldb.so -# $(LLDB_COPY_PACKAGE) - -else - -LLDBWrapPython.cpp: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py - $(Echo) Generating LLDBWrapPython.cpp - $(Verb) $(MKDIR) $(PYTHON_DIR) - $(Verb) swig -c++ -shadow -python $(LLDB_SWIG_INCLUDE_DIRS) \ - -D__STDC_LIMIT_MACROS -outdir "$(PYTHON_DIR)" \ - -o LLDBWrapPython.cpp "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/lldb.swig" - $(Verb) python "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py" \ - "$(PYTHON_DIR)" - $(Verb) python "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py" \ - "$(PROJ_OBJ_DIR)" - $(Verb) if test -f "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.edited"; then \ - $(MV) "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.edited" \ - "$(PROJ_OBJ_DIR)/LLDBWrapPython.cpp"; fi - $(Verb) $(MV) "$(PYTHON_DIR)/lldb.py" "$(PYTHON_DIR)/__init__.py" - $(Verb) $(CP) "$(PROJ_SRC_DIR)/embedded_interpreter.py" "$(PYTHON_DIR)" - $(Verb) $(RM) -f $(PYTHON_DIR)/_lldb.so - $(Verb) $(AliasTool) $(LIBLLDB) $(PYTHON_DIR)/_lldb.so - $(LLDB_COPY_PACKAGE) - -endif + $(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/build-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(PROJ_OBJ_DIR)" "$(PROJ_OBJ_DIR)" "$(PYTHON_DIR)" -m $(if $(DISABLE_AUTO_DEPENDENCIES),,-M) + $(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/finish-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(PROJ_OBJ_DIR)" "$(PROJ_OBJ_DIR)" "$(PYTHON_DIR)" -m -install-local:: $(PYTHON_DIR)/__init__.py $(PYTHON_DIR)/embedded_interpreter.py \ - $(addprefix $(PYTHON_DIR)/,$(LLDB_ALL_INSTALLED_SUBPACKAGE_FILES)) +install-local:: lldb.py $(Echo) Installing $(BuildMode) LLDB python modules - $(Verb) $(MKDIR) $(PYTHON_DEST_DIR) - $(Verb) $(DataInstall) $(PYTHON_DIR)/__init__.py $(PYTHON_DEST_DIR)/__init__.py - $(Verb) $(DataInstall) $(PYTHON_DIR)/embedded_interpreter.py $(PYTHON_DEST_DIR)/embedded_interpreter.py - $(Verb) $(RM) -f $(PYTHON_DEST_DIR)/_lldb.so - $(Verb) $(AliasTool) $(INST_LIBLLDB) $(PYTHON_DEST_DIR)/_lldb.so - $(LLDB_INSTALL_SUBPACKAGES) + $(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/finish-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(PROJ_OBJ_DIR)" "$(PROJ_OBJ_DIR)" "" -m clean-local:: - $(Verb) $(RM) -f LLDBWrapPython.cpp $(PYTHON_DIR)/_lldb.so \ - $(PYTHON_DIR)/embedded_interpreter.py $(PYTHON_DIR)/__init__.py \ - $(addprefix $(PYTHON_DIR)/,$(LLDB_ALL_INSTALLED_SUBPACKAGE_FILES)) + $(Verb) $(RM) -f LLDBWrapPython.cpp lldb.py diff --git a/lldb/test/Makefile b/lldb/test/Makefile index c499b52295ed..be45b36cd773 100644 --- a/lldb/test/Makefile +++ b/lldb/test/Makefile @@ -31,8 +31,8 @@ clean:: check-local:: rm -rf ../test-rdir env PATH="$(ToolDir):$(PATH)" \ - PYTHONPATH=$(LibDir)/python \ + PYTHONPATH="$(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False, \"$(LibDir)/..\")" )" \ LLDB_EXEC=$(ToolDir)/lldb \ - LLDB_BUILD_TYPE=Makefile \ + LLDB_BUILD_TYPE=Makefile \ $(SHLIBPATH_VAR)=$(LibDir):$($(SHLIBPATH_VAR)) \ python $(PROJ_SRC_DIR)/dotest.py -i -v -r ../test-rdir -- 2.34.1