1# 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
11CFLAGS := -std=gnu99 -Wall -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR)/include $(CFLAGS)
12
13export CFLAGS
14
15SUB_DIRS = alignment		\
16	   benchmarks		\
17	   copyloops		\
18	   context_switch	\
19	   dscr			\
20	   mm			\
21	   pmu			\
22	   signal		\
23	   primitives		\
24	   stringloops		\
25	   switch_endian	\
26	   syscalls		\
27	   tm			\
28	   vphn         \
29	   math		\
30	   ptrace
31
32endif
33
34all: $(SUB_DIRS)
35
36$(SUB_DIRS):
37	$(MAKE) -k -C $@ all
38
39include ../lib.mk
40
41override define RUN_TESTS
42	@for TARGET in $(SUB_DIRS); do \
43		$(MAKE) -C $$TARGET run_tests; \
44	done;
45endef
46
47override define INSTALL_RULE
48	@for TARGET in $(SUB_DIRS); do \
49		$(MAKE) -C $$TARGET install; \
50	done;
51endef
52
53override define EMIT_TESTS
54	@for TARGET in $(SUB_DIRS); do \
55		$(MAKE) -s -C $$TARGET emit_tests; \
56	done;
57endef
58
59clean:
60	@for TARGET in $(SUB_DIRS); do \
61		$(MAKE) -C $$TARGET clean; \
62	done;
63	rm -f tags
64
65tags:
66	find . -name '*.c' -o -name '*.h' | xargs ctags
67
68.PHONY: tags $(SUB_DIRS)
69