10e56dacdSMichael Ellerman# Makefile for powerpc selftests
20e56dacdSMichael Ellerman
30e56dacdSMichael Ellerman# ARCH can be overridden by the user for cross compiling
40e56dacdSMichael EllermanARCH ?= $(shell uname -m)
50e56dacdSMichael EllermanARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
60e56dacdSMichael Ellerman
70e56dacdSMichael Ellermanifeq ($(ARCH),powerpc)
80e56dacdSMichael Ellerman
90e56dacdSMichael EllermanGIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
100e56dacdSMichael Ellerman
110e56dacdSMichael EllermanCFLAGS := -Wall -O2 -flto -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR) $(CFLAGS)
120e56dacdSMichael Ellerman
1384f887bfSMichael Ellermanexport CFLAGS
140e56dacdSMichael Ellerman
15*4cd968efSMichael EllermanSUB_DIRS = pmu copyloops mm tm primitives stringloops vphn switch_endian
160e56dacdSMichael Ellerman
170e56dacdSMichael Ellermanendif
180e56dacdSMichael Ellerman
19a908f5deSMichael Ellermanall: $(SUB_DIRS)
20cbfd7dabSMichael Ellerman
21a908f5deSMichael Ellerman$(SUB_DIRS):
22cbfd7dabSMichael Ellerman	$(MAKE) -k -C $@ all
230e56dacdSMichael Ellerman
246faeeea4SMichael Ellermaninclude ../lib.mk
256faeeea4SMichael Ellerman
266faeeea4SMichael Ellermanoverride define RUN_TESTS
27a908f5deSMichael Ellerman	@for TARGET in $(SUB_DIRS); do \
280e56dacdSMichael Ellerman		$(MAKE) -C $$TARGET run_tests; \
290e56dacdSMichael Ellerman	done;
306faeeea4SMichael Ellermanendef
316faeeea4SMichael Ellerman
326faeeea4SMichael Ellermanoverride define INSTALL_RULE
33d19d5efdSLinus Torvalds	@for TARGET in $(SUB_DIRS); do \
346faeeea4SMichael Ellerman		$(MAKE) -C $$TARGET install; \
356faeeea4SMichael Ellerman	done;
366faeeea4SMichael Ellermanendef
376faeeea4SMichael Ellerman
386faeeea4SMichael Ellermanoverride define EMIT_TESTS
39d19d5efdSLinus Torvalds	@for TARGET in $(SUB_DIRS); do \
406faeeea4SMichael Ellerman		$(MAKE) -s -C $$TARGET emit_tests; \
416faeeea4SMichael Ellerman	done;
426faeeea4SMichael Ellermanendef
430e56dacdSMichael Ellerman
440e56dacdSMichael Ellermanclean:
45a908f5deSMichael Ellerman	@for TARGET in $(SUB_DIRS); do \
460e56dacdSMichael Ellerman		$(MAKE) -C $$TARGET clean; \
470e56dacdSMichael Ellerman	done;
480e56dacdSMichael Ellerman	rm -f tags
490e56dacdSMichael Ellerman
500e56dacdSMichael Ellermantags:
510e56dacdSMichael Ellerman	find . -name '*.c' -o -name '*.h' | xargs ctags
520e56dacdSMichael Ellerman
53d19d5efdSLinus Torvalds.PHONY: tags $(SUB_DIRS)
54