]> git.sur5r.net Git - c128-kasse/blob - Makefile
README: remove emulator configuration, we use -config vicerc
[c128-kasse] / Makefile
1 CC=cc65
2 AS=ca65
3 LD=cl65
4 INCLUDES:=$(wildcard include/*.h) include/version.h include/charset_umlauts.h
5 GV:=$(shell git describe --tags --always)
6 CFLAGS= -I include -t c128 -g
7
8 .PHONY: clean dist-clean format
9
10 all: kasse itemz cat
11
12 build/%.o: src/%.c ${INCLUDES}
13         ${CC} ${CFLAGS} -O $< -o build/$(addsuffix .s,$(shell basename $< .c))
14         ${AS} ${CFLAGS} build/$(addsuffix .s,$(shell basename $< .c)) -o $@
15
16 build/%.o: src/%.s
17         ${AS} ${CFLAGS} $< -o $@
18
19 build/%.o: test/%.c ${INCLUDES}
20         ${CC} ${CFLAGS} -O $< -o build/$(addsuffix .s,$(shell basename $< .c))
21         ${AS} ${CFLAGS} build/$(addsuffix .s,$(shell basename $< .c)) -o $@
22
23 build/%.o: test/%.s
24         ${AS} ${CFLAGS} $< -o $@
25
26 .git/index:
27
28 include/version.h: .git/index
29         mkdir -p build
30         echo "#define GV \"${GV}\"" > $@
31
32 include/charset_umlauts.h: assets/umlauts.pbm
33         ./util/mkfont assets/umlauts.pbm chars_umlauts > $@
34
35 kasse: build/config.o build/kasse.o build/general.o build/credit_manager.o build/c128time.o build/print.o build/vdc_patch_charset.o build/vdc_util.o build/globals.o build/bcd2dec.o
36         ${LD} -Ln $@.lbl -t c128 $^ -o $@
37
38 itemz: build/config.o build/itemz.o build/general.o build/credit_manager.o build/c128time.o build/print.o build/globals.o build/bcd2dec.o build/vdc_util.o
39         ${LD} -Ln $@.lbl -t c128 $^ -o $@
40
41 cat: build/general.o build/cat.o build/config.o build/print.o build/globals.o
42         ${LD} -Ln $@.lbl -t c128 $^ -o $@
43
44 charmap: build/print_charmap.o build/vdc_util.o build/vdc_patch_charset.o
45         ${LD} -Ln $@.lbl -t c128 $^ -o $@
46
47 ascii: build/print_ascii.o
48         ${LD} -Ln $@.lbl -t c128 $^ -o $@
49
50 package: all
51         c1541 -format "${GV}",KA d71 kasse.d71
52         c1541 -attach kasse.d71 -write kasse
53         c1541 -attach kasse.d71 -write itemz
54         [ -e state ] && c1541 -attach kasse.d71 -write state || exit 0
55         [ -e items ] && c1541 -attach kasse.d71 -write items || exit 0
56
57 test: build/config.o build/test.o build/general.o build/print.o build/globals.o
58         ${LD} -Ln $@.lbl -t c128 $^ -o test/$@
59
60 test-package: test
61         c1541 -format "test",TE d71 test.d71
62         c1541 -attach test.d71 -write test/test || exit 0
63         c1541 -attach test.d71 -write state || exit 0
64         c1541 -attach test.d71 -write items || exit 0
65
66 clean:
67         rm -rf build/*.o build/*.s test/test
68
69 dist-clean: clean
70         rm -f kasse kasse.lbl itemz itemz.lbl cat cat.lbl kasse.d71
71
72 format:
73         clang-format-3.9 -i **/*.[ch]
74
75 vice:
76         x128 -config vicerc -autostart kasse.d71 +go64 -80col