Makefile 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # SPDX-License-Identifier: GPL-2.0
  2. # Copyright (C) 2020 ARM Limited
  3. CFLAGS += -std=gnu99 -I. -pthread
  4. LDFLAGS += -pthread
  5. SRCS := $(filter-out mte_common_util.c,$(wildcard *.c))
  6. PROGS := $(patsubst %.c,%,$(SRCS))
  7. ifeq ($(LLVM),)
  8. # For GCC check that the toolchain has MTE support.
  9. # preserve CC value from top level Makefile
  10. ifeq ($(CC),cc)
  11. CC := $(CROSS_COMPILE)gcc
  12. endif
  13. #check if the compiler works well
  14. mte_cc_support := $(shell if ($(CC) $(CFLAGS) -march=armv8.5-a+memtag -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi)
  15. else
  16. # All supported clang versions also support MTE.
  17. mte_cc_support := 1
  18. endif
  19. ifeq ($(mte_cc_support),1)
  20. # Generated binaries to be installed by top KSFT script
  21. TEST_GEN_PROGS := $(PROGS)
  22. else
  23. $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.)
  24. $(warning test program "mte" will not be created.)
  25. endif
  26. # Include KSFT lib.mk.
  27. include ../../lib.mk
  28. ifeq ($(mte_cc_support),1)
  29. $(TEST_GEN_PROGS): mte_common_util.c mte_helper.S
  30. endif