Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ The build system is plain `make`. The top-level `Makefile` delegates to `src/` a

```sh
make # builds aamshow, aambundle, 6502 blobs, then runs tests
make no6502 # builds C tools and tests them without rebuilding 6502 assets
make 6502 # builds only the 6502 engine, frontends, and the aambox6502 emulator
make windows # cross-compiles .exe versions (needs i686-w64-mingw32-gcc)
make test # runs the test suite (requires the C tools to be built)
make clean # removes build outputs
make clean # removes build outputs and test transcripts
make install # copies aamshow and aambundle to /usr/local/bin
```

Expand Down
24 changes: 10 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
BINARIES=src/aamshow src/aambundle
# Full build: the 6502 blobs, then the C tools that embed them, then the tests.
all: tools test

all: $(BINARIES) 6502 test

src/aamshow:
$(MAKE) -C src

src/aambundle:
# "make -C src" builds the 6502 side first, then the C tools.
tools:
$(MAKE) -C src

windows:
$(MAKE) -C src windows

# Only the 6502 engine, frontends, and the aambox6502 emulator.
6502:
$(MAKE) -C src 6502

no6502: $(BINARIES) test
windows:
$(MAKE) -C src windows

test: $(BINARIES)
test: tools
$(MAKE) -C test

install: $(BINARIES)
install: tools
$(MAKE) -C src install

tidy:
Expand All @@ -35,4 +31,4 @@ uninstall:

distclean: clean uninstall

.PHONY: all test clean tidy install uninstall distclean windows 6502 no6502
.PHONY: all tools windows 6502 test clean tidy install uninstall distclean
8 changes: 6 additions & 2 deletions src/6502/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ check_xa:
echo " macOS: brew install xa"; \
echo " Debian/Ubuntu: apt install xa65"; \
echo " From source: https://www.floodgap.com/retrotech/xa/"; \
echo "(To build the C tools without any 6502 code, run 'make no6502' from the top level.)"; \
exit 1; fi

check_acme:
Expand All @@ -18,13 +17,18 @@ check_acme:
echo " macOS: brew install acme"; \
echo " Debian/Ubuntu: apt install acme"; \
echo " From source: https://github.com/meonwax/acme"; \
echo "(Only the Apple II targets need acme; the C64 and aambox targets build with xa alone.)"; \
exit 1; fi

clean:
rm -rf aambox6502 cruncher labels c64.labels mkfont
rm -f a2_frontend.bin a2_prorwts2.bin a2.labels a2.system a2_0boot.bin a2_sboot.bin a2_sboot.labels

mkfont: mkfont.c
${CC} ${CFLAGS} -o $@ mkfont.c

cruncher: cruncher.c
${CC} ${CFLAGS} -o $@ cruncher.c

aambox6502: aambox6502.c fake6502.c

aambox_frontend.bin: aambox_frontend.s engine.s | check_xa
Expand Down
52 changes: 39 additions & 13 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,33 @@ endif
MINGW32 = i686-w64-mingw32-gcc
INSTALLDIR = /usr/local/bin

all: aamshow aambundle

windows: aamrun.exe aamshow.exe aambundle.exe
# The C tools embed binary blobs produced by the 6502 sub-make (table_*.h).
# GNU make caches a file's timestamp before it runs a sub-make, so a single
# pass cannot tell whether the sub-make actually refreshed a blob. Build the
# 6502 side first, then re-enter make: the second pass stats the blobs fresh
# and regenerates only the headers that really changed.
all: 6502
$(MAKE) tools

6502:
$(MAKE) -C 6502

tools: aamshow aambundle

windows: 6502
$(MAKE) windows-tools

windows-tools: aamrun.exe aamshow.exe aambundle.exe

tidy:
rm -f *.o

clean: tidy
rm -f aamshow aambundle aamrun aamshow.exe aambundle.exe aamrun.exe
rm -f mkheader mkfontdata table_*.h tables_*.h
$(MAKE) -C 6502 clean

install: aamshow aambundle
install: all
cp aamshow $(INSTALLDIR)
cp aambundle $(INSTALLDIR)

Expand Down Expand Up @@ -91,31 +103,45 @@ aambundle.exe: aambundle.c bundle_web.c bundle_c64.c bundle_apple2.c \
tables_6502font.h
${MINGW32} ${CFLAGS} -o $@ aambundle.c bundle_web.c bundle_c64.c bundle_apple2.c

# Fall back rules when you make a blob from here
# e.g. "make -C src aambundle" redirects to "make -C 6502"
BLOBS = 6502/a2.system 6502/a2_0boot.bin 6502/a2_sboot.bin \
6502/c64_drivecode.bin 6502/c64_loader.prg 6502/c64_crunched.bin

$(BLOBS):
$(MAKE) -C 6502 $(@F)

mkheader: mkheader.c
${CC} ${CFLAGS} -o $@ mkheader.c

mkfontdata: mkfontdata.c
${CC} ${CFLAGS} -o $@ mkfontdata.c

tables_6502font.h: 6502/fontdef.txt mkfontdata
./mkfontdata <6502/fontdef.txt >tables_6502font.h

table_a2terp.h: 6502 6502/a2.system mkheader
table_a2terp.h: 6502/a2.system mkheader
./mkheader table_a2terp <6502/a2.system >$@

table_a20boot.h: 6502 6502/a2_0boot.bin mkheader
table_a20boot.h: 6502/a2_0boot.bin mkheader
./mkheader table_a20boot <6502/a2_0boot.bin >$@

table_a2sboot.h: 6502 6502/a2_sboot.bin mkheader
table_a2sboot.h: 6502/a2_sboot.bin mkheader
./mkheader table_a2sboot <6502/a2_sboot.bin >$@

table_a2license.h: 6502 6502/license.txt 6502/a2_thirdparty_license.txt mkheader
table_a2license.h: 6502/license.txt 6502/a2_thirdparty_license.txt mkheader
cat 6502/license.txt 6502/a2_thirdparty_license.txt | ./mkheader table_a2license >$@

table_c64license.h: 6502 6502/license.txt mkheader
table_c64license.h: 6502/license.txt mkheader
./mkheader table_c64license <6502/license.txt >$@

table_c64drive.h: 6502 6502/c64_drivecode.bin mkheader
table_c64drive.h: 6502/c64_drivecode.bin mkheader
./mkheader table_c64drive <6502/c64_drivecode.bin >$@

table_c64load.h: 6502 6502/c64_loader.prg mkheader
table_c64load.h: 6502/c64_loader.prg mkheader
./mkheader table_c64load <6502/c64_loader.prg >$@

table_c64terp.h: 6502 6502/c64_crunched.bin mkheader
table_c64terp.h: 6502/c64_crunched.bin mkheader
./mkheader table_c64terp <6502/c64_crunched.bin >$@

table_weblicense.h: js/license.txt mkheader
Expand All @@ -136,4 +162,4 @@ table_jquery.h: js/jquery-3.4.1.min.js mkheader
table_play.h: js/webfrontend.html mkheader
./mkheader table_play <$< >$@

.PHONY: all clean tidy install uninstall distclean windows 6502
.PHONY: all tools windows windows-tools clean tidy install uninstall distclean 6502
47 changes: 29 additions & 18 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
all: test clean
## Tests:
## gosling - 0.x file using 67 ENTER_STATUS_0 and E7 LEAVE_STATUS
## body_not_status - 1.x file using 67 BODY_STYLE and EF LEAVE_STATUS
## impossible - whatever the latest version of Dialog produces (update periodically)
## codepoints - Character set and status bar exercise; source is in the directory

TESTDIRS = gosling body_not_status impossible codepoints

TESTS = $(addprefix test-,$(TESTDIRS))
CLEANS = $(addprefix clean-,$(TESTDIRS))

# Transcripts (.out files) are left in place so a second `make` only re-diffs;
# `make clean` (or deleting the .out files) forces a full re-run.
all: test

test: $(TESTS)

# Static pattern rules (not plain pattern rules): the targets are named
# explicitly, so they can be declared .PHONY without make refusing to apply
# the rule -- implicit-rule search is skipped for phony targets.
$(TESTS): test-%:
$(MAKE) -C $* test

# Tests for Apple II interpreter (not run by make test)
apple2:
$(MAKE) -C apple2 test

test:
## This one is a 0.x file using 67 ENTER_STATUS_0 and E7 LEAVE_STATUS
make -C gosling test
## This one is a 1.x file using 67 BODY_STYLE and EF LEAVE_STATUS
make -C body_not_status test
## This one is whatever the latest version of Dialog produces (update periodically)
make -C impossible test
## Character set and status bar exercise; source is in the directory
make -C codepoints test

clean:
$(MAKE) -C gosling clean
$(MAKE) -C body_not_status clean
$(MAKE) -C impossible clean
$(MAKE) -C codepoints clean

.PHONY: all test apple2 clean
clean: $(CLEANS)

$(CLEANS): clean-%:
$(MAKE) -C $* clean

.PHONY: all test apple2 clean $(TESTS) $(CLEANS)
39 changes: 7 additions & 32 deletions test/aa-exercise/Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,12 @@
# Call `make DIFF=meld` to get a fancy diff
DIFF = diff

DIR6502 = ../../src/6502
AAMBOX = $(DIR6502)/aambox6502
FRONTEND = $(DIR6502)/aambox_frontend.bin
# The story source is aavm assembly (aa-exercise.scm). Since the aavm
# assembler lives outside this repo, producing the .aastory is a separate
# `make assemble` step; `make test` (and the top-level test suite) does not
# include this directory.
ASSEMBLE = ../../../aavm/aavm.scm

$(AAMBOX):
$(MAKE) -C $(DIR6502) aambox6502

$(FRONTEND):
$(MAKE) -C $(DIR6502) aambox_frontend.bin
include ../common.mk

assemble:
$(ASSEMBLE) -S aa-exercise.scm aa-exercise.aastory

all: test

test: test.js test.6502

test.js: aa-exercise.js.out
$(DIFF) aa-exercise.js.out aa-exercise.js.gold

aa-exercise.js.out: aa-exercise.aastory
node ../../src/js/nodefrontend.js -s 1234 aa-exercise.aastory <aa-exercise.in >aa-exercise.js.out

test.6502: aa-exercise.6502.out
$(DIFF) aa-exercise.6502.out aa-exercise.6502.gold

aa-exercise.6502.out: aa-exercise.aastory $(AAMBOX) $(FRONTEND)
$(AAMBOX) -s 1234 $(FRONTEND) aa-exercise.aastory <aa-exercise.in >aa-exercise.6502.out

clean:
rm -f *.out
$(ASSEMBLE) -S $(STORY).scm $(STORY).aastory

.PHONY: all test test.js test.6502 clean
.PHONY: assemble
37 changes: 5 additions & 32 deletions test/body_not_status/Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
# Call `make DIFF=meld` to get a fancy diff
DIFF = diff
# The JS and 6502 engines must produce identical output here, so both
# engines diff against the same gold file.
JS_GOLD = $(STORY).gold
GOLD6502 = $(STORY).gold

DIR6502 = ../../src/6502
AAMBOX = $(DIR6502)/aambox6502
FRONTEND = $(DIR6502)/aambox_frontend.bin

$(AAMBOX):
$(MAKE) -C $(DIR6502) aambox6502

$(FRONTEND):
$(MAKE) -C $(DIR6502) aambox_frontend.bin

all: test

test: test.js test.6502

test.js: body_not_status.js.out
$(DIFF) body_not_status.js.out body_not_status.gold

body_not_status.js.out: body_not_status.aastory
node ../../src/js/nodefrontend.js -s 1234 body_not_status.aastory <body_not_status.in >body_not_status.js.out

test.6502: body_not_status.6502.out
$(DIFF) body_not_status.6502.out body_not_status.gold

body_not_status.6502.out: body_not_status.aastory $(AAMBOX) $(FRONTEND)
$(AAMBOX) -s 1234 $(FRONTEND) body_not_status.aastory <body_not_status.in >body_not_status.6502.out

clean:
rm -f *.out

.PHONY: all test test.js test.6502 clean
include ../common.mk
52 changes: 12 additions & 40 deletions test/codepoints/Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,8 @@
# Call `make DIFF=meld` to get a fancy diff
DIFF = diff

DIR6502 = ../../src/6502
AAMBOX = $(DIR6502)/aambox6502
FRONTEND = $(DIR6502)/aambox_frontend.bin
AAMBUNDLE = ../../src/aambundle
# The story is compiled from Dialog source with an external compiler.
DIALOGC ?= dialogc
AAMBUNDLE = ../../src/aambundle

$(AAMBOX):
$(MAKE) -C $(DIR6502) aambox6502

$(FRONTEND):
$(MAKE) -C $(DIR6502) aambox_frontend.bin

$(AAMBUNDLE):
$(MAKE) -C ../../src aambundle

all: test

test: test.js test.6502

test.js: codepoints.js.out
$(DIFF) codepoints.js.out codepoints.js.gold

codepoints.js.out: codepoints.aastory
node ../../src/js/nodefrontend.js -s 1234 codepoints.aastory <codepoints.in >codepoints.js.out

test.6502: codepoints.6502.out
$(DIFF) codepoints.6502.out codepoints.6502.gold

codepoints.6502.out: codepoints.aastory $(AAMBOX) $(FRONTEND)
$(AAMBOX) -s 1234 $(FRONTEND) codepoints.aastory <codepoints.in >codepoints.6502.out

codepoints.aastory: codepoints.dg
$(DIALOGC) -t aa -o $@ $<
include ../common.mk

# Neither the node frontend nor the aambox frontend renders a status area, and
# neither one transliterates -- both emit UTF-8 straight through. So the two
Expand All @@ -60,11 +29,14 @@ codepoints.aastory: codepoints.dg
# neither may the (clear all) that follows it.
# (Use +/- to nudge the status bar height for 24/25 row systems.)

disks: codepoints.aastory $(AAMBUNDLE)
$(AAMBUNDLE) -t apple2 -o codepoints codepoints.aastory
$(AAMBUNDLE) -t c64 -o codepoints codepoints.aastory
$(STORY).aastory: $(STORY).dg
$(DIALOGC) -t aa -o $@ $<

$(AAMBUNDLE):
$(MAKE) -C ../../src aambundle

clean:
rm -f *.out
disks: $(STORY).aastory $(AAMBUNDLE)
$(AAMBUNDLE) -t apple2 -o $(STORY) $(STORY).aastory
$(AAMBUNDLE) -t c64 -o $(STORY) $(STORY).aastory

.PHONY: all test test.js test.6502 disks clean
.PHONY: disks
Loading
Loading