From 9877042450f9c4c282ad18c947e46a3a7cb211ea Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 8 Jun 2018 18:58:36 +0200 Subject: [PATCH] Use --print-target-path only as last resort. --print-target-path may return a path with (escaped) spaces. We'll use that path with $(wildcard ...), that's fine. But then we use the outcome with $(foreach ...) and there things fail badly and there's nothing to do about it. Therefore we a) try to avoid --print-target-path in the first place and b) explicitly bail out if we end up with spaces. --- samples/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/samples/Makefile b/samples/Makefile index 8bb6d25ae..a62a38069 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -35,7 +35,15 @@ else endif ifneq ($(filter disk samples.%,$(MAKECMDGOALS)),) - TARGET_PATH := $(shell $(CL) --print-target-path) + ifdef CC65_HOME + TARGET_PATH = $(CC65_HOME)/target + else + TARGET_PATH := $(if $(wildcard ../target),../target,$(shell $(CL) --print-target-path)) + endif + + ifneq ($(words $(TARGET_PATH)),1) + $(error No space chars allowed in "$(TARGET_PATH)") + endif EMD := $(wildcard $(TARGET_PATH)/$(SYS)/drv/emd/*) MOU := $(wildcard $(TARGET_PATH)/$(SYS)/drv/mou/*) -- 2.39.5