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 13ifndef CLANG_LEVEL 14 15IS_TOP_LEVEL := 1 16CLANG_LEVEL := . 17DIRS := include lib tools runtime docs unittests 18 19PARALLEL_DIRS := 20 21ifeq ($(BUILD_EXAMPLES),1) 22 PARALLEL_DIRS += examples 23endif 24endif 25 26ifeq ($(MAKECMDGOALS),libs-only) 27 DIRS := $(filter-out tools docs, $(DIRS)) 28 OPTIONAL_DIRS := 29endif 30 31### 32# Common Makefile code, shared by all Clang Makefiles. 33 34# Set LLVM source root level. 35LEVEL := $(CLANG_LEVEL)/../.. 36 37# Include LLVM common makefile. 38include $(LEVEL)/Makefile.common 39 40ifneq ($(ENABLE_DOCS),1) 41 DIRS := $(filter-out docs, $(DIRS)) 42endif 43 44# Set common Clang build flags. 45CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include 46ifdef CLANG_VENDOR 47CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "' 48endif 49ifdef CLANG_REPOSITORY_STRING 50CPP.Flags += -DCLANG_REPOSITORY_STRING='"$(CLANG_REPOSITORY_STRING)"' 51endif 52 53# Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't 54# work with it enabled with GCC), Clang/llvm-gcc don't support it yet, and newer 55# GCC's have false positive warnings with it on Linux (which prove a pain to 56# fix). For example: 57# http://gcc.gnu.org/PR41874 58# http://gcc.gnu.org/PR41838 59# 60# We can revisit this when LLVM/Clang support it. 61CXX.Flags += -fno-strict-aliasing 62 63### 64# Clang Top Level specific stuff. 65 66ifeq ($(IS_TOP_LEVEL),1) 67 68ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT)) 69$(RecursiveTargets):: 70 $(Verb) for dir in test unittests; do \ 71 if [ ! -f $${dir}/Makefile ]; then \ 72 $(MKDIR) $${dir}; \ 73 $(CP) $(PROJ_SRC_DIR)/$${dir}/Makefile $${dir}/Makefile; \ 74 fi \ 75 done 76endif 77 78test:: 79 @ $(MAKE) -C test 80 81report:: 82 @ $(MAKE) -C test report 83 84clean:: 85 @ $(MAKE) -C test clean 86 87libs-only: all 88 89tags:: 90 $(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \ 91 grep -v /lib/Headers | grep -v /test/` 92 93cscope.files: 94 find tools lib include -name '*.cpp' \ 95 -or -name '*.def' \ 96 -or -name '*.td' \ 97 -or -name '*.h' > cscope.files 98 99.PHONY: test report clean cscope.files 100 101endif 102