diff --git a/Makefile b/Makefile
index 39cf9c6f57a14f88a1ebeaa93ac82bba6470e4e8..7b2a365f973711086a347be07a1673079591d0b5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,19 @@
-LEVEL = ../..
+##===- Makefile --------------------------------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+# If CLANG_LEVEL is not set, then we are the top-level Makefile. Otherwise, we
+# are being included from a subdirectory makefile.
+
+ifndef CLANG_LEVEL
+
+IS_TOP_LEVEL := 1
+CLANG_LEVEL := .
 DIRS := include lib tools docs
 
 PARALLEL_DIRS :=
@@ -6,9 +21,22 @@ PARALLEL_DIRS :=
 ifeq ($(BUILD_EXAMPLES),1)
   PARALLEL_DIRS += examples
 endif
+endif
+
+###
+# Common Makefile code, shared by all Clang Makefiles.
 
+# Set LLVM source root level.
+LEVEL := $(CLANG_LEVEL)/../..
+
+# Include LLVM common makefile.
 include $(LEVEL)/Makefile.common
 
+###
+# Clang Top Level specific stuff.
+
+ifeq ($(IS_TOP_LEVEL),1)
+
 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
 $(RecursiveTargets)::
 	$(Verb) if [ ! -f test/Makefile ]; then \
@@ -37,3 +65,5 @@ cscope.files:
 	                    -or -name '*.h' > cscope.files
 
 .PHONY: test report clean cscope.files
+
+endif
diff --git a/docs/Makefile b/docs/Makefile
index e9bbb28f68c4f631c12e285b0d3871307530e1fb..053b263d27dc7a2083fa7ee557ba5e24c2777751 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -7,7 +7,7 @@
 # 
 ##===----------------------------------------------------------------------===##
 
-LEVEL      := ../../..
+CLANG_LEVEL := ..
 DIRS       := tools
 
 ifdef BUILD_FOR_WEBSITE
@@ -22,7 +22,7 @@ $(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
 	  -e 's/@abs_top_builddir@/../g' > $@
 endif
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 HTML       := $(wildcard $(PROJ_SRC_DIR)/*.html) \
               $(wildcard $(PROJ_SRC_DIR)/*.css)
diff --git a/docs/tools/Makefile b/docs/tools/Makefile
index 91bc447c083fd118f5f56957ce4f9e1d871990a0..4cffc45fe0a67522aec7e92b5c58314fa6b6d653 100644
--- a/docs/tools/Makefile
+++ b/docs/tools/Makefile
@@ -37,8 +37,8 @@ clean:
 else
 
 # Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
-LEVEL := ../../../..
-include $(LEVEL)/Makefile.common
+CLANG_LEVEL := ../..
+include $(CLANG_LEVEL)/Makefile
 
 CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER)
 
diff --git a/examples/Makefile b/examples/Makefile
index 869197db35d2d27868de8b1552f1e78180a6fd8d..c4af25263398a170d2f3e1bc4cabbfd252f43708 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -7,8 +7,8 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../..
+CLANG_LEVEL := ..
 
 PARALLEL_DIRS := clang-interpreter PrintFunctionNames wpa
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
diff --git a/examples/PrintFunctionNames/Makefile b/examples/PrintFunctionNames/Makefile
index 57d3ba9b0cd9c0ccf9bd5a9a240faf890ac7700a..4136a98c5cdcf8f99311fdf60ae8bdb21024cc32 100644
--- a/examples/PrintFunctionNames/Makefile
+++ b/examples/PrintFunctionNames/Makefile
@@ -7,7 +7,7 @@
 # 
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME = PrintFunctionNames
 
 CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
@@ -15,7 +15,7 @@ CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 # Include this here so we can get the configuration of the targets that have
 # been configured for construction. We have to do this early so we can set up
 # LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
+include $(CLANG_LEVEL)/../../Makefile.config
 
 LINK_LIBS_IN_SHARED = 1
 SHARED_LIBRARY = 1
@@ -24,4 +24,4 @@ LINK_COMPONENTS := bitreader mc core
 USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
 	   clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
diff --git a/examples/clang-interpreter/Makefile b/examples/clang-interpreter/Makefile
index 397a1f9584a624d80d9bef1632b45befab62a313..6683a57c3b9c1c6e6c141ee6c98afb829f7dbcad 100644
--- a/examples/clang-interpreter/Makefile
+++ b/examples/clang-interpreter/Makefile
@@ -7,7 +7,7 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 
 TOOLNAME = clang-interpreter
 CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
@@ -19,7 +19,7 @@ TOOL_NO_EXPORTS = 1
 # Include this here so we can get the configuration of the targets that have
 # been configured for construction. We have to do this early so we can set up
 # LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
+include $(CLANG_LEVEL)/../../Makefile.config
 
 LINK_COMPONENTS := jit interpreter nativecodegen bitreader bitwriter ipo \
 	selectiondag asmparser
@@ -27,4 +27,4 @@ USEDLIBS = clangFrontend.a clangDriver.a clangCodeGen.a clangSema.a \
            clangChecker.a clangAnalysis.a clangRewrite.a  clangAST.a \
            clangParse.a clangLex.a clangBasic.a
 
-include $(LLVM_SRC_ROOT)/Makefile.rules
+include $(CLANG_LEVEL)/Makefile
diff --git a/examples/wpa/Makefile b/examples/wpa/Makefile
index b266cd108f9cdf381213eade63e1087fa105ca0a..16f92804aca79a6acad0bb12af3155df331076b8 100644
--- a/examples/wpa/Makefile
+++ b/examples/wpa/Makefile
@@ -7,7 +7,7 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 
 TOOLNAME = clang-wpa
 CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
@@ -19,10 +19,10 @@ TOOL_NO_EXPORTS = 1
 # Include this here so we can get the configuration of the targets that have
 # been configured for construction. We have to do this early so we can set up
 # LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
+include $(CLANG_LEVEL)/../../Makefile.config
 
 LINK_COMPONENTS := asmparser bitreader mc core
 USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
 	   clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
 
-include $(LLVM_SRC_ROOT)/Makefile.rules
+include $(CLANG_LEVEL)/Makefile
diff --git a/include/Makefile b/include/Makefile
index f686d6a6460684b2912e4bca32e5f4edb218d7c5..79b9adfb7282cac0db644220a017031b6f0a9487 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -1,4 +1,4 @@
-LEVEL = ../../..
+CLANG_LEVEL := ..
 DIRS := clang clang-c
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
diff --git a/include/clang-c/Makefile b/include/clang-c/Makefile
index 5e3522f79137def2d8144ca679f8084a089be794..98ea7190e687b5cfef825c2c87bc10dfd4b25a66 100644
--- a/include/clang-c/Makefile
+++ b/include/clang-c/Makefile
@@ -1,7 +1,7 @@
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 DIRS :=
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 install-local::
 	$(Echo) Installing Clang C API include files
diff --git a/include/clang/AST/Makefile b/include/clang/AST/Makefile
index 9aad990229c5cd0a31389c73c9dea8b8dfc5cabe..6e3dd89bf804d90e5417d0ed81384851bda4f890 100644
--- a/include/clang/AST/Makefile
+++ b/include/clang/AST/Makefile
@@ -1,10 +1,10 @@
-LEVEL = ../../../../..
+CLANG_LEVEL := ../../..
 BUILT_SOURCES = StmtNodes.inc DeclNodes.inc
 TD_SRC_DIR = $(PROJ_SRC_DIR)/../Basic
 
 TABLEGEN_INC_FILES_COMMON = 1
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 INPUT_TDS = $(TD_SRC_DIR)/StmtNodes.td $(TD_SRC_DIR)/DeclNodes.td
 
diff --git a/include/clang/Basic/Makefile b/include/clang/Basic/Makefile
index 48f7f9d8cc7b033df92bc2368263d3eb713387ed..1553a799145e881a80dba90c54dab30858d58c42 100644
--- a/include/clang/Basic/Makefile
+++ b/include/clang/Basic/Makefile
@@ -1,4 +1,4 @@
-LEVEL = ../../../../..
+CLANG_LEVEL := ../../..
 BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
 	DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \
 	DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \
@@ -7,7 +7,7 @@ BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
 
 TABLEGEN_INC_FILES_COMMON = 1
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td)
 
diff --git a/include/clang/Driver/Makefile b/include/clang/Driver/Makefile
index b462aaa24bc9fed18e212396121530819433f0c1..d8291662a563bbe43007375996313602e39eceb6 100644
--- a/include/clang/Driver/Makefile
+++ b/include/clang/Driver/Makefile
@@ -1,9 +1,9 @@
-LEVEL = ../../../../..
+CLANG_LEVEL := ../../..
 BUILT_SOURCES = Options.inc CC1Options.inc CC1AsOptions.inc
 
 TABLEGEN_INC_FILES_COMMON = 1
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 $(ObjDir)/Options.inc.tmp : Options.td OptParser.td $(TBLGEN) $(ObjDir)/.dir
 	$(Echo) "Building Clang Driver Option tables with tblgen"
diff --git a/include/clang/Makefile b/include/clang/Makefile
index 6abe375d5e97290602cf270d35ca27cf446bb6bd..e366e4ec445874c14e4b93530c1e93263d38c591 100644
--- a/include/clang/Makefile
+++ b/include/clang/Makefile
@@ -1,7 +1,7 @@
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 DIRS := AST Basic Driver
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 install-local::
 	$(Echo) Installing Clang include files
diff --git a/lib/AST/Makefile b/lib/AST/Makefile
index ede25777c90b844ce618e716290534f8c61d6c85..a4bb9aa99db7af19f556da2c2f37919ae067286d 100644
--- a/lib/AST/Makefile
+++ b/lib/AST/Makefile
@@ -11,11 +11,11 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangAST
 BUILD_ARCHIVE = 1
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Analysis/Makefile b/lib/Analysis/Makefile
index 9b473803fa92185578833d39459324c75a1cbfd0..e9950fc440789497ea92186e13119a940b8bdeff 100644
--- a/lib/Analysis/Makefile
+++ b/lib/Analysis/Makefile
@@ -11,11 +11,11 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangAnalysis
 BUILD_ARCHIVE = 1
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Basic/Makefile b/lib/Basic/Makefile
index 58ac7eb86e75d8cf80001d7cb02a777e2d515b41..f36a1bcff6e25514a5f119f3032faa459bc0b385 100644
--- a/lib/Basic/Makefile
+++ b/lib/Basic/Makefile
@@ -11,7 +11,7 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangBasic
 BUILD_ARCHIVE = 1
 
@@ -20,7 +20,7 @@ ifdef CLANG_VENDOR
 CPPFLAGS += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
 endif
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 SVN_REVISION := $(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(PROJ_SRC_DIR)/../..)
 
diff --git a/lib/Checker/Makefile b/lib/Checker/Makefile
index c45ab294dec4f41212916e2b24323b32f7751208..fc2bc507219c4f39f9b9664d02fed13bbe9e879a 100644
--- a/lib/Checker/Makefile
+++ b/lib/Checker/Makefile
@@ -11,11 +11,11 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangChecker
 BUILD_ARCHIVE = 1
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/CodeGen/Makefile b/lib/CodeGen/Makefile
index 3cea6bbd9f06ff8aa7ec45dc0703eeef0a8cd214..cfa021794235edcc4918b09ca3c0d7b3ec24782e 100644
--- a/lib/CodeGen/Makefile
+++ b/lib/CodeGen/Makefile
@@ -12,7 +12,7 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangCodeGen
 BUILD_ARCHIVE = 1
 
@@ -21,5 +21,5 @@ ifdef CLANG_VENDOR
 CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
 endif
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Driver/Makefile b/lib/Driver/Makefile
index 371bda781c679f23d12c11465c03aded869d3faf..5ee4abc99ca8c2ae7446d3ba094c35a5ac9f5f3b 100644
--- a/lib/Driver/Makefile
+++ b/lib/Driver/Makefile
@@ -7,10 +7,10 @@
 # 
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangDriver
 BUILD_ARCHIVE = 1
 
 CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
diff --git a/lib/Frontend/Makefile b/lib/Frontend/Makefile
index 9e1a864d96e35ff3f27aa6b26cff8718639973f0..962568b58d21e0823d4ef8edd805cee72d302af9 100644
--- a/lib/Frontend/Makefile
+++ b/lib/Frontend/Makefile
@@ -7,11 +7,11 @@
 # 
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangFrontend
 BUILD_ARCHIVE = 1
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Headers/Makefile b/lib/Headers/Makefile
index fea59d6f4b280bbe25cbe5d98dd5c024db437e58..c93294a8b31199b46123d5598217a8b6c3c9e957 100644
--- a/lib/Headers/Makefile
+++ b/lib/Headers/Makefile
@@ -7,12 +7,12 @@
 # 
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 
 BUILT_SOURCES = arm_neon.h.inc
 TABLEGEN_INC_FILES_COMMON = 1
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER)
 
@@ -30,7 +30,7 @@ $(OBJHEADERS): $(HeaderDir)/%.h: $(PROJ_SRC_DIR)/%.h $(HeaderDir)/.dir $(HeaderD
 $(HeaderDir)/arm_neon.h: $(BUILT_SOURCES)
 	$(Verb) cp $< $@
 	$(Echo) Copying $(notdir $<) to build dir
-	
+
 # Hook into the standard Makefile rules.
 all-local:: $(OBJHEADERS)
 
diff --git a/lib/Index/Makefile b/lib/Index/Makefile
index 4d8671361cdff90e8f954ca445fa938a971f8184..191e9d4b595dc434d70137f51c204fb5f4e1fc0a 100644
--- a/lib/Index/Makefile
+++ b/lib/Index/Makefile
@@ -11,8 +11,8 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
-include $(LEVEL)/Makefile.config
+CLANG_LEVEL := ../..
+include $(CLANG_LEVEL)/../../Makefile.config
 
 LIBRARYNAME := clangIndex
 BUILD_ARCHIVE = 1
@@ -23,5 +23,5 @@ endif
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Lex/Makefile b/lib/Lex/Makefile
index bd3c7a872d3ad5466d89917318af4e0bc871c3b5..98452146c07f1950592edd8dca7997ab27d38edb 100644
--- a/lib/Lex/Makefile
+++ b/lib/Lex/Makefile
@@ -11,8 +11,8 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
-include $(LEVEL)/Makefile.config
+CLANG_LEVEL := ../..
+include $(CLANG_LEVEL)/../../Makefile.config
 
 LIBRARYNAME := clangLex
 BUILD_ARCHIVE = 1
@@ -23,5 +23,5 @@ endif
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Makefile b/lib/Makefile
index 538bf439407128e8db40d22dfe2972863df5e94c..eb5a5a645256e151e128ed9291afa815ad070ac6 100755
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -6,10 +6,10 @@
 # License. See LICENSE.TXT for details.
 # 
 ##===----------------------------------------------------------------------===##
-LEVEL = ../../..
+CLANG_LEVEL := ..
 
 PARALLEL_DIRS = Headers Runtime Basic Lex Parse AST Sema CodeGen Analysis \
                 Checker Rewrite Frontend Index Driver
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Parse/Makefile b/lib/Parse/Makefile
index 6a5540f73356cb9dcff955474342b614817cafb7..e6bac34be284d5a71ae887d09ecd2b63d3a4b5ea 100644
--- a/lib/Parse/Makefile
+++ b/lib/Parse/Makefile
@@ -11,11 +11,11 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangParse
 BUILD_ARCHIVE = 1
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Rewrite/Makefile b/lib/Rewrite/Makefile
index 04c353090dc7b277d8f82279b2a61c6dc1a06786..29e0595c1d6a7ace99d6f0a79fd9c20956046f55 100644
--- a/lib/Rewrite/Makefile
+++ b/lib/Rewrite/Makefile
@@ -11,11 +11,11 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangRewrite
 BUILD_ARCHIVE = 1
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/lib/Runtime/Makefile b/lib/Runtime/Makefile
index 580215acb62cbb12e9df7f54b5158a132eaa6db2..1b258184af3d1da1c42747767b74f5cf3031194c 100644
--- a/lib/Runtime/Makefile
+++ b/lib/Runtime/Makefile
@@ -13,8 +13,8 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
-include $(LEVEL)/Makefile.common
+CLANG_LEVEL := ../..
+include $(CLANG_LEVEL)/Makefile
 
 CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER)
 ResourceDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/$(CLANG_VERSION)
diff --git a/lib/Sema/Makefile b/lib/Sema/Makefile
index 3a5a99ad576ad874e9db7b74b75247f151f8fc8f..6e13327af1a232f828a4441341446e55e61eebbc 100644
--- a/lib/Sema/Makefile
+++ b/lib/Sema/Makefile
@@ -12,11 +12,11 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME := clangSema
 BUILD_ARCHIVE = 1
 
 CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
diff --git a/test/Makefile b/test/Makefile
index c3b3eab589455f9c3a0a4b08acbd4614cc12c198..5bb50c622afd826332714c289ea9cfcf33751956 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,5 +1,5 @@
-LEVEL = ../../..
-include $(LEVEL)/Makefile.common
+CLANG_LEVEL := ..
+include $(CLANG_LEVEL)/Makefile
 
 # Test in all immediate subdirectories if unset.
 ifdef TESTSUITE
diff --git a/tools/Makefile b/tools/Makefile
index 8407dfdedde7ddf9c6762aa80e18bd391f734df1..c1e61636d3076c3e6d75fe6c522eb5aee4bc1dc6 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -7,13 +7,13 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL := ../../..
+CLANG_LEVEL := ..
 DIRS := driver libclang c-index-test
 
-include $(LEVEL)/Makefile.config
+include $(CLANG_LEVEL)/../../Makefile.config
 
 ifeq ($(OS), $(filter $(OS), Cygwin MingW))
 DIRS := $(filter-out libclang c-index-test, $(DIRS))
 endif
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
diff --git a/tools/c-index-test/Makefile b/tools/c-index-test/Makefile
index 24fed16006dd9d0c2c8c9f09db4eece392c2ade7..dd39d25e579c053bd247fb491eb82e16fbcbc88e 100644
--- a/tools/c-index-test/Makefile
+++ b/tools/c-index-test/Makefile
@@ -6,7 +6,7 @@
 # License. See LICENSE.TXT for details.
 # 
 ##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 
 TOOLNAME = c-index-test
 CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
@@ -14,10 +14,10 @@ CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 # No plugins, optimize startup time.
 TOOL_NO_EXPORTS = 1
 
-include $(LEVEL)/Makefile.config
+include $(CLANG_LEVEL)/../../Makefile.config
 
 LINK_COMPONENTS := bitreader mc core
 USEDLIBS = clang.a clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
 	   clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
 
-include $(LLVM_SRC_ROOT)/Makefile.rules
+include $(CLANG_LEVEL)/Makefile
diff --git a/tools/driver/Makefile b/tools/driver/Makefile
index ac98730328f880874a1077c98c6fd4e75fce19ee..5125892efb376d2c71dab8fa6fb7b84e28ba4b9b 100644
--- a/tools/driver/Makefile
+++ b/tools/driver/Makefile
@@ -6,7 +6,7 @@
 # License. See LICENSE.TXT for details.
 #
 ##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 
 TOOLNAME = clang
 ifndef CLANG_IS_PRODUCTION
@@ -24,7 +24,7 @@ TOOL_NO_EXPORTS = 1
 # Include this here so we can get the configuration of the targets that have
 # been configured for construction. We have to do this early so we can set up
 # LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
+include $(CLANG_LEVEL)/../../Makefile.config
 
 LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
                    ipo selectiondag
@@ -32,7 +32,7 @@ USEDLIBS = clangFrontend.a clangDriver.a clangCodeGen.a clangSema.a \
            clangChecker.a clangAnalysis.a clangRewrite.a  clangAST.a \
            clangParse.a clangLex.a clangBasic.a
 
-include $(LLVM_SRC_ROOT)/Makefile.rules
+include $(CLANG_LEVEL)/Makefile
 
 # Translate make variable to define when building a "production" clang.
 ifdef CLANG_IS_PRODUCTION
diff --git a/tools/libclang/Makefile b/tools/libclang/Makefile
index ff0fa33e41ebfd7373721d8fecdb7d6743f8443c..4cfe1260fdbecaa9e8d421dbb6b8bc7022653070 100644
--- a/tools/libclang/Makefile
+++ b/tools/libclang/Makefile
@@ -7,7 +7,7 @@
 # 
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
 LIBRARYNAME = clang
 
 EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/libclang.exports
@@ -17,7 +17,7 @@ CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 # Include this here so we can get the configuration of the targets
 # that have been configured for construction. We have to do this 
 # early so we can set up LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
+include $(CLANG_LEVEL)/../../Makefile.config
 
 LINK_LIBS_IN_SHARED = 1
 SHARED_LIBRARY = 1
@@ -26,7 +26,7 @@ LINK_COMPONENTS := bitreader mc core
 USEDLIBS = clangFrontend.a clangDriver.a clangSema.a \
 	   clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
 
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
 
 ##===----------------------------------------------------------------------===##
 # FIXME: This is copied from the 'lto' makefile.  Should we share this?