Makefile (1673B)
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 papr_attributes \ 34 ptrace \ 35 security \ 36 mce 37 38endif 39 40all: $(SUB_DIRS) 41 42$(SUB_DIRS): 43 BUILD_TARGET=$(OUTPUT)/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all 44 45include ../lib.mk 46 47override define RUN_TESTS 48 @for TARGET in $(SUB_DIRS); do \ 49 BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 50 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\ 51 done; 52endef 53 54override define INSTALL_RULE 55 @for TARGET in $(SUB_DIRS); do \ 56 BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 57 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install;\ 58 done; 59endef 60 61override define EMIT_TESTS 62 @for TARGET in $(SUB_DIRS); do \ 63 BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 64 $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\ 65 done; 66endef 67 68override define CLEAN 69 @for TARGET in $(SUB_DIRS); do \ 70 BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 71 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \ 72 done; 73 rm -f tags 74endef 75 76tags: 77 find . -name '*.c' -o -name '*.h' | xargs ctags 78 79.PHONY: tags $(SUB_DIRS)