Makefile 896 B

1234567891011121314151617181920212223242526272829303132
  1. # SPDX-License-Identifier: GPL-2.0
  2. # Copyright (C) 2020 ARM Limited
  3. # preserve CC value from top level Makefile
  4. ifeq ($(CC),cc)
  5. CC := $(CROSS_COMPILE)gcc
  6. endif
  7. CFLAGS += -std=gnu99 -I. -pthread
  8. LDFLAGS += -pthread
  9. SRCS := $(filter-out mte_common_util.c,$(wildcard *.c))
  10. PROGS := $(patsubst %.c,%,$(SRCS))
  11. #check if the compiler works well
  12. 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)
  13. ifeq ($(mte_cc_support),1)
  14. # Generated binaries to be installed by top KSFT script
  15. TEST_GEN_PROGS := $(PROGS)
  16. # Get Kernel headers installed and use them.
  17. else
  18. $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.)
  19. $(warning test program "mte" will not be created.)
  20. endif
  21. # Include KSFT lib.mk.
  22. include ../../lib.mk
  23. ifeq ($(mte_cc_support),1)
  24. $(TEST_GEN_PROGS): mte_common_util.c mte_helper.S
  25. endif