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