summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile32
-rw-r--r--docs/Makefile4
-rw-r--r--docs/tools/Makefile4
-rw-r--r--examples/Makefile4
-rw-r--r--examples/PrintFunctionNames/Makefile6
-rw-r--r--examples/clang-interpreter/Makefile6
-rw-r--r--examples/wpa/Makefile6
-rw-r--r--include/Makefile4
-rw-r--r--include/clang-c/Makefile4
-rw-r--r--include/clang/AST/Makefile4
-rw-r--r--include/clang/Basic/Makefile4
-rw-r--r--include/clang/Driver/Makefile4
-rw-r--r--include/clang/Makefile4
-rw-r--r--lib/AST/Makefile4
-rw-r--r--lib/Analysis/Makefile4
-rw-r--r--lib/Basic/Makefile4
-rw-r--r--lib/Checker/Makefile4
-rw-r--r--lib/CodeGen/Makefile4
-rw-r--r--lib/Driver/Makefile4
-rw-r--r--lib/Frontend/Makefile4
-rw-r--r--lib/Headers/Makefile6
-rw-r--r--lib/Index/Makefile6
-rw-r--r--lib/Lex/Makefile6
-rwxr-xr-xlib/Makefile4
-rw-r--r--lib/Parse/Makefile4
-rw-r--r--lib/Rewrite/Makefile4
-rw-r--r--lib/Runtime/Makefile4
-rw-r--r--lib/Sema/Makefile4
-rw-r--r--test/Makefile4
-rw-r--r--tools/Makefile6
-rw-r--r--tools/c-index-test/Makefile6
-rw-r--r--tools/driver/Makefile6
-rw-r--r--tools/libclang/Makefile6
33 files changed, 105 insertions, 75 deletions
diff --git a/Makefile b/Makefile
index 39cf9c6f57..7b2a365f97 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 e9bbb28f68..053b263d27 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 91bc447c08..4cffc45fe0 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 869197db35..c4af252633 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 57d3ba9b0c..4136a98c5c 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 397a1f9584..6683a57c3b 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 b266cd108f..16f92804ac 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 f686d6a646..79b9adfb72 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 5e3522f791..98ea7190e6 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 9aad990229..6e3dd89bf8 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 48f7f9d8cc..1553a79914 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 b462aaa24b..d8291662a5 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 6abe375d5e..e366e4ec44 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 ede25777c9..a4bb9aa99d 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 9b473803fa..e9950fc440 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 58ac7eb86e..f36a1bcff6 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 c45ab294de..fc2bc50721 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 3cea6bbd9f..cfa0217942 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 371bda781c..5ee4abc99c 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 9e1a864d96..962568b58d 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 fea59d6f4b..c93294a8b3 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 4d8671361c..191e9d4b59 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 bd3c7a872d..98452146c0 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 538bf43940..eb5a5a6452 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 6a5540f733..e6bac34be2 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 04c353090d..29e0595c1d 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 580215acb6..1b258184af 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 3a5a99ad57..6e13327af1 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 c3b3eab589..5bb50c622a 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 8407dfdedd..c1e61636d3 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 24fed16006..dd39d25e57 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 ac98730328..5125892efb 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 ff0fa33e41..4cfe1260fd 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?