From fed7276a631e20a39e44f031ebed12663e9b8f81 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Thu, 26 Jun 2025 22:16:08 +0200 Subject: [PATCH] make makefiles in samples behave the same as the others --- samples/Makefile | 27 +++++++++++++++++++++++---- samples/apple2/Makefile | 13 +++++++++++++ samples/atari2600/Makefile | 9 +++++++++ samples/atari5200/Makefile | 9 +++++++++ samples/cbm/Makefile | 13 +++++++++++++ samples/disasm/Makefile | 9 +++++++++ samples/gamate/Makefile | 9 +++++++++ samples/geos/Makefile | 27 +++++++++++++++++++++++++-- samples/geos/grc/Makefile | 10 ++++++++++ samples/kim1/Makefile | 19 +++++++++++++++++++ samples/lynx/Makefile | 9 +++++++++ samples/sim65/Makefile | 9 +++++++++ samples/supervision/Makefile | 9 +++++++++ samples/sym1/Makefile | 14 ++++++++++++++ samples/tutorial/Makefile | 11 +++++++++++ 15 files changed, 191 insertions(+), 6 deletions(-) diff --git a/samples/Makefile b/samples/Makefile index dc0ea8f9f..4bb954ba1 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -47,6 +47,16 @@ else LD := $(if $(wildcard ../bin/ld65*),../bin/ld65,ld65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: + PQ = "QUIET=1" + PD = --no-print-directory +endif + ifneq ($(filter disk samples.%,$(MAKECMDGOALS)),) ifdef CC65_HOME TARGET_PATH = $(CC65_HOME)/target @@ -152,10 +162,13 @@ LDFLAGS_tgidemo_atarixl = --start-addr 0x4000 .o: ifeq ($(SYS),vic20) + $(if $(QUIET),echo $(SYS):$@) $(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib else ifeq ($(SYS),plus4) + $(if $(QUIET),echo $(SYS):$@) $(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -C plus4-hires.cfg -m $@.map $^ $(SYS).lib else + $(if $(QUIET),echo $(SYS):$@) $(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -t $(SYS) -m $@.map $^ $(SYS).lib endif @@ -387,7 +400,7 @@ endif define SUBDIR_recipe -@+$(MAKE) -C $(dir) --no-print-directory $@ +@+$(MAKE) -C $(dir) $(PD) $@ $(PQ) endef # SUBDIR_recipe @@ -450,17 +463,23 @@ TARGETS := \ # -------------------------------------------------------------------------- # Rule to make the binaries for every platform +define TARGETDIR_recipe + +@+$(MAKE) -C $(dir) $(PD) $(PQ) + +endef # TARGETDIR_recipe + define TARGET_recipe @echo making samples for: $(T) -@$(MAKE) --no-print-directory clean SYS:=$(T) -@$(MAKE) -j2 SYS:=$(T) -@$(MAKE) --no-print-directory clean SYS:=$(T) +@$(MAKE) -j2 SYS:=$(T) $(PQ) +@$(MAKE) $(PD) clean SYS:=$(T) $(PQ) endef # TARGET_recipe platforms: $(foreach T,$(TARGETS),$(TARGET_recipe)) + $(foreach dir,$(DIRLIST),$(TARGETDIR_recipe)) # -------------------------------------------------------------------------- # Overlay rules. Overlays need special ld65 configuration files. Also, the diff --git a/samples/apple2/Makefile b/samples/apple2/Makefile index d9fa40f66..1f39296de 100644 --- a/samples/apple2/Makefile +++ b/samples/apple2/Makefile @@ -40,6 +40,14 @@ else LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_apple2 = \ hgrshow \ hgrtest \ @@ -63,6 +71,7 @@ endif disk: hgr.dsk dhgr.dsk hgr.dsk: hgrshow hgrtest + $(if $(QUIET),echo $(SYS):$@) cp prodos.dsk $@ java -jar $(AC) -as $@ hgrshow $( endef # D64_WRITE_SEQ_recipe samples.d64: samples + $(if $(QUIET),echo $(SYS):$@) @$(C1541) -format "samples,00" d64 $@ >$(NULLDEV) $(foreach file,$(EXELIST_$(SYS)),$(D64_WRITE_PRG_recipe)) # $(foreach file,$(OVERLAYLIST),$(D64_WRITE_PRG_recipe)) diff --git a/samples/disasm/Makefile b/samples/disasm/Makefile index 6599915f6..df883fa7c 100644 --- a/samples/disasm/Makefile +++ b/samples/disasm/Makefile @@ -37,6 +37,14 @@ else DA := $(if $(wildcard ../../bin/da65*),../../bin/da65,da65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + CPP = cpp #CPPFLAGS = -DTEST_ERROR @@ -56,6 +64,7 @@ $(DAIS): fixed.da $(DA) --sync-lines -o $@ -i $< image.bin image.bin: image.s image.cfg + $(if $(QUIET),echo $(SYS):$@) $(CL) -t none -C image.cfg -o image.bin image.s clean: diff --git a/samples/gamate/Makefile b/samples/gamate/Makefile index 35aef293d..4f20f047a 100644 --- a/samples/gamate/Makefile +++ b/samples/gamate/Makefile @@ -37,6 +37,14 @@ else LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_gamate = \ nachtm.bin @@ -56,6 +64,7 @@ else endif nachtm.bin: nachtm.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -Os -l nachtm.lst -t gamate -o nachtm.bin nachtm.c ../../util/gamate/gamate-fixcart nachtm.bin diff --git a/samples/geos/Makefile b/samples/geos/Makefile index ad4033f80..0ede7e78c 100644 --- a/samples/geos/Makefile +++ b/samples/geos/Makefile @@ -17,11 +17,15 @@ C1541 ?= c1541 ifeq ($(origin SYS),command line) ifeq ($(SYS),c64) override SYS = geos-cbm - $(info GEOS: c64 -> geos-cbm) + ifneq ($(SILENT),s) + $(info GEOS: c64 -> geos-cbm) + endif endif ifeq ($(SYS),apple2enh) override SYS = geos-apple - $(info GEOS: apple2enh -> geos-apple) + ifneq ($(SILENT),s) + $(info GEOS: apple2enh -> geos-apple) + endif endif endif @@ -55,6 +59,14 @@ else SP := $(if $(wildcard ../../bin/sp65*),../../bin/sp65,sp65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + DIRLIST = grc define SUBDIR_recipe @@ -111,36 +123,47 @@ bitmap.c: logo.pcx $(SP) -r logo.pcx -c geos-bitmap -w bitmap.c,ident=bitmap bitmap-demo.cvt: bitmap.c bitmap-demores.grc bitmap-demo.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m bitmap-demo.map bitmap-demores.grc bitmap-demo.c filesel.cvt: fileselres.grc filesel.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m filesel.map fileselres.grc filesel.c geosconio.cvt: geosconiores.grc geosconio.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m geosconio.map geosconiores.grc geosconio.c geosver.cvt: geosverres.grc geosver.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m geosver.map geosverres.grc geosver.c getid.cvt: getidres.grc getid.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m getid.map getidres.grc getid.c hello1.cvt: hello1res.grc hello1.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m hello1.map hello1res.grc hello1.c hello2.cvt: hello2res.grc hello2.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m hello2.map hello2res.grc hello2.c overlay-demo.cvt: overlay-demores.grc overlay-demo.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m overlay-demo.map overlay-demores.grc overlay-demo.c rmvprot.cvt: rmvprotres.grc rmvprot.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m rmvprot.map rmvprotres.grc rmvprot.c vector-demo.cvt: vector-demores.grc vector-demo.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m vector-demo.map vector-demores.grc vector-demo.c yesno.cvt: yesnores.grc yesno.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o $@ -m yesno.map yesnores.grc yesno.c diff --git a/samples/geos/grc/Makefile b/samples/geos/grc/Makefile index 360c7bc7d..101d501e8 100644 --- a/samples/geos/grc/Makefile +++ b/samples/geos/grc/Makefile @@ -39,6 +39,14 @@ else GRC := $(if $(wildcard ../../../bin/grc65*),../../../bin/grc65,grc65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_geos-cbm = \ test.s \ vlir.cvt @@ -56,9 +64,11 @@ samples: endif test.s: test.grc + $(if $(QUIET),echo $(SYS):$@) $(GRC) -s test.s test.grc vlir.cvt: vlir.grc vlir0.s vlir1.s vlir2.s + $(if $(QUIET),echo $(SYS):$@) # using separate calls here for demonstration purposes: $(GRC) -t $(SYS) -s vlir.s vlir.grc $(AS) -t $(SYS) vlir.s diff --git a/samples/kim1/Makefile b/samples/kim1/Makefile index dbdbcec8d..eca7d6524 100644 --- a/samples/kim1/Makefile +++ b/samples/kim1/Makefile @@ -37,6 +37,14 @@ else LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_kim1 = \ kimHello.bin \ kimSieve.bin \ @@ -66,40 +74,51 @@ ramfont.o: ramfont.asm $(AS) ramfont.asm -o ramfont.o kimLife.bin: kimLife.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t kim1 -C kim1-60k.cfg -Oi -o kimLife.bin kimLife.c kimTest.bin: kimTest.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t kim1 -C kim1-60k.cfg -Oi -o kimTest.bin kimTest.c kimGFX.bin: kimGFX.c subs.o ramfont.o + $(if $(QUIET),echo $(SYS):$@) $(CL) -t kim1 --listing kimGFX.lst -C kim1-mtuE000.cfg -o kimGFX.bin kimGFX.c subs.o ramfont.o -Ln kimgfx.lbl kimSieve.bin: kimSieve.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t kim1 -C kim1-60k.cfg -O -o kimSieve.bin kimSieve.c kimHello.bin: kimHello.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t kim1 -O -o kimHello.bin kimHello.c # To build an intel-format file for the CORSHAM SD card reader kimLife.hex: kimLife.bin + $(if $(QUIET),echo $(SYS):$@) srec_cat kimLife.bin -binary -offset 0x2000 -o kimLife.hex -Intel -address-length=2 kimTest.hex: kimTest.bin + $(if $(QUIET),echo $(SYS):$@) srec_cat kimTest.bin -binary -offset 0x2000 -o kimTest.hex -Intel -address-length=2 kimGFX.hex: kimGFX.bin ramfont.o + $(if $(QUIET),echo $(SYS):$@) srec_cat kimGFX.bin -binary -offset 0x2000 -o kimGFX.hex -Intel -address-length=2 # To build a paper tape file for uploading to the KIM-1 via terminal kimLife.ptp: kimLife.bin + $(if $(QUIET),echo $(SYS):$@) srec_cat kimLife.bin -binary -offset 0x2000 -o kimLife.ptp -MOS_Technologies kimGFX.ptp: kimGFX.bin + $(if $(QUIET),echo $(SYS):$@) srec_cat kimGFX.bin -binary -offset 0x2000 -o kimGFX.ptp -MOS_Technologies kimTest.ptp: kimTest.bin + $(if $(QUIET),echo $(SYS):$@) srec_cat kimTest.bin -binary -offset 0x2000 -o kimTest.ptp -MOS_Technologies clean: diff --git a/samples/lynx/Makefile b/samples/lynx/Makefile index 078ea129a..e27d5801a 100644 --- a/samples/lynx/Makefile +++ b/samples/lynx/Makefile @@ -35,6 +35,14 @@ else LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_lynx = \ hello.lnx \ mandelbrot.lnx \ @@ -59,6 +67,7 @@ endif .SUFFIXES: .c .lnx %.lnx : %.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -Oris -m $*.map -o $@ $< clean: diff --git a/samples/sim65/Makefile b/samples/sim65/Makefile index 3a06321ee..43783afca 100644 --- a/samples/sim65/Makefile +++ b/samples/sim65/Makefile @@ -37,6 +37,14 @@ else LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_sim6502 = \ cpumode_example.bin \ timer_example.bin \ @@ -61,6 +69,7 @@ endif .SUFFIXES: .c .bin %.bin : %.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -Oris -m $*.map -o $@ $< clean: diff --git a/samples/supervision/Makefile b/samples/supervision/Makefile index 9396be63d..cae5885ff 100644 --- a/samples/supervision/Makefile +++ b/samples/supervision/Makefile @@ -39,6 +39,14 @@ else SP := $(if $(wildcard ../../bin/sp65*),../../bin/sp65,sp65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_supervision = \ hello @@ -58,6 +66,7 @@ else endif hello: hello.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -O -o hello -m hello.map hello.c clean: diff --git a/samples/sym1/Makefile b/samples/sym1/Makefile index 8abcfb5aa..a5b2e35b5 100644 --- a/samples/sym1/Makefile +++ b/samples/sym1/Makefile @@ -37,6 +37,14 @@ else LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_sym1 = \ symHello.bin symTiny.bin symDisplay.bin symIO.bin symNotepad.bin symExtendedMemory.bin @@ -56,21 +64,27 @@ else endif symHello.bin: symHello.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t sym1 -O -o symHello.bin symHello.c symTiny.bin: symTiny.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t sym1 -O -o symTiny.bin symTiny.c symDisplay.bin: symDisplay.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t sym1 -O -o symDisplay.bin symDisplay.c symIO.bin: symIO.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t sym1 -C sym1-32k.cfg -O -o symIO.bin symIO.c symNotepad.bin: symNotepad.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t sym1 -C sym1-32k.cfg -O -o symNotepad.bin symNotepad.c symExtendedMemory.bin: symExtendedMemory.c + $(if $(QUIET),echo $(SYS):$@) $(CL) -t sym1 -C sym1-32k.cfg -O -o symExtendedMemory.bin symExtendedMemory.c diff --git a/samples/tutorial/Makefile b/samples/tutorial/Makefile index 685c8dd69..3c3d1edb9 100644 --- a/samples/tutorial/Makefile +++ b/samples/tutorial/Makefile @@ -37,6 +37,14 @@ else LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65) endif +ifeq ($(SILENT),s) + QUIET = 1 +endif + +ifdef QUIET + .SILENT: +endif + EXELIST_atari2600 = \ notavailable @@ -86,9 +94,12 @@ ifndef EXELIST_$(SYS) EXELIST_$(SYS) := ${patsubst %.c,%,$(wildcard *.c)} endif +all: samples + samples: $(EXELIST_$(SYS)) hello: hello.c text.s + $(if $(QUIET),echo $(SYS):$@) $(CL) -t $(SYS) -o hello hello.c text.s # empty target used to skip systems that will not work with any program in this dir