• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This mimics the top-level Makefile. We do it explicitly here so that this
2# Makefile can operate with or without the kbuild infrastructure.
3ifneq ($(LLVM),)
4CC := clang
5else
6CC := $(CROSS_COMPILE)gcc
7endif
8
9define RUN_TESTS
10	@for TEST in $(TEST_PROGS); do \
11		(./$$TEST && echo "selftests: $$TEST [PASS]") || echo "selftests: $$TEST [FAIL]"; \
12	done;
13endef
14
15run_tests: all
16	$(RUN_TESTS)
17
18define INSTALL_RULE
19	@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then					\
20		mkdir -p ${INSTALL_PATH};										\
21		echo "rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/";	\
22		rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/;		\
23	fi
24endef
25
26install: all
27ifdef INSTALL_PATH
28	$(INSTALL_RULE)
29else
30	$(error Error: set INSTALL_PATH to use install)
31endif
32
33define EMIT_TESTS
34	@for TEST in $(TEST_PROGS); do \
35		echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo \"selftests: $$TEST [FAIL]\""; \
36	done;
37endef
38
39emit_tests:
40	$(EMIT_TESTS)
41
42.PHONY: run_tests all clean install emit_tests
43