2010-06-09 04:34:18 +08:00
|
|
|
##===- 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 := .
|
2011-10-06 21:03:08 +08:00
|
|
|
DIRS := utils/TableGen include lib tools runtime docs unittests
|
2006-06-18 13:43:12 +08:00
|
|
|
|
2009-11-15 08:22:33 +08:00
|
|
|
PARALLEL_DIRS :=
|
|
|
|
|
|
|
|
ifeq ($(BUILD_EXAMPLES),1)
|
|
|
|
PARALLEL_DIRS += examples
|
|
|
|
endif
|
2010-06-09 04:34:18 +08:00
|
|
|
endif
|
|
|
|
|
2010-06-19 14:35:25 +08:00
|
|
|
ifeq ($(MAKECMDGOALS),libs-only)
|
|
|
|
DIRS := $(filter-out tools docs, $(DIRS))
|
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
endif
|
|
|
|
|
2010-06-09 04:34:18 +08:00
|
|
|
###
|
|
|
|
# Common Makefile code, shared by all Clang Makefiles.
|
2009-11-15 08:22:33 +08:00
|
|
|
|
2010-06-09 04:34:18 +08:00
|
|
|
# Set LLVM source root level.
|
|
|
|
LEVEL := $(CLANG_LEVEL)/../..
|
|
|
|
|
|
|
|
# Include LLVM common makefile.
|
2006-06-18 13:43:12 +08:00
|
|
|
include $(LEVEL)/Makefile.common
|
2006-11-21 13:01:56 +08:00
|
|
|
|
2010-11-14 11:29:27 +08:00
|
|
|
ifneq ($(ENABLE_DOCS),1)
|
|
|
|
DIRS := $(filter-out docs, $(DIRS))
|
|
|
|
endif
|
|
|
|
|
2010-06-09 04:44:43 +08:00
|
|
|
# Set common Clang build flags.
|
|
|
|
CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include
|
|
|
|
ifdef CLANG_VENDOR
|
|
|
|
CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
|
|
|
|
endif
|
2011-03-31 08:32:50 +08:00
|
|
|
ifdef CLANG_REPOSITORY_STRING
|
|
|
|
CPP.Flags += -DCLANG_REPOSITORY_STRING='"$(CLANG_REPOSITORY_STRING)"'
|
|
|
|
endif
|
2010-06-09 04:44:43 +08:00
|
|
|
|
2010-06-09 05:55:02 +08:00
|
|
|
# Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
|
2011-01-08 06:44:49 +08:00
|
|
|
# work with it enabled with GCC), Clang/llvm-gcc don't support it yet, and newer
|
2010-06-09 05:55:02 +08:00
|
|
|
# GCC's have false positive warnings with it on Linux (which prove a pain to
|
|
|
|
# fix). For example:
|
|
|
|
# http://gcc.gnu.org/PR41874
|
|
|
|
# http://gcc.gnu.org/PR41838
|
|
|
|
#
|
|
|
|
# We can revisit this when LLVM/Clang support it.
|
|
|
|
CXX.Flags += -fno-strict-aliasing
|
|
|
|
|
2011-10-06 09:52:10 +08:00
|
|
|
# Set up Clang's tblgen.
|
|
|
|
ifndef CLANG_TBLGEN
|
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
2011-10-06 21:03:08 +08:00
|
|
|
CLANG_TBLGEN := $(BuildLLVMToolDir)/clang-tblgen$(BUILD_EXEEXT)
|
2011-10-06 09:52:10 +08:00
|
|
|
else
|
2011-10-06 21:03:08 +08:00
|
|
|
CLANG_TBLGEN := $(LLVMToolDir)/clang-tblgen$(EXEEXT)
|
2011-10-06 09:52:10 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ClangTableGen = $(CLANG_TBLGEN) $(TableGen.Flags)
|
|
|
|
|
2010-06-09 04:34:18 +08:00
|
|
|
###
|
|
|
|
# Clang Top Level specific stuff.
|
|
|
|
|
|
|
|
ifeq ($(IS_TOP_LEVEL),1)
|
|
|
|
|
2009-01-21 05:10:41 +08:00
|
|
|
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
|
2009-12-22 07:28:06 +08:00
|
|
|
$(RecursiveTargets)::
|
2011-02-03 12:51:52 +08:00
|
|
|
$(Verb) for dir in test unittests; do \
|
2011-09-28 05:28:10 +08:00
|
|
|
if [ -f $(PROJ_SRC_DIR)/$${dir}/Makefile ] && [ ! -f $${dir}/Makefile ]; then \
|
2011-02-03 12:51:52 +08:00
|
|
|
$(MKDIR) $${dir}; \
|
|
|
|
$(CP) $(PROJ_SRC_DIR)/$${dir}/Makefile $${dir}/Makefile; \
|
|
|
|
fi \
|
|
|
|
done
|
2009-01-21 05:10:41 +08:00
|
|
|
endif
|
|
|
|
|
2006-11-21 13:01:56 +08:00
|
|
|
test::
|
2010-03-18 21:56:20 +08:00
|
|
|
@ $(MAKE) -C test
|
2008-03-18 14:14:16 +08:00
|
|
|
|
|
|
|
report::
|
2008-04-07 06:32:01 +08:00
|
|
|
@ $(MAKE) -C test report
|
2007-01-15 10:06:47 +08:00
|
|
|
|
|
|
|
clean::
|
2008-04-07 06:32:01 +08:00
|
|
|
@ $(MAKE) -C test clean
|
2010-06-26 01:33:46 +08:00
|
|
|
|
2010-06-19 14:35:25 +08:00
|
|
|
libs-only: all
|
2008-03-20 22:28:22 +08:00
|
|
|
|
2009-02-12 10:25:47 +08:00
|
|
|
tags::
|
2010-03-18 21:56:20 +08:00
|
|
|
$(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
|
|
|
|
grep -v /lib/Headers | grep -v /test/`
|
2009-02-12 10:25:47 +08:00
|
|
|
|
2009-03-18 13:59:14 +08:00
|
|
|
cscope.files:
|
2009-03-24 11:00:12 +08:00
|
|
|
find tools lib include -name '*.cpp' \
|
2009-03-18 13:59:14 +08:00
|
|
|
-or -name '*.def' \
|
|
|
|
-or -name '*.td' \
|
|
|
|
-or -name '*.h' > cscope.files
|
|
|
|
|
|
|
|
.PHONY: test report clean cscope.files
|
2010-06-09 04:34:18 +08:00
|
|
|
|
|
|
|
endif
|