Skip to content

Commit e6c1daa

Browse files
committed
Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM. llvm-svn: 105637
1 parent 281d6bc commit e6c1daa

File tree

33 files changed

+105
-75
lines changed

33 files changed

+105
-75
lines changed

clang/Makefile

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
1-
LEVEL = ../..
1+
##===- Makefile --------------------------------------------*- Makefile -*-===##
2+
#
3+
# The LLVM Compiler Infrastructure
4+
#
5+
# This file is distributed under the University of Illinois Open Source
6+
# License. See LICENSE.TXT for details.
7+
#
8+
##===----------------------------------------------------------------------===##
9+
10+
# If CLANG_LEVEL is not set, then we are the top-level Makefile. Otherwise, we
11+
# are being included from a subdirectory makefile.
12+
13+
ifndef CLANG_LEVEL
14+
15+
IS_TOP_LEVEL := 1
16+
CLANG_LEVEL := .
217
DIRS := include lib tools docs
318

419
PARALLEL_DIRS :=
520

621
ifeq ($(BUILD_EXAMPLES),1)
722
PARALLEL_DIRS += examples
823
endif
24+
endif
25+
26+
###
27+
# Common Makefile code, shared by all Clang Makefiles.
928

29+
# Set LLVM source root level.
30+
LEVEL := $(CLANG_LEVEL)/../..
31+
32+
# Include LLVM common makefile.
1033
include $(LEVEL)/Makefile.common
1134

35+
###
36+
# Clang Top Level specific stuff.
37+
38+
ifeq ($(IS_TOP_LEVEL),1)
39+
1240
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
1341
$(RecursiveTargets)::
1442
$(Verb) if [ ! -f test/Makefile ]; then \
@@ -37,3 +65,5 @@ cscope.files:
3765
-or -name '*.h' > cscope.files
3866

3967
.PHONY: test report clean cscope.files
68+
69+
endif

clang/docs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
##===----------------------------------------------------------------------===##
99

10-
LEVEL := ../../..
10+
CLANG_LEVEL := ..
1111
DIRS := tools
1212

1313
ifdef BUILD_FOR_WEBSITE
@@ -22,7 +22,7 @@ $(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
2222
-e 's/@abs_top_builddir@/../g' > $@
2323
endif
2424

25-
include $(LEVEL)/Makefile.common
25+
include $(CLANG_LEVEL)/Makefile
2626

2727
HTML := $(wildcard $(PROJ_SRC_DIR)/*.html) \
2828
$(wildcard $(PROJ_SRC_DIR)/*.css)

clang/docs/tools/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ clean:
3737
else
3838

3939
# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
40-
LEVEL := ../../../..
41-
include $(LEVEL)/Makefile.common
40+
CLANG_LEVEL := ../..
41+
include $(CLANG_LEVEL)/Makefile
4242

4343
CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER)
4444

clang/examples/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#
88
##===----------------------------------------------------------------------===##
99

10-
LEVEL = ../../..
10+
CLANG_LEVEL := ..
1111

1212
PARALLEL_DIRS := clang-interpreter PrintFunctionNames wpa
1313

14-
include $(LEVEL)/Makefile.common
14+
include $(CLANG_LEVEL)/Makefile

clang/examples/PrintFunctionNames/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
#
88
##===----------------------------------------------------------------------===##
99

10-
LEVEL = ../../../..
10+
CLANG_LEVEL := ../..
1111
LIBRARYNAME = PrintFunctionNames
1212

1313
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
1414

1515
# Include this here so we can get the configuration of the targets that have
1616
# been configured for construction. We have to do this early so we can set up
1717
# LINK_COMPONENTS before including Makefile.rules
18-
include $(LEVEL)/Makefile.config
18+
include $(CLANG_LEVEL)/../../Makefile.config
1919

2020
LINK_LIBS_IN_SHARED = 1
2121
SHARED_LIBRARY = 1
@@ -24,4 +24,4 @@ LINK_COMPONENTS := bitreader mc core
2424
USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
2525
clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
2626

27-
include $(LEVEL)/Makefile.common
27+
include $(CLANG_LEVEL)/Makefile

clang/examples/clang-interpreter/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
##===----------------------------------------------------------------------===##
99

10-
LEVEL = ../../../..
10+
CLANG_LEVEL := ../..
1111

1212
TOOLNAME = clang-interpreter
1313
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
@@ -19,12 +19,12 @@ TOOL_NO_EXPORTS = 1
1919
# Include this here so we can get the configuration of the targets that have
2020
# been configured for construction. We have to do this early so we can set up
2121
# LINK_COMPONENTS before including Makefile.rules
22-
include $(LEVEL)/Makefile.config
22+
include $(CLANG_LEVEL)/../../Makefile.config
2323

2424
LINK_COMPONENTS := jit interpreter nativecodegen bitreader bitwriter ipo \
2525
selectiondag asmparser
2626
USEDLIBS = clangFrontend.a clangDriver.a clangCodeGen.a clangSema.a \
2727
clangChecker.a clangAnalysis.a clangRewrite.a clangAST.a \
2828
clangParse.a clangLex.a clangBasic.a
2929

30-
include $(LLVM_SRC_ROOT)/Makefile.rules
30+
include $(CLANG_LEVEL)/Makefile

clang/examples/wpa/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
##===----------------------------------------------------------------------===##
99

10-
LEVEL = ../../../..
10+
CLANG_LEVEL := ../..
1111

1212
TOOLNAME = clang-wpa
1313
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
@@ -19,10 +19,10 @@ TOOL_NO_EXPORTS = 1
1919
# Include this here so we can get the configuration of the targets that have
2020
# been configured for construction. We have to do this early so we can set up
2121
# LINK_COMPONENTS before including Makefile.rules
22-
include $(LEVEL)/Makefile.config
22+
include $(CLANG_LEVEL)/../../Makefile.config
2323

2424
LINK_COMPONENTS := asmparser bitreader mc core
2525
USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
2626
clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
2727

28-
include $(LLVM_SRC_ROOT)/Makefile.rules
28+
include $(CLANG_LEVEL)/Makefile

clang/include/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LEVEL = ../../..
1+
CLANG_LEVEL := ..
22
DIRS := clang clang-c
33

4-
include $(LEVEL)/Makefile.common
4+
include $(CLANG_LEVEL)/Makefile

clang/include/clang-c/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
LEVEL = ../../../..
1+
CLANG_LEVEL := ../..
22
DIRS :=
33

4-
include $(LEVEL)/Makefile.common
4+
include $(CLANG_LEVEL)/Makefile
55

66
install-local::
77
$(Echo) Installing Clang C API include files

clang/include/clang/AST/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
LEVEL = ../../../../..
1+
CLANG_LEVEL := ../../..
22
BUILT_SOURCES = StmtNodes.inc DeclNodes.inc
33
TD_SRC_DIR = $(PROJ_SRC_DIR)/../Basic
44

55
TABLEGEN_INC_FILES_COMMON = 1
66

7-
include $(LEVEL)/Makefile.common
7+
include $(CLANG_LEVEL)/Makefile
88

99
INPUT_TDS = $(TD_SRC_DIR)/StmtNodes.td $(TD_SRC_DIR)/DeclNodes.td
1010

clang/include/clang/Basic/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LEVEL = ../../../../..
1+
CLANG_LEVEL := ../../..
22
BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
33
DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \
44
DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \
@@ -7,7 +7,7 @@ BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
77

88
TABLEGEN_INC_FILES_COMMON = 1
99

10-
include $(LEVEL)/Makefile.common
10+
include $(CLANG_LEVEL)/Makefile
1111

1212
INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td)
1313

clang/include/clang/Driver/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
LEVEL = ../../../../..
1+
CLANG_LEVEL := ../../..
22
BUILT_SOURCES = Options.inc CC1Options.inc CC1AsOptions.inc
33

44
TABLEGEN_INC_FILES_COMMON = 1
55

6-
include $(LEVEL)/Makefile.common
6+
include $(CLANG_LEVEL)/Makefile
77

88
$(ObjDir)/Options.inc.tmp : Options.td OptParser.td $(TBLGEN) $(ObjDir)/.dir
99
$(Echo) "Building Clang Driver Option tables with tblgen"

clang/include/clang/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
LEVEL = ../../../..
1+
CLANG_LEVEL := ../..
22
DIRS := AST Basic Driver
33

4-
include $(LEVEL)/Makefile.common
4+
include $(CLANG_LEVEL)/Makefile
55

66
install-local::
77
$(Echo) Installing Clang include files

clang/lib/AST/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
#
1212
##===----------------------------------------------------------------------===##
1313

14-
LEVEL = ../../../..
14+
CLANG_LEVEL := ../..
1515
LIBRARYNAME := clangAST
1616
BUILD_ARCHIVE = 1
1717

1818
CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
1919

20-
include $(LEVEL)/Makefile.common
20+
include $(CLANG_LEVEL)/Makefile
2121

clang/lib/Analysis/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
#
1212
##===----------------------------------------------------------------------===##
1313

14-
LEVEL = ../../../..
14+
CLANG_LEVEL := ../..
1515
LIBRARYNAME := clangAnalysis
1616
BUILD_ARCHIVE = 1
1717

1818
CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
1919

20-
include $(LEVEL)/Makefile.common
20+
include $(CLANG_LEVEL)/Makefile
2121

clang/lib/Basic/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
##===----------------------------------------------------------------------===##
1313

14-
LEVEL = ../../../..
14+
CLANG_LEVEL := ../..
1515
LIBRARYNAME := clangBasic
1616
BUILD_ARCHIVE = 1
1717

@@ -20,7 +20,7 @@ ifdef CLANG_VENDOR
2020
CPPFLAGS += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
2121
endif
2222

23-
include $(LEVEL)/Makefile.common
23+
include $(CLANG_LEVEL)/Makefile
2424

2525
SVN_REVISION := $(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(PROJ_SRC_DIR)/../..)
2626

clang/lib/Checker/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
#
1212
##===----------------------------------------------------------------------===##
1313

14-
LEVEL = ../../../..
14+
CLANG_LEVEL := ../..
1515
LIBRARYNAME := clangChecker
1616
BUILD_ARCHIVE = 1
1717

1818
CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
1919

20-
include $(LEVEL)/Makefile.common
20+
include $(CLANG_LEVEL)/Makefile
2121

clang/lib/CodeGen/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#
1313
##===----------------------------------------------------------------------===##
1414

15-
LEVEL = ../../../..
15+
CLANG_LEVEL := ../..
1616
LIBRARYNAME := clangCodeGen
1717
BUILD_ARCHIVE = 1
1818

@@ -21,5 +21,5 @@ ifdef CLANG_VENDOR
2121
CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
2222
endif
2323

24-
include $(LEVEL)/Makefile.common
24+
include $(CLANG_LEVEL)/Makefile
2525

clang/lib/Driver/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#
88
##===----------------------------------------------------------------------===##
99

10-
LEVEL = ../../../..
10+
CLANG_LEVEL := ../..
1111
LIBRARYNAME := clangDriver
1212
BUILD_ARCHIVE = 1
1313

1414
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
1515

16-
include $(LEVEL)/Makefile.common
16+
include $(CLANG_LEVEL)/Makefile

clang/lib/Frontend/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#
88
##===----------------------------------------------------------------------===##
99

10-
LEVEL = ../../../..
10+
CLANG_LEVEL := ../..
1111
LIBRARYNAME := clangFrontend
1212
BUILD_ARCHIVE = 1
1313

1414
CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
1515

16-
include $(LEVEL)/Makefile.common
16+
include $(CLANG_LEVEL)/Makefile
1717

clang/lib/Headers/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#
88
##===----------------------------------------------------------------------===##
99

10-
LEVEL = ../../../..
10+
CLANG_LEVEL := ../..
1111

1212
BUILT_SOURCES = arm_neon.h.inc
1313
TABLEGEN_INC_FILES_COMMON = 1
1414

15-
include $(LEVEL)/Makefile.common
15+
include $(CLANG_LEVEL)/Makefile
1616

1717
CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER)
1818

@@ -30,7 +30,7 @@ $(OBJHEADERS): $(HeaderDir)/%.h: $(PROJ_SRC_DIR)/%.h $(HeaderDir)/.dir $(HeaderD
3030
$(HeaderDir)/arm_neon.h: $(BUILT_SOURCES)
3131
$(Verb) cp $< $@
3232
$(Echo) Copying $(notdir $<) to build dir
33-
33+
3434
# Hook into the standard Makefile rules.
3535
all-local:: $(OBJHEADERS)
3636

clang/lib/Index/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#
1212
##===----------------------------------------------------------------------===##
1313

14-
LEVEL = ../../../..
15-
include $(LEVEL)/Makefile.config
14+
CLANG_LEVEL := ../..
15+
include $(CLANG_LEVEL)/../../Makefile.config
1616

1717
LIBRARYNAME := clangIndex
1818
BUILD_ARCHIVE = 1
@@ -23,5 +23,5 @@ endif
2323

2424
CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
2525

26-
include $(LEVEL)/Makefile.common
26+
include $(CLANG_LEVEL)/Makefile
2727

clang/lib/Lex/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#
1212
##===----------------------------------------------------------------------===##
1313

14-
LEVEL = ../../../..
15-
include $(LEVEL)/Makefile.config
14+
CLANG_LEVEL := ../..
15+
include $(CLANG_LEVEL)/../../Makefile.config
1616

1717
LIBRARYNAME := clangLex
1818
BUILD_ARCHIVE = 1
@@ -23,5 +23,5 @@ endif
2323

2424
CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
2525

26-
include $(LEVEL)/Makefile.common
26+
include $(CLANG_LEVEL)/Makefile
2727

0 commit comments

Comments
 (0)