]> git.sur5r.net Git - c128-kasse/blob - Makefile
Make dist-clean resilient against absent files
[c128-kasse] / Makefile
1 CC=cc65
2 AS=ca65
3 LD=cl65
4 INCLUDES:=$(wildcard include/*.h) include/version.h
5 GV:=$(shell git describe --tags --always)
6 CFLAGS= -I include -t c128
7
8 .PHONY: include/version.h clean dist-clean
9
10 all: kasse itemz
11
12 %.o: %.c ${INCLUDES}
13         ${CC} ${CFLAGS} -O $<
14         ${AS} ${CFLAGS} $(addsuffix .s,$(basename $< ))
15
16 include/version.h:
17         echo "#define GV \"${GV}\"" > $@
18
19 kasse: src/config.o src/kasse.o src/general.o src/credit_manager.o src/c128time.o src/print.o
20         ${LD} -t c128 $^ -o $@
21
22 itemz: src/config.o src/itemz.o src/general.o src/credit_manager.o src/c128time.o src/print.o
23         ${LD} -t c128 $^ -o $@
24
25 cat: src/general.o src/cat.o
26         ${LD} -t c128 $^ -o $@
27
28 package: all
29         cp images/kasse.d64 .
30         c1541 -attach kasse.d64 -delete state || exit 0 
31         c1541 -attach kasse.d64 -delete items || exit 0
32         c1541 -attach kasse.d64 -delete kasse || exit 0
33         c1541 -attach kasse.d64 -delete itemz || exit 0
34         c1541 -attach kasse.d64 -write kasse || exit 0
35         c1541 -attach kasse.d64 -write itemz || exit 0
36 #       c1541 -attach kasse.d64 -write state || exit 0 
37 #       c1541 -attach kasse.d64 -write items || exit 0
38
39 test: src/config.o test/test.o src/general.o
40         cl65 -t c128 src/config.o test/test.o src/general.o -o test
41
42 test-package: test
43         c1541 -attach test.d64 -delete state || exit 0 
44         c1541 -attach test.d64 -delete items || exit 0
45         c1541 -attach test.d64 -delete test || exit 0
46         c1541 -attach test.d64 -write test || exit 0
47         c1541 -attach test.d64 -write state || exit 0 
48         c1541 -attach test.d64 -write items || exit 0
49
50 clean:
51         rm -rf src/*.o src/*.s test/*.o test/*.s
52
53 dist-clean: clean
54         rm -f kasse itemz kasse.d64