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