From: Oliver Schmidt
Date: Fri, 8 Jun 2018 16:58:36 +0000 (+0200)
Subject: Use --print-target-path only as last resort.
X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9877042450f9c4c282ad18c947e46a3a7cb211ea;p=cc65
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.
---
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/*)