From a92bf346b40a55c06fa89327f1eeed4185964d76 Mon Sep 17 00:00:00 2001 From: Philip Zembrod Date: Sat, 6 Feb 2021 23:20:37 +0100 Subject: [PATCH] Refactor source vars in main Makefile, and add recompile-cc64.zip target --- Makefile | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index a2348c1..0f72795 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,21 @@ # cc64 sources and binaries commonsrcs_ascii = $(wildcard src/common/*.fth) -commonsrcs_c64 = $(patsubst src/common/%, c64files/%, $(commonsrcs_ascii)) -commonsrcs_c16 = $(patsubst src/common/%, c16files/%, $(commonsrcs_ascii)) -commonsrcs_x16 = $(patsubst src/common/%, x16files/%, $(commonsrcs_ascii)) +commonsrcs = $(patsubst src/common/%, %, $(commonsrcs_ascii)) cc64srcs_ascii = $(wildcard src/cc64/*.fth) -cc64srcs_c64 = $(patsubst src/cc64/%, c64files/%, $(cc64srcs_ascii)) \ - $(commonsrcs_c64) -cc64srcs_c16 = $(patsubst src/cc64/%, c16files/%, $(cc64srcs_ascii)) \ - $(commonsrcs_c16) -cc64srcs_x16 = $(patsubst src/cc64/%, x16files/%, $(cc64srcs_ascii)) \ - $(commonsrcs_x16) +cc64srcs = $(patsubst src/cc64/%, %, $(cc64srcs_ascii)) peddisrcs_ascii = $(wildcard src/peddi/*.fth) -peddisrcs_c64 = $(patsubst src/peddi/%, c64files/%, $(peddisrcs_ascii)) \ - $(commonsrcs_c64) -peddisrcs_c16 = $(patsubst src/peddi/%, c16files/%, $(peddisrcs_ascii)) \ - $(commonsrcs_c16) +peddisrcs = $(patsubst src/peddi/%, %, $(peddisrcs_ascii)) +cc64srcs_c64 = $(patsubst %, c64files/%, $(cc64srcs) $(commonsrcs)) +cc64srcs_c16 = $(patsubst %, c16files/%, $(cc64srcs) $(commonsrcs)) +cc64srcs_x16 = $(patsubst %, x16files/%, $(cc64srcs) $(commonsrcs)) +peddisrcs_c64 = $(patsubst %, c64files/%, $(peddisrcs) $(commonsrcs)) +peddisrcs_c16 = $(patsubst %, c16files/%, $(peddisrcs) $(commonsrcs)) cc64_binaries = cc64 cc64pe peddi cc64_c64_t64_files = $(patsubst %, autostart-c64/%.T64, $(cc64_binaries)) cc64_c16_t64_files = $(patsubst %, autostart-c16/%.T64, $(cc64_binaries)) +# runtime and sample files rt_files = \ rt-c64-0801.h rt-c64-0801.i rt-c64-0801.o \ rt-c16-1001.h rt-c16-1001.i rt-c16-1001.o \ @@ -40,6 +36,13 @@ c16dir_files = $(patsubst %, c16files/% , $(c16dir_content)) x16dir_content = cc64 $(rt_files) $(sample_files) c-charset x16dir_files = $(patsubst %, x16files/% , $(x16dir_content)) +# PETSCII sources and VolksForth bases for manual recompile +recompile_dir = recompile-cc64 +recompile_srcs = $(patsubst %, $(recompile_dir)/%, \ + $(cc64srcs) $(peddisrcs) $(commonsrcs)) +recompile_forths = $(patsubst forth/%, $(recompile_dir)/%, \ + $(wildcard forth/v4th*)) + # Forth binaries forth_binaries = devenv-uF83 forth_t64_files = $(patsubst %, autostart-c64/%.T64, $(forth_binaries)) @@ -50,7 +53,8 @@ all: c64 c16 x16 etc release: cc64-doc.zip \ cc64-c64files.zip cc64-c64files.d64 \ cc64-c16files.zip cc64-c16files.d64 \ - cc64-x16files.zip cc64-x16files-sdcard.zip + cc64-x16files.zip cc64-x16files-sdcard.zip \ + $(recompile_dir).zip rm -rf release mkdir release cp -p $^ release/ @@ -80,6 +84,10 @@ cc64-x16files.zip: $(x16dir_files) COPYING rm -f $@ zip -r $@ $^ +$(recompile_dir).zip: $(recompile_srcs) $(recompile_forths) COPYING + rm -f $@ + zip -r $@ $^ + cc64-c64files.d64: $(c64dir_files) tmp/copying rm -f $@ c1541 -format cc64-c64,cc d64 $@ @@ -152,6 +160,7 @@ clean: rm -f [cx][16][64]files/notdone rm -f emulator/sdcard.img tmp/* cc64-doc.zip rm -rf release + rm -rf $(recompile_dir) $(recompile_dir).zip $(MAKE) -C tests/e2e clean $(MAKE) -C tests/integration clean $(MAKE) -C tests/peddi clean @@ -232,6 +241,9 @@ c16files/vf-build-base: forth/v4th-c16+ x16files/vf-build-base: forth/v4th-x16 cp $< $@ +$(recompile_dir)/%: forth/% + cp $< $@ + # Runtime module rules @@ -351,7 +363,7 @@ emulator/sdcard.img: emulator/sdcard.sfdisk emulator/mk-sdcard.sh emulator/mk-sdcard.sh emulator/sdcard.sfdisk $@ -# Rules, mostly generic, to populate c64files/, c16files/ +# Rules, mostly generic, to populate c64files/, c16files/, x16files/ c64files/%.fth: src/*/%.fth ascii2petscii $< $@ @@ -377,6 +389,11 @@ x16files/%.c: src/*/%.c ascii2petscii $< $@ touch -r $< $@ +$(recompile_dir)/%.fth: src/*/%.fth + test -d $(recompile_dir) || mkdir $(recompile_dir) + ascii2petscii $< $@ + touch -r $< $@ + tmp/copying: COPYING test -d tmp || mkdir tmp ascii2petscii $< $@