blob: 1c5d0575802e47113b49b4b0facfd7bff47a6620 [file] [log] [blame]
Michael Ellerman0e56dac2013-08-06 17:42:35 +10001# Makefile for powerpc selftests
2
3# ARCH can be overridden by the user for cross compiling
4ARCH ?= $(shell uname -m)
5ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
6
7ifeq ($(ARCH),powerpc)
8
9GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
10
Simon Guo15ec3992016-09-30 10:32:51 +080011CFLAGS := -std=gnu99 -Wall -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR)/include $(CFLAGS)
Michael Ellerman0e56dac2013-08-06 17:42:35 +100012
Michael Ellerman84f887b2015-03-04 21:41:31 +110013export CFLAGS
Michael Ellerman0e56dac2013-08-06 17:42:35 +100014
Chris Smart43750882016-06-17 09:34:47 +100015SUB_DIRS = alignment \
16 benchmarks \
Michael Ellerman65b6ba62015-10-14 20:50:35 +110017 copyloops \
Chris Smart438517e2016-05-02 13:51:38 +100018 context_switch \
Michael Ellerman65b6ba62015-10-14 20:50:35 +110019 dscr \
20 mm \
21 pmu \
Cyril Buref186332016-09-23 16:18:19 +100022 signal \
Michael Ellerman65b6ba62015-10-14 20:50:35 +110023 primitives \
24 stringloops \
25 switch_endian \
26 syscalls \
27 tm \
Cyril Bur01127f12016-02-29 17:53:43 +110028 vphn \
Anshuman Khandualf666ad42016-09-30 10:32:52 +080029 math \
30 ptrace
Michael Ellerman0e56dac2013-08-06 17:42:35 +100031
32endif
33
Michael Ellermana908f5d2015-03-18 12:02:41 +110034all: $(SUB_DIRS)
Michael Ellermancbfd7da2014-07-23 17:31:31 +100035
Michael Ellermana908f5d2015-03-18 12:02:41 +110036$(SUB_DIRS):
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080037 BUILD_TARGET=$$OUTPUT/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all
Michael Ellerman0e56dac2013-08-06 17:42:35 +100038
Michael Ellerman6faeeea2015-03-11 15:06:01 +110039include ../lib.mk
40
41override define RUN_TESTS
Michael Ellermana908f5d2015-03-18 12:02:41 +110042 @for TARGET in $(SUB_DIRS); do \
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080043 BUILD_TARGET=$$OUTPUT/$$TARGET; \
44 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
Michael Ellerman0e56dac2013-08-06 17:42:35 +100045 done;
Michael Ellerman6faeeea2015-03-11 15:06:01 +110046endef
47
48override define INSTALL_RULE
Linus Torvaldsd19d5ef2015-04-16 13:53:32 -050049 @for TARGET in $(SUB_DIRS); do \
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080050 BUILD_TARGET=$$OUTPUT/$$TARGET; \
51 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install;\
Michael Ellerman6faeeea2015-03-11 15:06:01 +110052 done;
53endef
54
55override define EMIT_TESTS
Linus Torvaldsd19d5ef2015-04-16 13:53:32 -050056 @for TARGET in $(SUB_DIRS); do \
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080057 BUILD_TARGET=$$OUTPUT/$$TARGET; \
58 $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\
Michael Ellerman6faeeea2015-03-11 15:06:01 +110059 done;
60endef
Michael Ellerman0e56dac2013-08-06 17:42:35 +100061
62clean:
Michael Ellermana908f5d2015-03-18 12:02:41 +110063 @for TARGET in $(SUB_DIRS); do \
bamvor.zhangjian@huawei.coma8ba7982016-11-29 19:55:52 +080064 BUILD_TARGET=$$OUTPUT/$$TARGET; \
Michael Ellerman2e8ec872017-02-09 19:56:29 +110065 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
66 done;
Michael Ellerman0e56dac2013-08-06 17:42:35 +100067 rm -f tags
68
69tags:
70 find . -name '*.c' -o -name '*.h' | xargs ctags
71
Linus Torvaldsd19d5ef2015-04-16 13:53:32 -050072.PHONY: tags $(SUB_DIRS)