xref: /linux/tools/testing/selftests/arm64/Makefile (revision 47cf96fbe393839b125a9b694a8cfdd3f4216baa)
1# SPDX-License-Identifier: GPL-2.0
2
3# When ARCH not overridden for crosscompiling, lookup machine
4ARCH ?= $(shell uname -m 2>/dev/null || echo not)
5
6ifneq (,$(filter $(ARCH),aarch64 arm64))
7ARM64_SUBTARGETS ?= tags signal pauth fp mte bti abi gcs
8else
9ARM64_SUBTARGETS :=
10endif
11
12CFLAGS := -Wall -O2 -g
13
14# A proper top_srcdir is needed by KSFT(lib.mk)
15top_srcdir = $(realpath ../../../../)
16
17# Additional include paths needed by kselftest.h and local headers
18CFLAGS += -I$(top_srcdir)/tools/testing/selftests/
19
20CFLAGS += $(KHDR_INCLUDES)
21
22CFLAGS += -I$(top_srcdir)/tools/include
23
24OUTPUT ?= $(CURDIR)
25
26export CFLAGS
27export top_srcdir
28
29all:
30	@for DIR in $(ARM64_SUBTARGETS); do				\
31		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
32		mkdir -p $$BUILD_TARGET;			\
33		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;		\
34	done
35
36install: all
37	@for DIR in $(ARM64_SUBTARGETS); do				\
38		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
39		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;		\
40	done
41
42run_tests: all
43	@for DIR in $(ARM64_SUBTARGETS); do				\
44		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
45		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;		\
46	done
47
48# Avoid any output on non arm64 on emit_tests
49emit_tests:
50	@for DIR in $(ARM64_SUBTARGETS); do				\
51		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
52		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;		\
53	done
54
55clean:
56	@for DIR in $(ARM64_SUBTARGETS); do				\
57		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
58		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;		\
59	done
60
61.PHONY: all clean install run_tests emit_tests
62