kselftest: arm64: mangle_pstate_invalid_compat_toggle and common utils
[linux-2.6-microblaze.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
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 # Guessing where the Kernel headers could have been installed
21 # depending on ENV config
22 ifeq ($(KBUILD_OUTPUT),)
23 khdr_dir = $(top_srcdir)/usr/include
24 else
25 # the KSFT preferred location when KBUILD_OUTPUT is set
26 khdr_dir = $(KBUILD_OUTPUT)/kselftest/usr/include
27 endif
28
29 CFLAGS += -I$(khdr_dir)
30
31 export CFLAGS
32 export top_srcdir
33
34 all:
35         @for DIR in $(ARM64_SUBTARGETS); do                             \
36                 BUILD_TARGET=$(OUTPUT)/$$DIR;                   \
37                 mkdir -p $$BUILD_TARGET;                        \
38                 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;         \
39         done
40
41 install: all
42         @for DIR in $(ARM64_SUBTARGETS); do                             \
43                 BUILD_TARGET=$(OUTPUT)/$$DIR;                   \
44                 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;         \
45         done
46
47 run_tests: all
48         @for DIR in $(ARM64_SUBTARGETS); do                             \
49                 BUILD_TARGET=$(OUTPUT)/$$DIR;                   \
50                 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;         \
51         done
52
53 # Avoid any output on non arm64 on emit_tests
54 emit_tests: all
55         @for DIR in $(ARM64_SUBTARGETS); do                             \
56                 BUILD_TARGET=$(OUTPUT)/$$DIR;                   \
57                 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;         \
58         done
59
60 clean:
61         @for DIR in $(ARM64_SUBTARGETS); do                             \
62                 BUILD_TARGET=$(OUTPUT)/$$DIR;                   \
63                 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;         \
64         done
65
66 .PHONY: all clean install run_tests emit_tests