xref: /linux/tools/testing/selftests/powerpc/Makefile (revision 76b2ec3faeaa0c8d84705acd64ac0e5a307ce9c2)
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		\
20bdb07f35SBenjamin Gray	   dexcr		\
2165b6ba63SMichael Ellerman	   dscr			\
2265b6ba63SMichael Ellerman	   mm			\
23647c734fSRaphael Moreira Zinsly	   nx-gzip		\
2465b6ba63SMichael Ellerman	   pmu			\
25ef186331SCyril Bur	   signal		\
2665b6ba63SMichael Ellerman	   primitives		\
2765b6ba63SMichael Ellerman	   stringloops		\
2865b6ba63SMichael Ellerman	   switch_endian	\
2965b6ba63SMichael Ellerman	   syscalls		\
3065b6ba63SMichael Ellerman	   tm			\
3185d86c8aSOliver O'Halloran	   eeh			\
3201127f1eSCyril Bur	   vphn         \
33f666ad41SAnshuman Khandual	   math		\
3457201d65SPratik R. Sampat	   papr_attributes	\
359118c5d3SNathan Lynch	   papr_vpd		\
36*76b2ec3fSNathan Lynch	   papr_sysparm		\
37d2bf7932SNaveen N. Rao	   ptrace	\
380f4ef8a3SGanesh Goudar	   security	\
390f4ef8a3SGanesh Goudar	   mce
400e56dacdSMichael Ellerman
410e56dacdSMichael Ellermanendif
420e56dacdSMichael Ellerman
43a908f5deSMichael Ellermanall: $(SUB_DIRS)
44cbfd7dabSMichael Ellerman
45a908f5deSMichael Ellerman$(SUB_DIRS):
462db2c250SMichael Ellerman	BUILD_TARGET=$(OUTPUT)/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all
470e56dacdSMichael Ellerman
486faeeea4SMichael Ellermaninclude ../lib.mk
496faeeea4SMichael Ellerman
506faeeea4SMichael Ellermanoverride define RUN_TESTS
514ecd0868SBenjamin Gray	+@for TARGET in $(SUB_DIRS); do \
522db2c250SMichael Ellerman		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
53a8ba798bSbamvor.zhangjian@huawei.com		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
540e56dacdSMichael Ellerman	done;
556faeeea4SMichael Ellermanendef
566faeeea4SMichael Ellerman
576faeeea4SMichael Ellermanoverride define INSTALL_RULE
584ecd0868SBenjamin Gray	+@for TARGET in $(SUB_DIRS); do \
592db2c250SMichael Ellerman		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
60a8ba798bSbamvor.zhangjian@huawei.com		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install;\
616faeeea4SMichael Ellerman	done;
626faeeea4SMichael Ellermanendef
636faeeea4SMichael Ellerman
6458b33e78SMichael Ellermanemit_tests:
654ecd0868SBenjamin Gray	+@for TARGET in $(SUB_DIRS); do \
662db2c250SMichael Ellerman		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
6758b33e78SMichael Ellerman		$(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET $@;\
686faeeea4SMichael Ellerman	done;
690e56dacdSMichael Ellerman
70337f1e36SShuah Khanoverride define CLEAN
714ecd0868SBenjamin Gray	+@for TARGET in $(SUB_DIRS); do \
722db2c250SMichael Ellerman		BUILD_TARGET=$(OUTPUT)/$$TARGET;	\
732e8ec87dSMichael Ellerman		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
742e8ec87dSMichael Ellerman	done;
750e56dacdSMichael Ellerman	rm -f tags
76337f1e36SShuah Khanendef
770e56dacdSMichael Ellerman
780e56dacdSMichael Ellermantags:
790e56dacdSMichael Ellerman	find . -name '*.c' -o -name '*.h' | xargs ctags
800e56dacdSMichael Ellerman
8158b33e78SMichael Ellerman.PHONY: tags $(SUB_DIRS) emit_tests
82