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