@@ -17,6 +17,8 @@ FUJINET_LIB_VERSION_DIR = $(FUJINET_LIB)/$(FUJINET_LIB_VERSION)-$(TARGETS)
1717# Name of the final, single-file executable.
1818# Default: name of the current dir with target name appended
1919PROGRAM := config
20+ R2R_DIR := r2r/$(TARGETS)
21+ DISK := $(R2R_DIR)/autorun.po
2022
2123# Path(s) to additional libraries required for linking the program
2224# Use only if you don't want to place copies of the libraries in SRCDIR
@@ -256,7 +258,7 @@ ASFLAGS += --asm-include-dir src/$(TARGETLIST)/asminc --asm-include-dir $(FUJINE
256258CFLAGS += --include-dir $(FUJINET_LIB_VERSION_DIR) -DUSING_FUJINET_LIB
257259
258260.SUFFIXES:
259- .PHONY: all test clean get_fujinet_lib zap love
261+ .PHONY: all test clean get_fujinet_lib zap love dist r2r
260262
261263all: get_fujinet_lib $(PROGRAM)
262264
@@ -316,6 +318,9 @@ get_fujinet_lib:
316318$(TARGETOBJDIR):
317319 $(call MKDIR,$@)
318320
321+ $(R2R_DIR):
322+ $(call MKDIR,$@)
323+
319324vpath %.c $(SRCDIR)/$(TARGETLIST) $(SRCDIR)
320325
321326$(TARGETOBJDIR)/%.o: %.c | $(TARGETOBJDIR)
@@ -344,24 +349,29 @@ test: $(PROGRAM)
344349 $(EMUCMD) $<
345350 $(POSTEMUCMD)
346351
347- dist: $(PROGRAM)
348- cp dist.apple2/bootable.po dist.apple2/dist.po
349- ./dist.apple2/add-file.sh dist.apple2/dist.po config config.system
352+ $(DISK): $(PROGRAM) | $(R2R_DIR)
353+ cp dist.apple2/bootable.po $@
354+ ./dist.apple2/add-file.sh $@ config config.system
355+
356+ dist: $(DISK)
350357 @( \
351- echo "Attempting to copy autorun.po to firmware folder outside of project" ; \
358+ echo "Attempting to copy $(DISK) to firmware folder outside of project" ; \
352359 if [ -d ../fujinet-firmware/ ] ; then \
353360 echo "Copying into ../fujinet-firmware" ; \
354- cp dist.apple2/dist.po ../fujinet-firmware/data/webui/device_specific/BUILD_APPLE/autorun.po ; \
361+ cp dist.apple2/dist.po ../fujinet-firmware/data/webui/device_specific/BUILD_APPLE/$(DISK) ; \
355362 elif [ -d ../fujinet-platformio/ ] ; then \
356363 echo "Copying into ../fujinet-platformio (NOTE: please consider renaming to updated fujinet-firmware name)" ; \
357- cp dist.apple2/dist.po ../fujinet-platformio/data/webui/device_specific/BUILD_APPLE/autorun.po ; \
364+ cp dist.apple2/dist.po ../fujinet-platformio/data/webui/device_specific/BUILD_APPLE/$(DISK) ; \
358365 else \
359- echo "ERROR: Could not find fujinet firmware folder to copy autorun.po to." ; \
366+ echo "ERROR: Could not find fujinet firmware folder to copy $(DISK) to." ; \
360367 echo "Tried ../fujinet-firmware, and ../fujinet-platformio" ; \
361368 exit 1 ; \
362369 fi ; \
363370 )
364371
372+ # Create the "Ready 2 Run" executable/disk
373+ r2r: get_fujinet_lib $(DISK)
374+
365375gendebug: $(PROGRAM)
366376 @echo "Generating debug.scr script for AppleWin"
367377 @echo 'echo "Loading symbols"' > debug.scr
@@ -375,7 +385,7 @@ clean:
375385 $(call RMFILES,$(REMOVES))
376386 $(call RMFILES,$(PROGRAM))
377387 $(call RMFILES,*.map)
378- rm -rf dist/
388+ rm -rf dist/ $(R2R_DIR)
379389
380390else # $(words $(TARGETLIST)),1
381391
0 commit comments