Skip to content

Commit 15fa58e

Browse files
committed
Allow additional CFLAGS for extra sources
Since the addition of -Wconversion and -Wsign-conversion to the default CFLAGS, compilation of the CMSIS files for AN547 fails. This commit allows custom Makefiles to not only provide EXTRA_SOURCES to specify additional sources, but also EXTRA_SOURCES_CFLAGS for additional CFLAGS, which in particular may overwrite default CFLAGS (they apply later). This is leveraged in the case of m55-an547/platform.mk to disable conversion and sign-conversion warnings for all CMSIS files. Signed-off-by: Hanno Becker <[email protected]>
1 parent be042f3 commit 15fa58e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

test/baremetal/platform/m55-an547/platform.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,7 @@ LDFLAGS += \
5959

6060
# Extra sources to be included in test binaries
6161
EXTRA_SOURCES = $(wildcard $(M55_AN547_PATH)/*.c)
62+
# The CMSIS files fail compilation if conversion warnings are enabled
63+
EXTRA_SOURCES_CFLAGS = -Wno-conversion -Wno-sign-conversion
64+
6265
EXEC_WRAPPER := $(realpath $(PLATFORM_PATH)/exec_wrapper.py)

test/mk/components.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,10 @@ $(foreach scheme,mlkem512 mlkem768 mlkem1024, \
102102
$(ALL_TESTS:%=$(MLKEM512_DIR)/bin/%512): $(call MAKE_OBJS, $(MLKEM512_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))
103103
$(ALL_TESTS:%=$(MLKEM768_DIR)/bin/%768): $(call MAKE_OBJS, $(MLKEM768_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))
104104
$(ALL_TESTS:%=$(MLKEM1024_DIR)/bin/%1024): $(call MAKE_OBJS, $(MLKEM1024_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))
105+
106+
# Apply EXTRA_CFLAGS to EXTRA_SOURCES object files
107+
ifneq ($(EXTRA_SOURCES),)
108+
$(call MAKE_OBJS, $(MLKEM512_DIR), $(EXTRA_SOURCES)): CFLAGS += $(EXTRA_SOURCES_CFLAGS)
109+
$(call MAKE_OBJS, $(MLKEM768_DIR), $(EXTRA_SOURCES)): CFLAGS += $(EXTRA_SOURCES_CFLAGS)
110+
$(call MAKE_OBJS, $(MLKEM1024_DIR), $(EXTRA_SOURCES)): CFLAGS += $(EXTRA_SOURCES_CFLAGS)
111+
endif

0 commit comments

Comments
 (0)