18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci# When ARCH not overridden for crosscompiling, lookup machine 48c2ecf20Sopenharmony_ciARCH ?= $(shell uname -m 2>/dev/null || echo not) 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ciifneq (,$(filter $(ARCH),aarch64 arm64)) 78c2ecf20Sopenharmony_ciARM64_SUBTARGETS ?= tags signal pauth fp mte 88c2ecf20Sopenharmony_cielse 98c2ecf20Sopenharmony_ciARM64_SUBTARGETS := 108c2ecf20Sopenharmony_ciendif 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciCFLAGS := -Wall -O2 -g 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci# A proper top_srcdir is needed by KSFT(lib.mk) 158c2ecf20Sopenharmony_citop_srcdir = $(realpath ../../../../) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci# Additional include paths needed by kselftest.h and local headers 188c2ecf20Sopenharmony_ciCFLAGS += -I$(top_srcdir)/tools/testing/selftests/ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci# Guessing where the Kernel headers could have been installed 218c2ecf20Sopenharmony_ci# depending on ENV config 228c2ecf20Sopenharmony_ciifeq ($(KBUILD_OUTPUT),) 238c2ecf20Sopenharmony_cikhdr_dir = $(top_srcdir)/usr/include 248c2ecf20Sopenharmony_cielse 258c2ecf20Sopenharmony_ci# the KSFT preferred location when KBUILD_OUTPUT is set 268c2ecf20Sopenharmony_cikhdr_dir = $(KBUILD_OUTPUT)/kselftest/usr/include 278c2ecf20Sopenharmony_ciendif 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciCFLAGS += -I$(khdr_dir) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciexport CFLAGS 328c2ecf20Sopenharmony_ciexport top_srcdir 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciall: 358c2ecf20Sopenharmony_ci @for DIR in $(ARM64_SUBTARGETS); do \ 368c2ecf20Sopenharmony_ci BUILD_TARGET=$(OUTPUT)/$$DIR; \ 378c2ecf20Sopenharmony_ci mkdir -p $$BUILD_TARGET; \ 388c2ecf20Sopenharmony_ci make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \ 398c2ecf20Sopenharmony_ci done 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciinstall: all 428c2ecf20Sopenharmony_ci @for DIR in $(ARM64_SUBTARGETS); do \ 438c2ecf20Sopenharmony_ci BUILD_TARGET=$(OUTPUT)/$$DIR; \ 448c2ecf20Sopenharmony_ci make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \ 458c2ecf20Sopenharmony_ci done 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cirun_tests: all 488c2ecf20Sopenharmony_ci @for DIR in $(ARM64_SUBTARGETS); do \ 498c2ecf20Sopenharmony_ci BUILD_TARGET=$(OUTPUT)/$$DIR; \ 508c2ecf20Sopenharmony_ci make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \ 518c2ecf20Sopenharmony_ci done 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci# Avoid any output on non arm64 on emit_tests 548c2ecf20Sopenharmony_ciemit_tests: all 558c2ecf20Sopenharmony_ci @for DIR in $(ARM64_SUBTARGETS); do \ 568c2ecf20Sopenharmony_ci BUILD_TARGET=$(OUTPUT)/$$DIR; \ 578c2ecf20Sopenharmony_ci make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \ 588c2ecf20Sopenharmony_ci done 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ciclean: 618c2ecf20Sopenharmony_ci @for DIR in $(ARM64_SUBTARGETS); do \ 628c2ecf20Sopenharmony_ci BUILD_TARGET=$(OUTPUT)/$$DIR; \ 638c2ecf20Sopenharmony_ci make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \ 648c2ecf20Sopenharmony_ci done 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci.PHONY: all clean install run_tests emit_tests 67