blob: 7a14ed2de57c2b28c8bbd9adaab50d17c9100c4e [file] [log] [blame]
Daniel Dunbarafed0992010-06-08 20:34:18 +00001##===- 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 := .
Daniel Dunbar073777f2009-03-24 03:00:12 +000017DIRS := include lib tools docs
Reid Spencer5f016e22007-07-11 17:01:13 +000018
Daniel Dunbar297b0832009-11-15 00:22:33 +000019PARALLEL_DIRS :=
20
21ifeq ($(BUILD_EXAMPLES),1)
22 PARALLEL_DIRS += examples
23endif
Daniel Dunbarafed0992010-06-08 20:34:18 +000024endif
Daniel Dunbar297b0832009-11-15 00:22:33 +000025
Chris Lattnerc56bc312010-06-19 06:35:25 +000026ifeq ($(MAKECMDGOALS),libs-only)
27 DIRS := $(filter-out tools docs, $(DIRS))
28 OPTIONAL_DIRS :=
29endif
30
Daniel Dunbarafed0992010-06-08 20:34:18 +000031###
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.
Reid Spencer5f016e22007-07-11 17:01:13 +000038include $(LEVEL)/Makefile.common
39
Daniel Dunbarc4dec1c2010-06-08 20:44:43 +000040# Set common Clang build flags.
41CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include
42ifdef CLANG_VENDOR
43CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
44endif
Daniel Dunbara5107672010-06-25 17:33:46 +000045ifdef CLANG_VERSION
46CPP.Flags += \
47 -DCLANG_VERSION='"$(CLANG_VERSION)"'
48 -DCLANG_VERSION='"$(CLANG_VERSION)"'
49endif
Daniel Dunbarc4dec1c2010-06-08 20:44:43 +000050
Daniel Dunbar61f69d92010-06-08 21:55:02 +000051# Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
52# work with it enabled with GCC), Clang/llvm-gc don't support it yet, and newer
53# GCC's have false positive warnings with it on Linux (which prove a pain to
54# fix). For example:
55# http://gcc.gnu.org/PR41874
56# http://gcc.gnu.org/PR41838
57#
58# We can revisit this when LLVM/Clang support it.
59CXX.Flags += -fno-strict-aliasing
60
Daniel Dunbarafed0992010-06-08 20:34:18 +000061###
62# Clang Top Level specific stuff.
63
64ifeq ($(IS_TOP_LEVEL),1)
65
Mike Stumpadc981a2009-01-20 21:10:41 +000066ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
Daniel Dunbara9829ae2009-12-21 23:28:06 +000067$(RecursiveTargets)::
Mike Stumpadc981a2009-01-20 21:10:41 +000068 $(Verb) if [ ! -f test/Makefile ]; then \
69 $(MKDIR) test; \
70 $(CP) $(PROJ_SRC_DIR)/test/Makefile test/Makefile; \
71 fi
72endif
73
Reid Spencer5f016e22007-07-11 17:01:13 +000074test::
Kovarththanan Rajaratnam61736b42010-03-18 13:56:20 +000075 @ $(MAKE) -C test
Gabor Greifab72ffe2008-03-18 06:14:16 +000076
77report::
Chris Lattner9d294b92008-04-06 22:32:01 +000078 @ $(MAKE) -C test report
Reid Spencer5f016e22007-07-11 17:01:13 +000079
80clean::
Chris Lattner9d294b92008-04-06 22:32:01 +000081 @ $(MAKE) -C test clean
Daniel Dunbara5107672010-06-25 17:33:46 +000082
Chris Lattnerc56bc312010-06-19 06:35:25 +000083libs-only: all
Gabor Greif5267d7c2008-03-20 14:28:22 +000084
Mike Stump8ba82b32009-02-12 02:25:47 +000085tags::
Kovarththanan Rajaratnam61736b42010-03-18 13:56:20 +000086 $(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
87 grep -v /lib/Headers | grep -v /test/`
Mike Stump8ba82b32009-02-12 02:25:47 +000088
Daniel Dunbar432eeec2009-03-18 05:59:14 +000089cscope.files:
Daniel Dunbar073777f2009-03-24 03:00:12 +000090 find tools lib include -name '*.cpp' \
Daniel Dunbar432eeec2009-03-18 05:59:14 +000091 -or -name '*.def' \
92 -or -name '*.td' \
93 -or -name '*.h' > cscope.files
94
95.PHONY: test report clean cscope.files
Daniel Dunbarafed0992010-06-08 20:34:18 +000096
97endif