1 # SPDX-License-Identifier: GPL-2.0
3 # When ARCH not overridden for crosscompiling, lookup machine
4 ARCH ?= $(shell uname -m 2>/dev/null || echo not)
6 ifneq (,$(filter $(ARCH),aarch64 arm64))
7 ARM64_SUBTARGETS ?= tags signal
12 CFLAGS := -Wall -O2 -g
14 # A proper top_srcdir is needed by KSFT(lib.mk)
15 top_srcdir = $(realpath ../../../../)
17 # Additional include paths needed by kselftest.h and local headers
18 CFLAGS += -I$(top_srcdir)/tools/testing/selftests/
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
25 # the KSFT preferred location when KBUILD_OUTPUT is set
26 khdr_dir = $(KBUILD_OUTPUT)/kselftest/usr/include
29 CFLAGS += -I$(khdr_dir)
35 @for DIR in $(ARM64_SUBTARGETS); do \
36 BUILD_TARGET=$(OUTPUT)/$$DIR; \
37 mkdir -p $$BUILD_TARGET; \
38 make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
42 @for DIR in $(ARM64_SUBTARGETS); do \
43 BUILD_TARGET=$(OUTPUT)/$$DIR; \
44 make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
48 @for DIR in $(ARM64_SUBTARGETS); do \
49 BUILD_TARGET=$(OUTPUT)/$$DIR; \
50 make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
53 # Avoid any output on non arm64 on emit_tests
55 @for DIR in $(ARM64_SUBTARGETS); do \
56 BUILD_TARGET=$(OUTPUT)/$$DIR; \
57 make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
61 @for DIR in $(ARM64_SUBTARGETS); do \
62 BUILD_TARGET=$(OUTPUT)/$$DIR; \
63 make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
66 .PHONY: all clean install run_tests emit_tests