diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 6e5fc15363..9a66d3c10b 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -145,7 +145,8 @@ endif CXXFLAGS += $(filter-out -Wmissing-prototypes -Wold-style-definition -std=gnu99,$(CFLAGS)) CXXFLAGS += $(CXXFLAGS_MOD) ifneq ($(SRC_CXX)$(SRC_MOD_CXX),) -LDFLAGS += -L$(dir $(shell $(CXX) $(CXXFLAGS) -print-file-name=libstdc++.a)) +LIBSTDCPP_FILE_NAME = "$(shell $(CXX) $(CXXFLAGS) -print-file-name=libstdc++.a)" +LDFLAGS += -L"$(shell dirname $(LIBSTDCPP_FILE_NAME))" endif # Options for mpy-cross