[PATCH v5 25/26] selftests/nolibc: Append extra cflags

Leo Yan
2026-03-18T09:21:02Z

Include tools/scripts/Makefile.include, which may provide additional
flags in EXTRA_CFLAGS, and append to CFLAGS.

Since Makefile.include already defines cc-option, remove the redundant
definition and include.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/testing/selftests/nolibc/Makefile | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 0370489d938b540721a4fb814ebb68c463760e73..7b65e6f9840b035c1d8580574fc3145318b278b4 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -3,18 +3,17 @@
TEST_GEN_PROGS := nolibc-test libc-test

include ../lib.mk
-include $(top_srcdir)/scripts/Makefile.compiler
-
-cc-option = $(call __cc-option, $(CC),,$(1),$(2))
+include $(top_srcdir)/tools/scripts/Makefile.include

include Makefile.include

$(OUTPUT)/nolibc-test: CFLAGS = -nostdlib -nostdinc -static \
-isystem $(top_srcdir)/tools/include/nolibc -isystem $(top_srcdir)/usr/include \
- $(CFLAGS_NOLIBC_TEST)
+ $(CFLAGS_NOLIBC_TEST) $(EXTRA_CFLAGS)
$(OUTPUT)/nolibc-test: LDLIBS = $(if $(LLVM),,-lgcc)
$(OUTPUT)/nolibc-test: nolibc-test.c nolibc-test-linkage.c | headers

+$(OUTPUT)/libc-test: CFLAGS += $(EXTRA_CFLAGS)
$(OUTPUT)/libc-test: nolibc-test.c nolibc-test-linkage.c
$(call msg,CC,,$@)
$(Q)$(LINK.c) $^ -o $@

--
2.34.1