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