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