Skip to content

Commit

Permalink
Import mkatr into the repository and include in the compiler.
Browse files Browse the repository at this point in the history
This allows generating the ATR image without installing other software.
  • Loading branch information
dmsc committed Apr 23, 2024
1 parent d29355c commit 48a58c4
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "testsuite/mini65"]
path = testsuite/mini65
url = https://github.com/dmsc/mini65-sim
[submodule "mkatr"]
path = mkatr
url = [email protected]:dmsc/mkatr.git
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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\
Expand Down Expand Up @@ -600,6 +623,8 @@ COMPILER_HOST=\
$(CA65_HOST)\
$(LD65_HOST)\
$(AR65_HOST)\
$(MKATR_HOST)\
$(LSATR_HOST)\
$(FASTBASIC_HOST)\
build/bin/fb$(HOST_EXT)\

Expand All @@ -608,6 +633,8 @@ COMPILER_TARGET=\
$(CA65_TARGET)\
$(LD65_TARGET)\
$(AR65_TARGET)\
$(MKATR_TARGET)\
$(LSATR_TARGET)\
$(FASTBASIC_TARGET)\
build/compiler/fb$(TGT_EXT)\

Expand Down
1 change: 1 addition & 0 deletions mkatr
Submodule mkatr added at 323186
24 changes: 22 additions & 2 deletions rules.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 $< $@
Expand Down

0 comments on commit 48a58c4

Please sign in to comment.