blob: 2194155ae62a0f1cf4500b60dc58c4ec3a93a3ce [file] [log] [blame]
Michael Ellerman84f887b2015-03-04 21:41:31 +11001# This mimics the top-level Makefile. We do it explicitly here so that this
2# Makefile can operate with or without the kbuild infrastructure.
3CC := $(CROSS_COMPILE)gcc
4
Michael Ellerman5e29a912015-03-11 15:05:59 +11005define RUN_TESTS
6 @for TEST in $(TEST_PROGS); do \
7 (./$$TEST && echo "selftests: $$TEST [PASS]") || echo "selftests: $$TEST [FAIL]"; \
8 done;
9endef
10
11run_tests: all
12 $(RUN_TESTS)
13
Michael Ellerman32dcfba2015-03-11 15:06:00 +110014define INSTALL_RULE
15 mkdir -p $(INSTALL_PATH)
Michael Ellerman5744de52015-03-19 11:20:40 +110016 install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
Michael Ellerman32dcfba2015-03-11 15:06:00 +110017endef
18
19install: all
20ifdef INSTALL_PATH
21 $(INSTALL_RULE)
22else
23 $(error Error: set INSTALL_PATH to use install)
24endif
25
26define EMIT_TESTS
27 @for TEST in $(TEST_PROGS); do \
28 echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo \"selftests: $$TEST [FAIL]\""; \
29 done;
30endef
31
32emit_tests:
33 $(EMIT_TESTS)
34
35.PHONY: run_tests all clean install emit_tests