aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 4151db772ef74eb54865e066282a8b5e9c640694 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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=-g

# 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 -Or

# 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
	$(CA65) $(CL65FLAGS) $(CA65FLAGS) -l dla.list -Ln dla.labels -o dla.xex dla.s

dla2img.sh: VERSION
	$(PERL) d2iver.pl dla2img.sh

dlatbl.s: mkdlatbl.pl
	$(PERL) mkdlatbl.pl > dlatbl.s

#dlaver.inc: dlaver.h

dlaver.h: mkver.pl VERSION
	$(PERL) mkver.pl

dla2csv: dla2csv.c dlaver.h
	@echo $(CC) $(CFLAGS) -o dla2csv dla2csv.c ; \
	$(CC) $(CFLAGS) -o dla2csv dla2csv.c \
	|| echo "Couldn't build host dla2csv; continuing without it"

dla2csv.xex: dla2csv.c dlaver.h
	$(CC65) $(CL65FLAGS) $(CC65FLAGS) -Ln dla2csv.labels -l dla2csv.list -m dla2csv.map -o $@ dla2csv.c

autorun.sys: autorun.s about.dat
	$(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

# dla.atr.in is just a DOS 2.0s disk image.
dla.atr: dla.xex dla2csv.xex autorun.sys dla.atr.in
	cp dla.atr.in dla.atr
	axe -w autorun.sys dla.atr
	axe -w dla.xex dla.atr
	axe -w dla2csv.xex dla.atr

disk: dla.atr

test: all
	atari800 dla.xex

disktest: disk
	atari800 dla.atr

realtest: disk
	atariserver dla.atr

# tnfs.sh is not in git, it wouldn't work for anyone but me anyway.
tnfs: all
	sh tnfs.sh dla.xex dla2csv.xex dla.atr

clean:
	rm -f dla.xex dla2csv dla2csv.xex autorun.sys dla.list dla.labels *.o dla.atr

distclean: clean
	rm -f dlatbl.s dlaver.inc dlaver.h about.dat

# this rule isn't actually used by the other targets, it's just
# handy for writing little "test.c" programs and being able to
# say "make test.xex".
%.xex: %.c
	$(CC65) $(CL65FLAGS) $(CC65FLAGS) -o $@ $<