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 EllermanCC := $(CROSS_COMPILE)$(CC) 120e56dacdSMichael EllermanCFLAGS := -Wall -O2 -flto -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR) $(CFLAGS) 130e56dacdSMichael Ellerman 140e56dacdSMichael Ellermanexport CC CFLAGS 150e56dacdSMichael Ellerman 16521adf53SAnton BlanchardTARGETS = pmu copyloops mm tm primitives stringloops 170e56dacdSMichael Ellerman 180e56dacdSMichael Ellermanendif 190e56dacdSMichael Ellerman 20cbfd7dabSMichael Ellermanall: $(TARGETS) 21cbfd7dabSMichael Ellerman 22cbfd7dabSMichael Ellerman$(TARGETS): 23cbfd7dabSMichael Ellerman $(MAKE) -k -C $@ all 240e56dacdSMichael Ellerman 25*6faeeea4SMichael Ellermaninclude ../lib.mk 26*6faeeea4SMichael Ellerman 27*6faeeea4SMichael Ellermanoverride define RUN_TESTS 280e56dacdSMichael Ellerman @for TARGET in $(TARGETS); do \ 290e56dacdSMichael Ellerman $(MAKE) -C $$TARGET run_tests; \ 300e56dacdSMichael Ellerman done; 31*6faeeea4SMichael Ellermanendef 32*6faeeea4SMichael Ellerman 33*6faeeea4SMichael Ellermanoverride define INSTALL_RULE 34*6faeeea4SMichael Ellerman @for TARGET in $(TARGETS); do \ 35*6faeeea4SMichael Ellerman $(MAKE) -C $$TARGET install; \ 36*6faeeea4SMichael Ellerman done; 37*6faeeea4SMichael Ellermanendef 38*6faeeea4SMichael Ellerman 39*6faeeea4SMichael Ellermanoverride define EMIT_TESTS 40*6faeeea4SMichael Ellerman @for TARGET in $(TARGETS); do \ 41*6faeeea4SMichael Ellerman $(MAKE) -s -C $$TARGET emit_tests; \ 42*6faeeea4SMichael Ellerman done; 43*6faeeea4SMichael Ellermanendef 440e56dacdSMichael Ellerman 450e56dacdSMichael Ellermanclean: 460e56dacdSMichael Ellerman @for TARGET in $(TARGETS); do \ 470e56dacdSMichael Ellerman $(MAKE) -C $$TARGET clean; \ 480e56dacdSMichael Ellerman done; 490e56dacdSMichael Ellerman rm -f tags 500e56dacdSMichael Ellerman 510e56dacdSMichael Ellermantags: 520e56dacdSMichael Ellerman find . -name '*.c' -o -name '*.h' | xargs ctags 530e56dacdSMichael Ellerman 54*6faeeea4SMichael Ellerman.PHONY: tags $(TARGETS) 55