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