Skip to content

Commit 786e8f6

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. Port of pq-code-package/mlkem-native@15fa58e Signed-off-by: Matthias J. Kannwischer <[email protected]>
1 parent cdb6bb0 commit 786e8f6

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

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

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

test/mk/components.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,11 @@ $(foreach scheme,mldsa44 mldsa65 mldsa87, \
7070
$(ALL_TESTS:%=$(MLDSA44_DIR)/bin/%44): $(call MAKE_OBJS, $(MLDSA44_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))
7171
$(ALL_TESTS:%=$(MLDSA65_DIR)/bin/%65): $(call MAKE_OBJS, $(MLDSA65_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))
7272
$(ALL_TESTS:%=$(MLDSA87_DIR)/bin/%87): $(call MAKE_OBJS, $(MLDSA87_DIR), $(wildcard test/notrandombytes/*.c) $(EXTRA_SOURCES))
73+
74+
# Apply EXTRA_CFLAGS to EXTRA_SOURCES object files
75+
ifneq ($(EXTRA_SOURCES),)
76+
$(call MAKE_OBJS, $(MLDSA44_DIR), $(EXTRA_SOURCES)): CFLAGS += $(EXTRA_SOURCES_CFLAGS)
77+
$(call MAKE_OBJS, $(MLDSA65_DIR), $(EXTRA_SOURCES)): CFLAGS += $(EXTRA_SOURCES_CFLAGS)
78+
$(call MAKE_OBJS, $(MLDSA87_DIR), $(EXTRA_SOURCES)): CFLAGS += $(EXTRA_SOURCES_CFLAGS)
79+
endif
80+

0 commit comments

Comments
 (0)