Daniel Dunbar | afed099 | 2010-06-08 20:34:18 +0000 | [diff] [blame] | 1 | CLANG_LEVEL := .. |
| 2 | include $(CLANG_LEVEL)/Makefile |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3 | |
Daniel Dunbar | 0126e5e | 2009-07-12 19:00:20 +0000 | [diff] [blame] | 4 | # Test in all immediate subdirectories if unset. |
Daniel Dunbar | 2f42d4a | 2009-09-04 17:40:27 +0000 | [diff] [blame] | 5 | ifdef TESTSUITE |
| 6 | TESTDIRS := $(TESTSUITE:%=$(PROJ_SRC_DIR)/%) |
| 7 | else |
Daniel Dunbar | 10aebbb | 2009-07-25 15:26:08 +0000 | [diff] [blame] | 8 | TESTDIRS ?= $(PROJ_SRC_DIR) |
Daniel Dunbar | 2f42d4a | 2009-09-04 17:40:27 +0000 | [diff] [blame] | 9 | endif |
Chris Lattner | 15bd799 | 2008-03-10 19:32:31 +0000 | [diff] [blame] | 10 | |
Daniel Dunbar | 5e01e3c | 2009-09-22 05:16:02 +0000 | [diff] [blame] | 11 | # 'lit' wants objdir paths, so it will pick up the lit.site.cfg. |
| 12 | TESTDIRS := $(TESTDIRS:$(PROJ_SRC_DIR)%=$(PROJ_OBJ_DIR)%) |
Daniel Dunbar | 5803331 | 2009-09-10 23:00:15 +0000 | [diff] [blame] | 13 | |
Daniel Dunbar | 6516813 | 2009-11-05 06:55:24 +0000 | [diff] [blame] | 14 | # Allow EXTRA_TESTDIRS to provide additional test directories. |
| 15 | TESTDIRS += $(EXTRA_TESTDIRS) |
| 16 | |
Daniel Dunbar | d5134b0 | 2009-06-13 18:28:48 +0000 | [diff] [blame] | 17 | ifndef TESTARGS |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 18 | ifdef VERBOSE |
Chris Lattner | 984ec48 | 2010-05-12 02:47:23 +0000 | [diff] [blame] | 19 | TESTARGS = -v |
Mike Stump | 039df91 | 2009-03-13 00:21:49 +0000 | [diff] [blame] | 20 | else |
Andrew Trick | 62c3711 | 2011-06-16 01:32:21 +0000 | [diff] [blame] | 21 | TESTARGS = -s -v |
Mike Stump | 9a2f1ac | 2009-03-18 20:25:18 +0000 | [diff] [blame] | 22 | endif |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 23 | endif |
| 24 | |
Daniel Dunbar | b258d8f | 2009-11-05 16:36:19 +0000 | [diff] [blame] | 25 | # Make sure any extra test suites can find the main site config. |
| 26 | LIT_ARGS := --param clang_site_config=$(PROJ_OBJ_DIR)/lit.site.cfg |
| 27 | |
Nuno Lopes | a7afc45 | 2009-07-11 18:34:43 +0000 | [diff] [blame] | 28 | ifdef VG |
Daniel Dunbar | b258d8f | 2009-11-05 16:36:19 +0000 | [diff] [blame] | 29 | LIT_ARGS += "--vg" |
Nuno Lopes | a7afc45 | 2009-07-11 18:34:43 +0000 | [diff] [blame] | 30 | endif |
| 31 | |
Jeffrey Yasskin | 7a17889 | 2011-02-03 04:51:52 +0000 | [diff] [blame] | 32 | all:: lit.site.cfg Unit/lit.site.cfg |
Daniel Dunbar | 724827f | 2009-09-08 16:39:23 +0000 | [diff] [blame] | 33 | @ echo '--- Running clang tests for $(TARGET_TRIPLE) ---' |
Douglas Gregor | b3496c7 | 2009-09-29 14:54:28 +0000 | [diff] [blame] | 34 | @ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py \ |
Daniel Dunbar | b258d8f | 2009-11-05 16:36:19 +0000 | [diff] [blame] | 35 | $(LIT_ARGS) $(TESTARGS) $(TESTDIRS) |
Gabor Greif | 17feadf | 2008-03-18 07:03:00 +0000 | [diff] [blame] | 36 | |
Daniel Dunbar | 5803331 | 2009-09-10 23:00:15 +0000 | [diff] [blame] | 37 | FORCE: |
| 38 | |
| 39 | lit.site.cfg: FORCE |
Daniel Dunbar | 1b720a9 | 2009-09-20 19:04:35 +0000 | [diff] [blame] | 40 | @echo "Making Clang 'lit.site.cfg' file..." |
NAKAMURA Takumi | 41d6d69 | 2011-03-08 22:17:40 +0000 | [diff] [blame] | 41 | @$(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 |
Roman Divacky | 2450b82 | 2013-08-27 19:27:35 +0000 | [diff] [blame] | 48 | @$(ECHOPATH) s=@ENABLE_CLANG_ARCMT@=$(ENABLE_CLANG_ARCMT)=g >> lit.tmp |
| 49 | @$(ECHOPATH) s=@ENABLE_CLANG_REWRITER@=$(ENABLE_CLANG_REWRITER)=g >> lit.tmp |
| 50 | @$(ECHOPATH) s=@ENABLE_CLANG_STATIC_ANALYZER@=$(ENABLE_CLANG_STATIC_ANALYZER)=g >> lit.tmp |
NAKAMURA Takumi | 41d6d69 | 2011-03-08 22:17:40 +0000 | [diff] [blame] | 51 | @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ |
| 52 | @-rm -f lit.tmp |
Daniel Dunbar | 5803331 | 2009-09-10 23:00:15 +0000 | [diff] [blame] | 53 | |
Jeffrey Yasskin | 7a17889 | 2011-02-03 04:51:52 +0000 | [diff] [blame] | 54 | Unit/lit.site.cfg: FORCE |
| 55 | @echo "Making Clang 'Unit/lit.site.cfg' file..." |
| 56 | @$(MKDIR) $(dir $@) |
NAKAMURA Takumi | 41d6d69 | 2011-03-08 22:17:40 +0000 | [diff] [blame] | 57 | @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > unit.tmp |
| 58 | @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> unit.tmp |
| 59 | @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> unit.tmp |
| 60 | @$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> unit.tmp |
| 61 | @$(ECHOPATH) s=@CLANG_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> unit.tmp |
| 62 | @$(ECHOPATH) s=@CLANG_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> unit.tmp |
| 63 | @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> unit.tmp |
| 64 | @$(ECHOPATH) s=@LLVM_BUILD_MODE@=$(BuildMode)=g >> unit.tmp |
| 65 | @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> unit.tmp |
| 66 | @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> unit.tmp |
| 67 | @$(ECHOPATH) s=@SHLIBPATH_VAR@=$(SHLIBPATH_VAR)=g >> unit.tmp |
| 68 | @sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@ |
| 69 | @-rm -f unit.tmp |
Jeffrey Yasskin | 7a17889 | 2011-02-03 04:51:52 +0000 | [diff] [blame] | 70 | |
Gabor Greif | 17feadf | 2008-03-18 07:03:00 +0000 | [diff] [blame] | 71 | clean:: |
Nuno Lopes | f758dc0 | 2009-11-03 22:39:56 +0000 | [diff] [blame] | 72 | @ find . -name Output | xargs rm -fr |
Gabor Greif | 17feadf | 2008-03-18 07:03:00 +0000 | [diff] [blame] | 73 | |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 74 | .PHONY: all report clean |