Index: source/Interpreter/Makefile
===================================================================
--- source/Interpreter/Makefile	(revision 153608)
+++ source/Interpreter/Makefile	(working copy)
@@ -16,6 +16,14 @@
 include $(LLDB_LEVEL)/Makefile
 -include $(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.d
 
+ifeq ($(PYHON),)
+PYTHON := python
+endif
+
+ifeq ($(SWIG),)
+SWIG := swig
+endif
+
 PYTHON_DIR := $(ToolDir)
 ifeq ($(HOST_OS),Darwin)
 PYTHON_DEST_DIR := $(DESTDIR)/$(call realpath,/Library/Python/$(shell python -c 'import sys; print sys.version[:3]')/site-packages)
@@ -43,33 +51,76 @@
 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
+LLDB_SRC_DIR         = $(PROJ_SRC_DIR)/$(LLDB_LEVEL)
+LLDB_EXAMPLES_DIR    = $(LLDB_SRC_DIR)/examples
+
+# The framework python modules to install together with lldb.py.
+LLDB_PYTHON_FW_FILES = $(wildcard $(LLDB_EXAMPLES_DIR)/synthetic/*.py) \
+					   $(wildcard $(LLDB_EXAMPLES_DIR)/summaries/*.py) \
+					   $(wildcard $(LLDB_EXAMPLES_DIR)/summaries/cocoa/*.py)
+
+# Python bindings
+LldbSwigInput        = $(LLDB_SRC_DIR)/scripts/lldb.swig
+PythonSwigInputs     = $(LLDB_SRC_DIR)/scripts/Python/python-extensions.swig \
+					   $(LLDB_SRC_DIR)/scripts/Python/python-wrapper.swig \
+					   $(LLDB_SRC_DIR)/scripts/Python/python-typemaps.swig
+PythonBindInterface := $(wildcard $(LLDB_SRC_DIR)/scripts/Python/interface/*.i)
+LldbApiIncludes     := $(wildcard $(LLDB_SRC_DIR)/include/lldb/*.h) \
+                       $(wildcard $(LLDB_SRC_DIR)/include/lldb/API/*.h)
+PythonModifyScript   = $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py
+PythonEditScript     = $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py
+
+all-local:: liblldb-alias interpr-copy
+
+# We always create a link to liblldb.so. If liblldb.so will not be created later for some reason
+# this link will stay broken.
+liblldb-alias:: $(PYTHON_DIR)/_lldb.so
+$(PYTHON_DIR)/_lldb.so:
+$(PYTHON_DEST_DIR)/lib-dynload/_lldb.so:
+	$(Echo) Generating link $@ to lldb.so
+	$(Verb) $(RM) -f $@
+	$(Verb) $(AliasTool) $(LIBLLDB) $@
+
+interpr-copy:: $(PYTHON_DIR)/embedded_interpreter.py
+$(PYTHON_DIR)/embedded_interpreter.py: $(PROJ_SRC_DIR)/embedded_interpreter.py
+	$(Echo) Copying embedded_interpreter.py ; \
+	cp "$(PROJ_SRC_DIR)/embedded_interpreter.py" "$(PYTHON_DIR)" ; \
+
+LLDBWrapPython.cpp: $(LldbSwigInput) $(PythonSwigInputs) \
+                    $(PythonBindInterface) $(LldbApiIncludes)
 	$(Echo) Generating LLDBWrapPython.cpp
-	$(Verb) if swig -c++ -shadow -python $(LLDB_SWIG_INCLUDE_DIRS) \
+	$(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" ; \
+          -o $@ "$(LldbSwigInput)" ; \
           $(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) cp "$(PROJ_SRC_DIR)/embedded_interpreter.py" "$(PYTHON_DIR)"
-	$(Verb) $(RM) -f $(PYTHON_DIR)/_lldb.so
-	$(Verb) $(AliasTool) $(LIBLLDB) $(PYTHON_DIR)/_lldb.so
+	$(Verb) $(PYTHON) "$(PythonModifyScript)" "$(PYTHON_DIR)"
+	$(Verb) $(PYTHON) "$(PythonEditScript)" "$(PROJ_OBJ_DIR)"
+	$(Verb) if test -f "$(PROJ_OBJ_DIR)/$@.edited"; then \
+		  mv "$(PROJ_OBJ_DIR)/$@.edited" \
+			 "$(PROJ_OBJ_DIR)/$@"; fi
 
-install-local:: $(PYTHON_DIR)/lldb.py $(PYTHON_DIR)/embedded_interpreter.py
+install-local:: $(PYTHON_DIR)/lldb.py $(PYTHON_DIR)/embedded_interpreter.py \
+			    $(PYTHON_DEST_DIR)/lib-dynload/_lldb.so \
+			    $(LLDB_PYTHON_FW_FILES)
 	$(Echo) Installing $(BuildMode) LLDB python modules
-	$(Verb) $(MKDIR) $(PYTHON_DEST_DIR)/lib-dynload
+	$(Verb) $(MKDIR) $(PYTHON_DIR)/lib-dynload
 	$(Verb) $(DataInstall) $(PYTHON_DIR)/lldb.py $(PYTHON_DEST_DIR)/lldb.py
 	$(Verb) $(DataInstall) $(PYTHON_DIR)/embedded_interpreter.py $(PYTHON_DEST_DIR)/embedded_interpreter.py
 	$(Verb) $(RM) -f $(PYTHON_DEST_DIR)/lib-dynload/_lldb.so
 	$(Verb) $(AliasTool) $(INST_LIBLLDB) $(PYTHON_DEST_DIR)/lib-dynload/_lldb.so
+	$(Echo) Installing LLDB python framework modules into $(PYTHON_DEST_DIR)/lldb 
+	$(Verb) $(MKDIR) $(PYTHON_DEST_DIR)/lldb
+	$(Verb) $(DataInstall) $(LLDB_PYTHON_FW_FILES) $(PYTHON_DEST_DIR)/lldb/
+	$(Echo) Generating LLDB python package configuration
+	$(Verb) $(ECHO) lldb > $(PYTHON_DEST_DIR)/lldb.pth
 
+uninstall-local::
+	$(Verb) $(RM) -f $(PYTHON_DEST_DIR)/lib-dynload/_lldb.so
+	$(Verb) $(RM) -rf $(PYTHON_DEST_DIR)/lldb
+	$(Verb) $(RM) -f $(PYTHON_DEST_DIR)/lldb.py $(PYTHON_DEST_DIR)/lldb.pth $(PYTHON_DEST_DIR)/embedded_interpreter.py
+	
 clean-local::
-	$(Verb) $(RM) -f LLDBWrapPython.cpp $(PYTHON_DIR)/_lldb.so \
-	          $(PYTHON_DIR)/embedded_interpreter.py $(PYTHON_DIR)/lldb.py
+	$(Verb) $(RM) -f LLDBWrapPython.cpp LLDBWrapPython.cpp.d \
+	          $(PYTHON_DIR)/_lldb.so $(PYTHON_DIR)/lldb.py \
+	          $(PYTHON_DIR)/embedded_interpreter.py
