Makefile 1.5 KB

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