]> git.sur5r.net Git - c128-kasse/blob - Makefile
Generate label files for VICE’s monitor
[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 -g
7
8 .PHONY: include/version.h clean dist-clean format
9
10 all: kasse itemz
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 include/version.h:
17         mkdir -p build
18         echo "#define GV \"${GV}\"" > $@
19
20 kasse: build/config.o build/kasse.o build/general.o build/credit_manager.o build/c128time.o build/print.o
21         ${LD} -Ln $@.lbl -t c128 $^ -o $@
22
23 itemz: build/config.o build/itemz.o build/general.o build/credit_manager.o build/c128time.o build/print.o
24         ${LD} -Ln $@.lbl -t c128 $^ -o $@
25
26 cat: build/general.o build/cat.o
27         ${LD} -Ln $@.lbl -t c128 $^ -o $@
28
29 package: all
30         c1541 -format "${GV}",KA d64 kasse.d64
31         c1541 -attach kasse.d64 -write kasse
32         c1541 -attach kasse.d64 -write itemz
33         [ -e state ] && c1541 -attach kasse.d64 -write state || exit 0
34         [ -e items ] && c1541 -attach kasse.d64 -write items || exit 0
35
36 test: build/config.o test/test.o build/general.o
37         cl65 -t c128 $^ -o build/test
38
39 test-package: test
40         c1541 -format "test",TE d64 test.d64
41         c1541 -attach test.d64 -write test || exit 0
42         c1541 -attach test.d64 -write state || exit 0
43         c1541 -attach test.d64 -write items || exit 0
44
45 clean:
46         rm -rf build/*.o build/*.s test/*.o test/*.s
47
48 dist-clean: clean
49         rm -f kasse itemz kasse.d64
50
51 format:
52         clang-format-3.9 -i **/*.[ch]