xref: /linux/tools/testing/selftests/arm64/Makefile (revision 23b0f90ba871f096474e1c27c3d14f455189d2d9)
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			$(if $(FORCE_TARGETS),|| exit); \
35	done
36
37install: all
38	@for DIR in $(ARM64_SUBTARGETS); do				\
39		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
40		make OUTPUT=$$BUILD_TARGET -C $$DIR $@		\
41			$(if $(FORCE_TARGETS),|| exit); \
42	done
43
44run_tests: all
45	@for DIR in $(ARM64_SUBTARGETS); do				\
46		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
47		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;		\
48	done
49
50# Avoid any output on non arm64 on emit_tests
51emit_tests:
52	@for DIR in $(ARM64_SUBTARGETS); do				\
53		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
54		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;		\
55	done
56
57clean:
58	@for DIR in $(ARM64_SUBTARGETS); do				\
59		BUILD_TARGET=$(OUTPUT)/$$DIR;			\
60		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;		\
61	done
62
63.PHONY: all clean install run_tests emit_tests
64