From: Oliver Schmidt Date: Wed, 1 Jun 2016 21:45:27 +0000 (+0200) Subject: Removed shell for-loop. X-Git-Tag: V2.16~122 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=24256256fb772ed34c5197bcfba109278c471052;p=cc65 Removed shell for-loop. Just a few of the many reasons why shell for-loops have no place in (GNUmake) Makefiles: * They don't conform to https://www.gnu.org/software/make/manual/html_node/Utilities-in-Makefiles.html * They break Windows builds for sure * They don't fit to make's approach of working with sets * They break make parallelism --- diff --git a/samples/Makefile b/samples/Makefile index fa3777000..5a75c7f4b 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -35,8 +35,8 @@ ifdef CC65_HOME installdir = $(CC65_HOME) endif -MOUS = $(installdir)/target/$(SYS)/drv/mou/$(SYS)*.mou -TGI = $(installdir)/target/$(SYS)/drv/tgi/$(SYS)*.tgi +MOUS := $(wildcard $(installdir)/target/$(SYS)/drv/mou/$(SYS)*.mou) +TGI := $(wildcard $(installdir)/target/$(SYS)/drv/tgi/$(SYS)*.tgi) CLIB = --lib $(SYS).lib CL = cl65 CC = cc65 @@ -46,8 +46,8 @@ LD = ld65 else # "samples/" is a part of a complete source tree. export CC65_HOME := $(abspath ..) -MOUS = ../target/$(SYS)/drv/mou/$(SYS)*.mou -TGI = ../target/$(SYS)/drv/tgi/$(SYS)*.tgi +MOUS := $(wildcard ../target/$(SYS)/drv/mou/$(SYS)*.mou) +TGI := $(wildcard ../target/$(SYS)/drv/tgi/$(SYS)*.tgi) CLIB = ../lib/$(SYS).lib CL = ../bin/cl65 CC = ../bin/cc65 @@ -140,14 +140,16 @@ ovrldemo: overlaydemo.o d64: samples.d64 +define D64_WRITE_recipe + +$(C1541) -attach $@ -write $(file) $(notdir $(file)) >$(NULLDEV) + +endef # D64_WRITE_recipe + samples.d64: samples @$(C1541) -format samples,AA d64 $@ >$(NULLDEV) - @for exe in $(EXELIST); do\ - $(C1541) -attach $@ -write $$exe >$(NULLDEV) || exit $$?;\ - done - @for mod in $(TGI) $(MOUS); do\ - $(C1541) -attach $@ -write $$mod >$(NULLDEV) || exit $$?;\ - done + $(foreach file,$(EXELIST),$(D64_WRITE_recipe)) + $(foreach file,$(TGI) $(MOUS),$(D64_WRITE_recipe)) # -------------------------------------------------------------------------- # Installation rules