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