[Lldb-commits] [lldb] r167242 - in /lldb/trunk: scripts/Python/build-swig-Python.sh scripts/Python/finish-swig-Python-LLDB.sh scripts/Python/modify-python-lldb.py scripts/build-swig-wrapper-classes.sh scripts/finish-swig-wrapper-classes.sh source/Interpreter/Makefile test/Makefile

Filipe Cabecinhas me at filcab.net
Thu Nov 1 11:55:17 PDT 2012


Author: filcab
Date: Thu Nov  1 13:55:16 2012
New Revision: 167242

URL: http://llvm.org/viewvc/llvm-project?rev=167242&view=rev
Log:
Makefile patches from Charles Davis and Daniel Malea (+ one or two tweaks).

Modified:
    lldb/trunk/scripts/Python/build-swig-Python.sh
    lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
    lldb/trunk/scripts/Python/modify-python-lldb.py
    lldb/trunk/scripts/build-swig-wrapper-classes.sh
    lldb/trunk/scripts/finish-swig-wrapper-classes.sh
    lldb/trunk/source/Interpreter/Makefile
    lldb/trunk/test/Makefile

Modified: lldb/trunk/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/build-swig-Python.sh?rev=167242&r1=167241&r2=167242&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/build-swig-Python.sh (original)
+++ lldb/trunk/scripts/Python/build-swig-Python.sh Thu Nov  1 13:55:16 2012
@@ -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 @@
 
 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 @@
 
 # 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 @@
 
 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}

Modified: lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh?rev=167242&r1=167241&r2=167242&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh Thu Nov  1 13:55:16 2012
@@ -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 @@
 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 @@
     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 @@
     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 @@
 
     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
         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 ]

Modified: lldb/trunk/scripts/Python/modify-python-lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=167242&r1=167241&r2=167242&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Thu Nov  1 13:55:16 2012
@@ -386,7 +386,7 @@
                 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)

Modified: lldb/trunk/scripts/build-swig-wrapper-classes.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-swig-wrapper-classes.sh?rev=167242&r1=167241&r2=167242&view=diff
==============================================================================
--- lldb/trunk/scripts/build-swig-wrapper-classes.sh (original)
+++ lldb/trunk/scripts/build-swig-wrapper-classes.sh Thu Nov  1 13:55:16 2012
@@ -26,20 +26,45 @@
 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 @@
                 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

Modified: lldb/trunk/scripts/finish-swig-wrapper-classes.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/finish-swig-wrapper-classes.sh?rev=167242&r1=167241&r2=167242&view=diff
==============================================================================
--- lldb/trunk/scripts/finish-swig-wrapper-classes.sh (original)
+++ lldb/trunk/scripts/finish-swig-wrapper-classes.sh Thu Nov  1 13:55:16 2012
@@ -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 @@
 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 @@
                 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

Modified: lldb/trunk/source/Interpreter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Makefile?rev=167242&r1=167241&r2=167242&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Makefile (original)
+++ lldb/trunk/source/Interpreter/Makefile Thu Nov  1 13:55:16 2012
@@ -18,177 +18,19 @@
 
 # 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

Modified: lldb/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/Makefile?rev=167242&r1=167241&r2=167242&view=diff
==============================================================================
--- lldb/trunk/test/Makefile (original)
+++ lldb/trunk/test/Makefile Thu Nov  1 13:55:16 2012
@@ -31,8 +31,8 @@
 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





More information about the lldb-commits mailing list