blob: 5bb50c622afd826332714c289ea9cfcf33751956 [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
Chris Lattner986f3492010-05-15 16:56:34 +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
Daniel Dunbar58033312009-09-10 23:00:15 +000032all:: 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..."
41 @sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
42 -e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
Daniel Dunbar7af18d32009-09-17 19:55:53 +000043 -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
Daniel Dunbar9e10cc72009-09-26 07:36:09 +000044 -e "s#@LLVM_LIBS_DIR@#$(LibDir)#g" \
Daniel Dunbar1b720a92009-09-20 19:04:35 +000045 -e "s#@CLANG_SOURCE_DIR@#$(PROJ_SRC_DIR)/..#g" \
46 -e "s#@CLANG_BINARY_DIR@#$(PROJ_OBJ_DIR)/..#g" \
Daniel Dunbare9a73232009-11-03 07:25:53 +000047 -e "s#@TARGET_TRIPLE@#$(TARGET_TRIPLE)#g" \
Daniel Dunbar7af18d32009-09-17 19:55:53 +000048 $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
Daniel Dunbar58033312009-09-10 23:00:15 +000049
Gabor Greif17feadf2008-03-18 07:03:00 +000050clean::
Nuno Lopesf758dc02009-11-03 22:39:56 +000051 @ find . -name Output | xargs rm -fr
Gabor Greif17feadf2008-03-18 07:03:00 +000052
Chris Lattner9d294b92008-04-06 22:32:01 +000053.PHONY: all report clean