]> git.sur5r.net Git - c128-kasse/blob - Makefile
Do not crash when format_euro() fails
[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: include/version.h include/charset_umlauts.h 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 include/version.h:
27         mkdir -p build
28         echo "#define GV \"${GV}\"" > $@
29
30 include/charset_umlauts.h:
31         ./util/mkfont assets/umlauts.pbm chars_umlauts > $@
32
33 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
34         ${LD} -Ln $@.lbl -t c128 $^ -o $@
35
36 itemz: build/config.o build/itemz.o build/general.o build/credit_manager.o build/c128time.o build/print.o build/globals.o
37         ${LD} -Ln $@.lbl -t c128 $^ -o $@
38
39 cat: build/general.o build/cat.o build/config.o build/print.o build/globals.o
40         ${LD} -Ln $@.lbl -t c128 $^ -o $@
41
42 charmap: build/print_charmap.o build/vdc_util.o build/vdc_patch_charset.o
43         ${LD} -Ln $@.lbl -t c128 $^ -o $@
44
45 ascii: build/print_ascii.o
46         ${LD} -Ln $@.lbl -t c128 $^ -o $@
47
48 package: all
49         c1541 -format "${GV}",KA d71 kasse.d71
50         c1541 -attach kasse.d71 -write kasse
51         c1541 -attach kasse.d71 -write itemz
52         [ -e state ] && c1541 -attach kasse.d71 -write state || exit 0
53         [ -e items ] && c1541 -attach kasse.d71 -write items || exit 0
54
55 test: build/config.o build/test.o build/general.o build/print.o build/globals.o
56         ${LD} -Ln $@.lbl -t c128 $^ -o test/$@
57
58 test-package: test
59         c1541 -format "test",TE d71 test.d71
60         c1541 -attach test.d71 -write test/test || exit 0
61         c1541 -attach test.d71 -write state || exit 0
62         c1541 -attach test.d71 -write items || exit 0
63
64 clean:
65         rm -rf build/*.o build/*.s test/test
66
67 dist-clean: clean
68         rm -f kasse kasse.lbl itemz itemz.lbl cat cat.lbl kasse.d71
69
70 format:
71         clang-format-3.9 -i **/*.[ch]