Fix miscompilation regarding VLAs; subscription of VLA pointers was incorrect.
[clang.git] / Makefile
blobf871c25274ed4e80c416c2d85ae2a55e31c646c1
1 ##===- Makefile --------------------------------------------*- Makefile -*-===##
3 # The LLVM Compiler Infrastructure
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
8 ##===----------------------------------------------------------------------===##
10 # If CLANG_LEVEL is not set, then we are the top-level Makefile. Otherwise, we
11 # are being included from a subdirectory makefile.
13 ifndef CLANG_LEVEL
15 IS_TOP_LEVEL := 1
16 CLANG_LEVEL := .
17 DIRS := include lib tools runtime docs
19 PARALLEL_DIRS :=
21 ifeq ($(BUILD_EXAMPLES),1)
22 PARALLEL_DIRS += examples
23 endif
24 endif
26 ifeq ($(MAKECMDGOALS),libs-only)
27 DIRS := $(filter-out tools docs, $(DIRS))
28 OPTIONAL_DIRS :=
29 endif
31 ###
32 # Common Makefile code, shared by all Clang Makefiles.
34 # Set LLVM source root level.
35 LEVEL := $(CLANG_LEVEL)/../..
37 # Include LLVM common makefile.
38 include $(LEVEL)/Makefile.common
40 # Set common Clang build flags.
41 CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include
42 ifdef CLANG_VENDOR
43 CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
44 endif
46 # Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
47 # work with it enabled with GCC), Clang/llvm-gc don't support it yet, and newer
48 # GCC's have false positive warnings with it on Linux (which prove a pain to
49 # fix). For example:
50 # http://gcc.gnu.org/PR41874
51 # http://gcc.gnu.org/PR41838
53 # We can revisit this when LLVM/Clang support it.
54 CXX.Flags += -fno-strict-aliasing
56 ###
57 # Clang Top Level specific stuff.
59 ifeq ($(IS_TOP_LEVEL),1)
61 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
62 $(RecursiveTargets)::
63 $(Verb) if [ ! -f test/Makefile ]; then \
64 $(MKDIR) test; \
65 $(CP) $(PROJ_SRC_DIR)/test/Makefile test/Makefile; \
67 endif
69 test::
70 @ $(MAKE) -C test
72 report::
73 @ $(MAKE) -C test report
75 clean::
76 @ $(MAKE) -C test clean
78 libs-only: all
80 tags::
81 $(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
82 grep -v /lib/Headers | grep -v /test/`
84 cscope.files:
85 find tools lib include -name '*.cpp' \
86 -or -name '*.def' \
87 -or -name '*.td' \
88 -or -name '*.h' > cscope.files
90 .PHONY: test report clean cscope.files
92 endif