From 48a58c47bed040ea1d2ca7337c79c9fc9a3941f0 Mon Sep 17 00:00:00 2001 From: Daniel Serpell Date: Tue, 23 Apr 2024 12:04:12 -0400 Subject: [PATCH] Import mkatr into the repository and include in the compiler. This allows generating the ATR image without installing other software. --- .gitmodules | 3 +++ Makefile | 27 +++++++++++++++++++++++++++ mkatr | 1 + rules.mak | 24 ++++++++++++++++++++++-- 4 files changed, 53 insertions(+), 2 deletions(-) create mode 160000 mkatr diff --git a/.gitmodules b/.gitmodules index 2e42091..a935df7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "testsuite/mini65"] path = testsuite/mini65 url = https://github.com/dmsc/mini65-sim +[submodule "mkatr"] + path = mkatr + url = git@github.com:dmsc/mkatr.git diff --git a/Makefile b/Makefile index d60c4cc..2da8d4f 100644 --- a/Makefile +++ b/Makefile @@ -106,11 +106,15 @@ FASTBASIC_HOST=build/bin/fastbasic$(HOST_EXT) CA65_HOST=build/bin/ca65$(HOST_EXT) LD65_HOST=build/bin/ld65$(HOST_EXT) AR65_HOST=build/bin/ar65$(HOST_EXT) +MKATR_HOST=build/bin/mkatr$(HOST_EXT) +LSATR_HOST=build/bin/lsatr$(HOST_EXT) FASTBASIC_TARGET=build/compiler/fastbasic$(TGT_EXT) CA65_TARGET=build/compiler/ca65$(TGT_EXT) LD65_TARGET=build/compiler/ld65$(TGT_EXT) AR65_TARGET=build/compiler/ar65$(TGT_EXT) +MKATR_TARGET=build/compiler/mkatr$(TGT_EXT) +LSATR_TARGET=build/compiler/lsatr$(TGT_EXT) LIB_INT=build/compiler/fastbasic-int.lib LIB_FP=build/compiler/fastbasic-fp.lib @@ -566,6 +570,25 @@ AR65_SRC=\ cc65/ar65/objdata.c\ cc65/ar65/objfile.c\ +MKATR_SRC=\ + mkatr/src/atr.c\ + mkatr/src/compat.c\ + mkatr/src/crc32.c\ + mkatr/src/darray.c\ + mkatr/src/flist.c\ + mkatr/src/mkatr.c\ + mkatr/src/msg.c\ + mkatr/src/spartafs.c\ + +LSATR_SRC=\ + mkatr/src/atr.c\ + mkatr/src/compat.c\ + mkatr/src/lsatr.c\ + mkatr/src/lsdos.c\ + mkatr/src/lsextra.c\ + mkatr/src/lssfs.c\ + mkatr/src/msg.c\ + # Syntax file parser SYNTAX_PARSER_SRC=\ synt-emit-asm.cc\ @@ -600,6 +623,8 @@ COMPILER_HOST=\ $(CA65_HOST)\ $(LD65_HOST)\ $(AR65_HOST)\ + $(MKATR_HOST)\ + $(LSATR_HOST)\ $(FASTBASIC_HOST)\ build/bin/fb$(HOST_EXT)\ @@ -608,6 +633,8 @@ COMPILER_TARGET=\ $(CA65_TARGET)\ $(LD65_TARGET)\ $(AR65_TARGET)\ + $(MKATR_TARGET)\ + $(LSATR_TARGET)\ $(FASTBASIC_TARGET)\ build/compiler/fb$(TGT_EXT)\ diff --git a/mkatr b/mkatr new file mode 160000 index 0000000..323186c --- /dev/null +++ b/mkatr @@ -0,0 +1 @@ +Subproject commit 323186ce2afaaf23b92d90dbcf2991ae75bfee26 diff --git a/rules.mak b/rules.mak index 4c4b336..4dd2e5c 100644 --- a/rules.mak +++ b/rules.mak @@ -46,9 +46,9 @@ distclean: clean test -d $$folder && rmdir $$folder || true ; done # Build an ATR disk image using "mkatr". -$(ATR): $(DOS:%=$(DOSDIR)/%) $(FILES) | build +$(ATR): $(DOS:%=$(DOSDIR)/%) $(FILES) | $(MKATR_HOST) build $(ECHO) "Creating ATR disk image" - $(Q)mkatr $@ $(DOSDIR) -b $^ + $(Q)$(MKATR_HOST) $@ $(DOSDIR) -b $^ # Build compiler ZIP file. $(ZIPFILE): $(COMPILER_COMMON) $(COMPILER_TARGET) $(COMPILER_MANIFESTS) | build @@ -105,6 +105,18 @@ $(AR65_HOST): $(AR65_SRC) | build/bin $(ECHO) "Compile AR65" $(Q)$(CC) $(HOST_CFLAGS) $(CC65_CFLAGS) -o $@ $^ +$(MKATR_HOST): $(MKATR_SRC) | mkatr/src build/bin + $(ECHO) "Compile MKATR" + $(Q)$(CC) $(HOST_CFLAGS) -o $@ $^ + +$(LSATR_HOST): $(LSATR_SRC) | mkatr/src build/bin + $(ECHO) "Compile LSATR" + $(Q)$(CC) $(HOST_CFLAGS) -o $@ $^ + +# Update mkatr submodule if not found +mkatr/src: + $(Q)git submodule update --init mkatr + # Target compiler build ifeq ($(CROSS),) # No cross-compilation, just copy host tools to target tools: @@ -132,6 +144,14 @@ $(AR65_TARGET): $(AR65_SRC) | build/compiler $(ECHO) "Compile target AR65" $(Q)$(CROSS)$(CC) $(TARGET_CFLAGS) $(CC65_CFLAGS) -o $@ $^ +$(MKATR_TARGET): $(MKATR_SRC) | mkatr/src build/compiler + $(ECHO) "Compile target MKATR" + $(Q)$(CROSS)$(CC) $(TARGET_CFLAGS) -o $@ $^ + +$(LSATR_TARGET): $(LSATR_SRC) | mkatr/src build/compiler + $(ECHO) "Compile target LSATR" + $(Q)$(CROSS)$(CC) $(TARGET_CFLAGS) -o $@ $^ + # Copy compatibility binaries build/compiler/fb$(TGT_EXT): build/compiler/fastbasic$(TGT_EXT) $(Q)cp -f $< $@