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 16*a908f5deSMichael EllermanSUB_DIRS = pmu copyloops mm tm primitives stringloops vphn 170e56dacdSMichael Ellerman 180e56dacdSMichael Ellermanendif 190e56dacdSMichael Ellerman 20*a908f5deSMichael Ellermanall: $(SUB_DIRS) 21cbfd7dabSMichael Ellerman 22*a908f5deSMichael Ellerman$(SUB_DIRS): 23cbfd7dabSMichael Ellerman $(MAKE) -k -C $@ all 240e56dacdSMichael Ellerman 250e56dacdSMichael Ellermanrun_tests: all 26*a908f5deSMichael Ellerman @for TARGET in $(SUB_DIRS); do \ 270e56dacdSMichael Ellerman $(MAKE) -C $$TARGET run_tests; \ 280e56dacdSMichael Ellerman done; 290e56dacdSMichael Ellerman 300e56dacdSMichael Ellermanclean: 31*a908f5deSMichael Ellerman @for TARGET in $(SUB_DIRS); do \ 320e56dacdSMichael Ellerman $(MAKE) -C $$TARGET clean; \ 330e56dacdSMichael Ellerman done; 340e56dacdSMichael Ellerman rm -f tags 350e56dacdSMichael Ellerman 360e56dacdSMichael Ellermantags: 370e56dacdSMichael Ellerman find . -name '*.c' -o -name '*.h' | xargs ctags 380e56dacdSMichael Ellerman 39*a908f5deSMichael Ellerman.PHONY: all run_tests clean tags $(SUB_DIRS) 40