-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 :=
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 \
-or -name '*.h' > cscope.files
.PHONY: test report clean cscope.files
+
+endif
#
##===----------------------------------------------------------------------===##
-LEVEL := ../../..
+CLANG_LEVEL := ..
DIRS := tools
ifdef BUILD_FOR_WEBSITE
-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)
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)
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../..
+CLANG_LEVEL := ..
PARALLEL_DIRS := clang-interpreter PrintFunctionNames wpa
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
LIBRARYNAME = PrintFunctionNames
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
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
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
TOOLNAME = clang-interpreter
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_COMPONENTS := jit interpreter nativecodegen bitreader bitwriter ipo \
selectiondag asmparser
clangChecker.a clangAnalysis.a clangRewrite.a clangAST.a \
clangParse.a clangLex.a clangBasic.a
-include $(LLVM_SRC_ROOT)/Makefile.rules
+include $(CLANG_LEVEL)/Makefile
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
TOOLNAME = clang-wpa
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_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
-LEVEL = ../../..
+CLANG_LEVEL := ..
DIRS := clang clang-c
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
DIRS :=
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
install-local::
$(Echo) Installing Clang C API include files
-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
-LEVEL = ../../../../..
+CLANG_LEVEL := ../../..
BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \
DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \
TABLEGEN_INC_FILES_COMMON = 1
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td)
-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"
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
DIRS := AST Basic Driver
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
install-local::
$(Echo) Installing Clang include files
#
##===----------------------------------------------------------------------===##
-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
#
##===----------------------------------------------------------------------===##
-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
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
LIBRARYNAME := clangBasic
BUILD_ARCHIVE = 1
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)/../..)
#
##===----------------------------------------------------------------------===##
-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
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
LIBRARYNAME := clangCodeGen
BUILD_ARCHIVE = 1
CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
endif
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
#
##===----------------------------------------------------------------------===##
-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
#
##===----------------------------------------------------------------------===##
-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
#
##===----------------------------------------------------------------------===##
-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)
$(HeaderDir)/arm_neon.h: $(BUILT_SOURCES)
$(Verb) cp $< $@
$(Echo) Copying $(notdir $<) to build dir
-
+
# Hook into the standard Makefile rules.
all-local:: $(OBJHEADERS)
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
-include $(LEVEL)/Makefile.config
+CLANG_LEVEL := ../..
+include $(CLANG_LEVEL)/../../Makefile.config
LIBRARYNAME := clangIndex
BUILD_ARCHIVE = 1
CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
-include $(LEVEL)/Makefile.config
+CLANG_LEVEL := ../..
+include $(CLANG_LEVEL)/../../Makefile.config
LIBRARYNAME := clangLex
BUILD_ARCHIVE = 1
CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
-include $(LEVEL)/Makefile.common
+include $(CLANG_LEVEL)/Makefile
# 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
#
##===----------------------------------------------------------------------===##
-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
#
##===----------------------------------------------------------------------===##
-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
#
##===----------------------------------------------------------------------===##
-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)
#
##===----------------------------------------------------------------------===##
-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
-LEVEL = ../../..
-include $(LEVEL)/Makefile.common
+CLANG_LEVEL := ..
+include $(CLANG_LEVEL)/Makefile
# Test in all immediate subdirectories if unset.
ifdef TESTSUITE
#
##===----------------------------------------------------------------------===##
-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
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
TOOLNAME = c-index-test
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
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
TOOLNAME = clang
ifndef CLANG_IS_PRODUCTION
# 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
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
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
+CLANG_LEVEL := ../..
LIBRARYNAME = clang
EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/libclang.exports
# 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
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?