1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 20e56dacdSMichael Ellerman# Makefile for powerpc selftests 30e56dacdSMichael Ellerman 40e56dacdSMichael Ellerman# ARCH can be overridden by the user for cross compiling 50e56dacdSMichael EllermanARCH ?= $(shell uname -m) 60e56dacdSMichael EllermanARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/) 70e56dacdSMichael Ellerman 80e56dacdSMichael Ellermanifeq ($(ARCH),powerpc) 90e56dacdSMichael Ellerman 100e56dacdSMichael EllermanGIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown") 110e56dacdSMichael Ellerman 123d2e03f8SChijun SimaCFLAGS := -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR)/include $(CFLAGS) 130e56dacdSMichael Ellerman 1484f887bfSMichael Ellermanexport CFLAGS 150e56dacdSMichael Ellerman 1643750880SChris SmartSUB_DIRS = alignment \ 1743750880SChris Smart benchmarks \ 18b8b6ff01SMichael Ellerman cache_shape \ 1965b6ba63SMichael Ellerman copyloops \ 2065b6ba63SMichael Ellerman dscr \ 2165b6ba63SMichael Ellerman mm \ 22647c734fSRaphael Moreira Zinsly nx-gzip \ 2365b6ba63SMichael Ellerman pmu \ 24ef186331SCyril Bur signal \ 2565b6ba63SMichael Ellerman primitives \ 2665b6ba63SMichael Ellerman stringloops \ 2765b6ba63SMichael Ellerman switch_endian \ 2865b6ba63SMichael Ellerman syscalls \ 2965b6ba63SMichael Ellerman tm \ 3085d86c8aSOliver O'Halloran eeh \ 3101127f1eSCyril Bur vphn \ 32f666ad41SAnshuman Khandual math \ 33d2bf7932SNaveen N. Rao ptrace \ 34*0f4ef8a3SGanesh Goudar security \ 35*0f4ef8a3SGanesh Goudar mce 360e56dacdSMichael Ellerman 370e56dacdSMichael Ellermanendif 380e56dacdSMichael Ellerman 39a908f5deSMichael Ellermanall: $(SUB_DIRS) 40cbfd7dabSMichael Ellerman 41a908f5deSMichael Ellerman$(SUB_DIRS): 422db2c250SMichael Ellerman BUILD_TARGET=$(OUTPUT)/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all 430e56dacdSMichael Ellerman 446faeeea4SMichael Ellermaninclude ../lib.mk 456faeeea4SMichael Ellerman 466faeeea4SMichael Ellermanoverride define RUN_TESTS 47a908f5deSMichael Ellerman @for TARGET in $(SUB_DIRS); do \ 482db2c250SMichael Ellerman BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 49a8ba798bS[email protected] $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\ 500e56dacdSMichael Ellerman done; 516faeeea4SMichael Ellermanendef 526faeeea4SMichael Ellerman 536faeeea4SMichael Ellermanoverride define INSTALL_RULE 54d19d5efdSLinus Torvalds @for TARGET in $(SUB_DIRS); do \ 552db2c250SMichael Ellerman BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 56a8ba798bS[email protected] $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install;\ 576faeeea4SMichael Ellerman done; 586faeeea4SMichael Ellermanendef 596faeeea4SMichael Ellerman 606faeeea4SMichael Ellermanoverride define EMIT_TESTS 61d19d5efdSLinus Torvalds @for TARGET in $(SUB_DIRS); do \ 622db2c250SMichael Ellerman BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 63a8ba798bS[email protected] $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\ 646faeeea4SMichael Ellerman done; 656faeeea4SMichael Ellermanendef 660e56dacdSMichael Ellerman 67337f1e36SShuah Khanoverride define CLEAN 68a908f5deSMichael Ellerman @for TARGET in $(SUB_DIRS); do \ 692db2c250SMichael Ellerman BUILD_TARGET=$(OUTPUT)/$$TARGET; \ 702e8ec87dSMichael Ellerman $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \ 712e8ec87dSMichael Ellerman done; 720e56dacdSMichael Ellerman rm -f tags 73337f1e36SShuah Khanendef 740e56dacdSMichael Ellerman 750e56dacdSMichael Ellermantags: 760e56dacdSMichael Ellerman find . -name '*.c' -o -name '*.h' | xargs ctags 770e56dacdSMichael Ellerman 78d19d5efdSLinus Torvalds.PHONY: tags $(SUB_DIRS) 79