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