blob: acb620dddd2054cedfae178b6e45bb17a13866ca [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
Daniel Dunbarafed0992010-06-08 20:34:18 +000026###
27# Common Makefile code, shared by all Clang Makefiles.
28
29# Set LLVM source root level.
30LEVEL := $(CLANG_LEVEL)/../..
31
32# Include LLVM common makefile.
Reid Spencer5f016e22007-07-11 17:01:13 +000033include $(LEVEL)/Makefile.common
34
Daniel Dunbarc4dec1c2010-06-08 20:44:43 +000035# Set common Clang build flags.
36CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include
37ifdef CLANG_VENDOR
38CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
39endif
40
Daniel Dunbarafed0992010-06-08 20:34:18 +000041###
42# Clang Top Level specific stuff.
43
44ifeq ($(IS_TOP_LEVEL),1)
45
Mike Stumpadc981a2009-01-20 21:10:41 +000046ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
Daniel Dunbara9829ae2009-12-21 23:28:06 +000047$(RecursiveTargets)::
Mike Stumpadc981a2009-01-20 21:10:41 +000048 $(Verb) if [ ! -f test/Makefile ]; then \
49 $(MKDIR) test; \
50 $(CP) $(PROJ_SRC_DIR)/test/Makefile test/Makefile; \
51 fi
52endif
53
Reid Spencer5f016e22007-07-11 17:01:13 +000054test::
Kovarththanan Rajaratnam61736b42010-03-18 13:56:20 +000055 @ $(MAKE) -C test
Gabor Greifab72ffe2008-03-18 06:14:16 +000056
57report::
Chris Lattner9d294b92008-04-06 22:32:01 +000058 @ $(MAKE) -C test report
Reid Spencer5f016e22007-07-11 17:01:13 +000059
60clean::
Chris Lattner9d294b92008-04-06 22:32:01 +000061 @ $(MAKE) -C test clean
Gabor Greif5267d7c2008-03-20 14:28:22 +000062
Mike Stump8ba82b32009-02-12 02:25:47 +000063tags::
Kovarththanan Rajaratnam61736b42010-03-18 13:56:20 +000064 $(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
65 grep -v /lib/Headers | grep -v /test/`
Mike Stump8ba82b32009-02-12 02:25:47 +000066
Daniel Dunbar432eeec2009-03-18 05:59:14 +000067cscope.files:
Daniel Dunbar073777f2009-03-24 03:00:12 +000068 find tools lib include -name '*.cpp' \
Daniel Dunbar432eeec2009-03-18 05:59:14 +000069 -or -name '*.def' \
70 -or -name '*.td' \
71 -or -name '*.h' > cscope.files
72
73.PHONY: test report clean cscope.files
Daniel Dunbarafed0992010-06-08 20:34:18 +000074
75endif