1CLANG_LEVEL := .. 2include $(CLANG_LEVEL)/Makefile 3 4# Test in all immediate subdirectories if unset. 5ifdef TESTSUITE 6TESTDIRS := $(TESTSUITE:%=$(PROJ_SRC_DIR)/%) 7else 8TESTDIRS ?= $(PROJ_SRC_DIR) 9endif 10 11# 'lit' wants objdir paths, so it will pick up the lit.site.cfg. 12TESTDIRS := $(TESTDIRS:$(PROJ_SRC_DIR)%=$(PROJ_OBJ_DIR)%) 13 14# Allow EXTRA_TESTDIRS to provide additional test directories. 15TESTDIRS += $(EXTRA_TESTDIRS) 16 17ifndef TESTARGS 18ifdef VERBOSE 19TESTARGS = -v 20else 21TESTARGS = -s -v 22endif 23endif 24 25# 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 28ifdef VG 29 LIT_ARGS += "--vg" 30endif 31 32all:: lit.site.cfg Unit/lit.site.cfg 33 @ echo '--- Running clang tests for $(TARGET_TRIPLE) ---' 34 @ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py \ 35 $(LIT_ARGS) $(TESTARGS) $(TESTDIRS) 36 37FORCE: 38 39lit.site.cfg: FORCE 40 @echo "Making Clang 'lit.site.cfg' file..." 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=@CLANG_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp 48 @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp 49 @$(ECHOPATH) s=@LLVM_HOST_TRIPLE@=$(HOST_TRIPLE)=g >> lit.tmp 50 @$(ECHOPATH) s=@ENABLE_CLANG_ARCMT@=$(ENABLE_CLANG_ARCMT)=g >> lit.tmp 51 @$(ECHOPATH) s=@ENABLE_CLANG_STATIC_ANALYZER@=$(ENABLE_CLANG_STATIC_ANALYZER)=g >> lit.tmp 52 @$(ECHOPATH) s=@ENABLE_CLANG_EXAMPLES@=$(ENABLE_CLANG_EXAMPLES)=g >> lit.tmp 53 @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp 54 @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ 55 @-rm -f lit.tmp 56 57Unit/lit.site.cfg: FORCE 58 @echo "Making Clang 'Unit/lit.site.cfg' file..." 59 @$(MKDIR) $(dir $@) 60 @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > unit.tmp 61 @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> unit.tmp 62 @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> unit.tmp 63 @$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> unit.tmp 64 @$(ECHOPATH) s=@CLANG_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> unit.tmp 65 @$(ECHOPATH) s=@CLANG_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> unit.tmp 66 @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> unit.tmp 67 @$(ECHOPATH) s=@LLVM_BUILD_MODE@=$(BuildMode)=g >> unit.tmp 68 @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> unit.tmp 69 @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> unit.tmp 70 @$(ECHOPATH) s=@SHLIBPATH_VAR@=$(SHLIBPATH_VAR)=g >> unit.tmp 71 @sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@ 72 @-rm -f unit.tmp 73 74clean:: 75 @ find . -name Output | xargs rm -fr 76 77.PHONY: all report clean 78