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