blob: 4fdafe1481b1c3c591be073eeb906b60e3c18fd8 [file] [log] [blame]
Daniel Dunbarafed0992010-06-08 20:34:18 +00001CLANG_LEVEL := ..
2include $(CLANG_LEVEL)/Makefile
Reid Spencer5f016e22007-07-11 17:01:13 +00003
Daniel Dunbar0126e5e2009-07-12 19:00:20 +00004# Test in all immediate subdirectories if unset.
Daniel Dunbar2f42d4a2009-09-04 17:40:27 +00005ifdef TESTSUITE
6TESTDIRS := $(TESTSUITE:%=$(PROJ_SRC_DIR)/%)
7else
Daniel Dunbar10aebbb2009-07-25 15:26:08 +00008TESTDIRS ?= $(PROJ_SRC_DIR)
Daniel Dunbar2f42d4a2009-09-04 17:40:27 +00009endif
Chris Lattner15bd7992008-03-10 19:32:31 +000010
Daniel Dunbar5e01e3c2009-09-22 05:16:02 +000011# 'lit' wants objdir paths, so it will pick up the lit.site.cfg.
12TESTDIRS := $(TESTDIRS:$(PROJ_SRC_DIR)%=$(PROJ_OBJ_DIR)%)
Daniel Dunbar58033312009-09-10 23:00:15 +000013
Daniel Dunbar65168132009-11-05 06:55:24 +000014# Allow EXTRA_TESTDIRS to provide additional test directories.
15TESTDIRS += $(EXTRA_TESTDIRS)
16
Daniel Dunbard5134b02009-06-13 18:28:48 +000017ifndef TESTARGS
Chris Lattner9d294b92008-04-06 22:32:01 +000018ifdef VERBOSE
Chris Lattner984ec482010-05-12 02:47:23 +000019TESTARGS = -v
Mike Stump039df912009-03-13 00:21:49 +000020else
Andrew Trick62c37112011-06-16 01:32:21 +000021TESTARGS = -s -v
Mike Stump9a2f1ac2009-03-18 20:25:18 +000022endif
Chris Lattner9d294b92008-04-06 22:32:01 +000023endif
24
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000025# Make sure any extra test suites can find the main site config.
26LIT_ARGS := --param clang_site_config=$(PROJ_OBJ_DIR)/lit.site.cfg
27
Nuno Lopesa7afc452009-07-11 18:34:43 +000028ifdef VG
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000029 LIT_ARGS += "--vg"
Nuno Lopesa7afc452009-07-11 18:34:43 +000030endif
31
Jeffrey Yasskin7a178892011-02-03 04:51:52 +000032all:: lit.site.cfg Unit/lit.site.cfg
Daniel Dunbar724827f2009-09-08 16:39:23 +000033 @ echo '--- Running clang tests for $(TARGET_TRIPLE) ---'
Douglas Gregorb3496c72009-09-29 14:54:28 +000034 @ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py \
Daniel Dunbarb258d8f2009-11-05 16:36:19 +000035 $(LIT_ARGS) $(TESTARGS) $(TESTDIRS)
Gabor Greif17feadf2008-03-18 07:03:00 +000036
Daniel Dunbar58033312009-09-10 23:00:15 +000037FORCE:
38
39lit.site.cfg: FORCE
Daniel Dunbar1b720a92009-09-20 19:04:35 +000040 @echo "Making Clang 'lit.site.cfg' file..."
NAKAMURA Takumi41d6d692011-03-08 22:17:40 +000041 @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > lit.tmp
42 @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
43 @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
44 @$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> lit.tmp
45 @$(ECHOPATH) s=@CLANG_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> lit.tmp
46 @$(ECHOPATH) s=@CLANG_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> lit.tmp
47 @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
48 @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
49 @-rm -f lit.tmp
Daniel Dunbar58033312009-09-10 23:00:15 +000050
Jeffrey Yasskin7a178892011-02-03 04:51:52 +000051Unit/lit.site.cfg: FORCE
52 @echo "Making Clang 'Unit/lit.site.cfg' file..."
53 @$(MKDIR) $(dir $@)
NAKAMURA Takumi41d6d692011-03-08 22:17:40 +000054 @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > unit.tmp
55 @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> unit.tmp
56 @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> unit.tmp
57 @$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> unit.tmp
58 @$(ECHOPATH) s=@CLANG_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> unit.tmp
59 @$(ECHOPATH) s=@CLANG_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> unit.tmp
60 @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> unit.tmp
61 @$(ECHOPATH) s=@LLVM_BUILD_MODE@=$(BuildMode)=g >> unit.tmp
62 @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> unit.tmp
63 @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> unit.tmp
64 @$(ECHOPATH) s=@SHLIBPATH_VAR@=$(SHLIBPATH_VAR)=g >> unit.tmp
65 @sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
66 @-rm -f unit.tmp
Jeffrey Yasskin7a178892011-02-03 04:51:52 +000067
Gabor Greif17feadf2008-03-18 07:03:00 +000068clean::
Nuno Lopesf758dc02009-11-03 22:39:56 +000069 @ find . -name Output | xargs rm -fr
Gabor Greif17feadf2008-03-18 07:03:00 +000070
Chris Lattner9d294b92008-04-06 22:32:01 +000071.PHONY: all report clean