aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2022-11-17 01:36:41 -0500
committerB. Watson <urchlay@slackware.uk>2022-11-17 01:36:41 -0500
commit6c612710debc11f942e4390aa636991e22d40d89 (patch)
tree2f58c2c37e7bd4d5bb5ce2e9b62edd35d78326a2
parent10ab105c3817faad03f49804b0f79b7d14579f07 (diff)
downloaddla-asm-6c612710debc11f942e4390aa636991e22d40d89.tar.gz
Clean up and comment Makefile.
-rw-r--r--Makefile36
1 files changed, 25 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index a1f5c92..19bb980 100644
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,39 @@
# Makefile for dla-asm.
# See https://slackware.uk/~urchlay/repos/dla-asm
+# We are pretending that cl65 is 2 different things: an assembler
+# and a C compiler. CL65FLAGS should only be flags that apply to both.
CL65=cl65
-CL65FLAGS=
+CL65FLAGS=-g
-PERL=perl
+# CA65FLAGS only applies to cl65 when it's run as an assembler.
+CA65=$(CL65)
+CA65FLAGS=-t none
+
+# CC65FLAGS only applies to cl65 when it's run as a C compiler.
+# Turn off unused parameter warnings because cc65 insists on complaining
+# that argc and argv are unused.
+# Note that using 0x2d00 for the start address makes the Atari crash
+# when exiting dla2csv.xex in MyDOS 4.50, but 0x2800 is fine. 0x2000
+# also works, but not all DOSes have MEMLO set that low... must investigate
+# why this happens.
+CC65=$(CL65)
+CC65FLAGS=-t atari -W -unused-param --start-addr 0x2800
+# Host C compiler (usually a symlink to gcc or clang).
CC=cc
CFLAGS=-O2 -Wall
+# Most OSes that have perl, have it in /usr/bin (and in $PATH).
+PERL=perl
+
+# Don't forget to list all phony targets here!
.PHONY: all disk test disktest realtest tnfs clean distclean
all: dla.xex dla2csv dla2csv.xex dla2img.sh
dla.xex: dla.s io.s dlatbl.s xex.inc printint.s render.s drunkwalk.s dlaver.h
- $(CL65) $(CL65FLAGS) -l dla.list -Ln dla.labels -t none -o dla.xex dla.s
+ $(CA65) $(CL65FLAGS) $(CA65FLAGS) -l dla.list -Ln dla.labels -o dla.xex dla.s
dla2img.sh: VERSION
$(PERL) d2iver.pl dla2img.sh
@@ -32,16 +51,11 @@ dla2csv: dla2csv.c dlaver.h
$(CC) $(CFLAGS) -o dla2csv dla2csv.c \
|| echo "Couldn't build host dla2csv; continuing without it"
-# turn off unused parameter warnings because cc65 insists on complaining
-# that argc and argv are unused.
-# note that using 0x2d00 for the start address makes the atari crash
-# when exiting dla2csv.xex in MyDOS 4.50, but 0x2800 is fine. 0x2000
-# also works, but not all DOSes have MEMLO set that low...
dla2csv.xex: dla2csv.c dlaver.h
- $(CL65) $(CL65FLAGS) -t atari -W -unused-param -m dla2csv.map --start-addr 0x2800 -o $@ dla2csv.c
+ $(CC65) $(CL65FLAGS) $(CC65FLAGS) -Ln dla2csv.labels -l dla2csv.list -m dla2csv.map -o $@ dla2csv.c
autorun.sys: autorun.s about.dat
- $(CL65) $(CL65FLAGS) -l autorun.list -t none -o autorun.sys autorun.s
+ $(CA65) $(CL65FLAGS) $(CA65FLAGS) -Ln autorun.labels -l autorun.list -o autorun.sys autorun.s
about.dat: text2screen.pl ABOUT.txt
perl text2screen.pl < ABOUT.txt > about.dat
@@ -78,4 +92,4 @@ distclean: clean
# handy for writing little "test.c" programs and being able to
# say "make test.xex".
%.xex: %.c
- $(CL65) $(CL65FLAGS) --start-addr 0x2800 -t atari -W -unused-param -o $@ $<
+ $(CC65) $(CL65FLAGS) $(CC65FLAGS) -o $@ $<