Skip to content

Commit ce20586

Browse files
Iksasdpgeorge
authored andcommitted
ports: Fix handling of paths containing spaces in Makefiles.
Make can't handle paths with spaces, see https://savannah.gnu.org/bugs/?712 The following workarounds exist: - When using make's built-in functions: - Use relative paths wherever possible to avoid spaces in the first place. - All spaces in paths can be escaped with backslashes; quotes don't work. - Some users use the shell to temporarily rename directories, or to create symlinks without spaces. - When using make to pass commands to the system's shell, enclose paths in quotes. While make will still interpret quoted strings with spaces as multiple words, the system's shell will correctly parse the resulting command. This commit contains the following fixes: - In ports/stm32/mboot/Makefile: Use relative paths to avoid spaces when using built-in functions. - In all other files: Use quotes to enclose paths when make is used to call shell functions. All changes have been tested with a directory containing spaces. Signed-off-by: Iksas <iksas@mailbox.org>
1 parent 057701a commit ce20586

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

ports/esp32/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ifdef USER_C_MODULES
4242
CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES}
4343
endif
4444

45-
IDFPY_FLAGS += -D MICROPY_BOARD=$(BOARD) -D MICROPY_BOARD_DIR=$(abspath $(BOARD_DIR)) $(CMAKE_ARGS)
45+
IDFPY_FLAGS += -D MICROPY_BOARD=$(BOARD) -D MICROPY_BOARD_DIR="$(abspath $(BOARD_DIR))" $(CMAKE_ARGS)
4646

4747
ifdef FROZEN_MANIFEST
4848
IDFPY_FLAGS += -D MICROPY_FROZEN_MANIFEST=$(FROZEN_MANIFEST)

ports/mimxrt/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ $(GEN_FLEXRAM_CONFIG_SRC):
491491
$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h: $(BOARD_PINS) $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
492492
$(ECHO) "Create $@"
493493
$(Q)$(PYTHON) $(MAKE_PINS) --board-csv $(BOARD_PINS) --af-csv $(AF_FILE) \
494-
--prefix $(PREFIX_FILE) --iomux $(abspath $(TOP)/$(MCU_DIR)/drivers/fsl_iomuxc.h) \
494+
--prefix $(PREFIX_FILE) --iomux "$(abspath $(TOP)/$(MCU_DIR)/drivers/fsl_iomuxc.h)" \
495495
--output-source $(GEN_PINS_SRC) --output-header $(GEN_PINS_HDR)
496496

497497
include $(TOP)/py/mkrules.mk

ports/rp2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ endif
3030

3131
$(VERBOSE)MAKESILENT = -s
3232

33-
CMAKE_ARGS = -DMICROPY_BOARD=$(BOARD) -DMICROPY_BOARD_DIR=$(abspath $(BOARD_DIR))
33+
CMAKE_ARGS = -DMICROPY_BOARD=$(BOARD) -DMICROPY_BOARD_DIR="$(abspath $(BOARD_DIR))"
3434

3535
ifdef USER_C_MODULES
3636
CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES}

ports/stm32/mboot/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ BOARD ?= $(notdir $(BOARD_DIR:/=))
66
else
77
# If not given on the command line, then default to PYBV10.
88
BOARD ?= PYBV10
9-
BOARD_DIR ?= $(abspath ../boards/$(BOARD))
9+
BOARD_DIR ?= ../boards/$(BOARD)
1010
endif
1111

1212
# If the build directory is not given, make it reflect the board name.

py/mkrules.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ $(HEADER_BUILD):
176176
ifneq ($(MICROPY_MPYCROSS_DEPENDENCY),)
177177
# to automatically build mpy-cross, if needed
178178
$(MICROPY_MPYCROSS_DEPENDENCY):
179-
$(MAKE) -C $(abspath $(dir $@)..)
179+
$(MAKE) -C "$(abspath $(dir $@)..)"
180180
endif
181181

182182
ifneq ($(FROZEN_DIR),)

0 commit comments

Comments
 (0)