aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '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 $@ $<