@@ -18,6 +18,8 @@ FUJINET_LIB_VERSION_DIR = $(FUJINET_LIB)/$(FUJINET_LIB_VERSION)-$(TARGETS)
1818# Name of the final, single-file executable.
1919# Default: name of the current dir with target name appended
2020PROGRAM := config
21+ R2R_DIR := r2r/$(TARGETS)
22+ R2R_BIN := $(R2R_DIR)/autorun.atr
2123
2224# Path(s) to additional libraries required for linking the program
2325# Use only if you don't want to place copies of the libraries in SRCDIR
@@ -284,7 +286,7 @@ ASFLAGS += --asm-include-dir src/$(TARGETLIST)/asminc --asm-include-dir $(FUJINE
284286CFLAGS += --include-dir $(FUJINET_LIB_VERSION_DIR) -DUSING_FUJINET_LIB
285287
286288.SUFFIXES:
287- .PHONY: all test clean get_fujinet_lib zap
289+ .PHONY: all test clean get_fujinet_lib zap r2r
288290
289291all: get_fujinet_lib $(PROGRAM)
290292
@@ -344,6 +346,9 @@ get_fujinet_lib:
344346$(TARGETOBJDIR):
345347 $(call MKDIR,$@)
346348
349+ $(R2R_DIR):
350+ $(call MKDIR,$@)
351+
347352vpath %.c $(SRCDIR)/$(TARGETLIST) $(SRCDIR)
348353
349354$(TARGETOBJDIR)/%.o: %.c | $(TARGETOBJDIR)
@@ -357,33 +362,38 @@ $(TARGETOBJDIR)/%.o: %.s | $(TARGETOBJDIR)
357362$(PROGRAM): $(CONFIG) $(OBJECTS) $(LIBS)
358363 $(CC) -t $(CC65TARGET) $(LDFLAGS) -o $@ $(patsubst %.cfg,-C %.cfg,$^)
359364
365+ # Create the "Ready 2 Run" executable/disk
366+ r2r: $(R2R_BIN)
367+
360368test: $(PROGRAM)
361369 $(PREEMUCMD)
362370 $(EMUCMD) $<
363371 $(POSTEMUCMD)
364372
365373test-atr: $(PROGRAM) dist
366374 $(PREEMUCMD) \
367- $(EMUCMD) //disk autorun.atr \
375+ $(EMUCMD) //disk $(R2R_BIN) \
368376 $(POSTEMUCMD)
369377
370- dist : $(PROGRAM)
378+ $(R2R_BIN) : $(PROGRAM)
371379 mkdir -p dist
372380 cp ../fujinet-tools/atari/dist/*.COM dist/ || true
373381 cp ../fujinet-tools/atari/dist/*.com dist/ || true
374382 cp $(PROGRAM) dist/
375- dir2atr -m -S -B picoboot.bin autorun.atr dist/
383+ dir2atr -m -S -B picoboot.bin $@ dist/
384+
385+ dist: $(R2R_BIN)
376386
377387dist-z: $(PROGRAM)
378388 @if [ -d "../fujinet-config-loader" ] ; then \
379- echo "Found fujinet-config-loader, creating compressed autorun.atr "; \
389+ echo "Found fujinet-config-loader, creating compressed $(R2R_BIN) "; \
380390 $(MAKE) -C ../fujinet-config-loader clean dist > /dev/null 2>&1 ; \
381391 if [ $$? -ne 0 ] ; then \
382392 echo "ERROR running compressor"; \
383393 exit 1; \
384394 fi; \
385- cp ../fujinet-config-loader/autorun-zx0.atr ./autorun.atr ; \
386- echo "Compressed file saved as autorun.atr "; \
395+ cp ../fujinet-config-loader/autorun-zx0.atr ./$(R2R_BIN) ; \
396+ echo "Compressed file saved as $(R2R_BIN) "; \
387397 else \
388398 echo "ERROR: Could not find fujinet-config-loader in sibling directory to current."; \
389399 exit 1; \
0 commit comments