From 14b853eae052f6d8ef285931336ca1212af76716 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 23 Jul 2021 12:02:03 +1000 Subject: [PATCH] minimal/Makefile: Add support for building with user C modules. Fixes issue #5750. Signed-off-by: Damien George --- ports/minimal/Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ports/minimal/Makefile b/ports/minimal/Makefile index 0e79d581be..21e3fe3f76 100644 --- a/ports/minimal/Makefile +++ b/ports/minimal/Makefile @@ -41,6 +41,14 @@ CFLAGS += -Os -DNDEBUG CFLAGS += -fdata-sections -ffunction-sections endif +# Flags for optional C++ source code +CXXFLAGS += $(filter-out -std=c99,$(CFLAGS)) +CXXFLAGS += $(CXXFLAGS_MOD) + +# Flags for user C modules +CFLAGS += $(CFLAGS_MOD) +LDFLAGS += $(LDFLAGS_MOD) + LIBS = SRC_C = \ @@ -56,7 +64,14 @@ ifeq ($(CROSS), 1) SRC_C += shared/libc/string0.c endif -OBJ = $(PY_CORE_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) +SRC_C += $(SRC_MOD) + +SRC_CXX += $(SRC_MOD_CXX) + +SRC_QSTR += $(SRC_MOD) $(SRC_MOD_CXX) + +OBJ += $(PY_CORE_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o)) ifeq ($(CROSS), 1) all: $(BUILD)/firmware.dfu