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