xref: /linux/tools/testing/selftests/powerpc/Makefile (revision ae22a94997b8a03dcb3c922857c203246711f9d4)
1# SPDX-License-Identifier: GPL-2.0
2# Makefile for powerpc selftests
3
4# ARCH can be overridden by the user for cross compiling
5ARCH ?= $(shell uname -m)
6ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
7
8ifeq ($(ARCH),powerpc)
9
10GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
11
12CFLAGS := -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR)/include $(CFLAGS)
13
14export CFLAGS
15
16SUB_DIRS = alignment		\
17	   benchmarks		\
18	   cache_shape		\
19	   copyloops		\
20	   dexcr		\
21	   dscr			\
22	   mm			\
23	   nx-gzip		\
24	   pmu			\
25	   signal		\
26	   primitives		\
27	   stringloops		\
28	   switch_endian	\
29	   syscalls		\
30	   tm			\
31	   eeh			\
32	   vphn         \
33	   math		\
34	   papr_attributes	\
35	   papr_vpd		\
36	   papr_sysparm		\
37	   ptrace	\
38	   security	\
39	   mce
40
41endif
42
43all: $(SUB_DIRS)
44
45$(SUB_DIRS):
46	BUILD_TARGET=$(OUTPUT)/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all
47
48include ../lib.mk
49
50override define RUN_TESTS
51	+@for TARGET in $(SUB_DIRS); do \
52		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
53		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
54	done;
55endef
56
57override define INSTALL_RULE
58	+@for TARGET in $(SUB_DIRS); do \
59		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
60		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install;\
61	done;
62endef
63
64emit_tests:
65	+@for TARGET in $(SUB_DIRS); do \
66		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
67		$(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET $@;\
68	done;
69
70override define CLEAN
71	+@for TARGET in $(SUB_DIRS); do \
72		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
73		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
74	done;
75	rm -f tags
76endef
77
78tags:
79	find . -name '*.c' -o -name '*.h' | xargs ctags
80
81.PHONY: tags $(SUB_DIRS) emit_tests
82