summaryrefslogtreecommitdiffstats
path: root/from_others/numpad/Makefile
blob: 18b778844dccf10d8251c569dcce6b17af8baa44 (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
VERSIONS=a b c d
PROG=numpad

APPS=${VERSIONS:%=${PROG}-%.app}
ASMS=${VERSIONS:%=${PROG}-%.asm} numpad.asm
LSTS=${VERSIONS:%=${PROG}-%.p}
LSTS=${VERSIONS:%=${PROG}-%.lst}
ZAPS=${VERSIONS:%=${PROG}-%.zap}
STAMPS=${VERSIONS:%=${PROG}-%.stamp}
HEX=${APPS:%.app=%.app.hex} ${APPS:%.app=%.zap.app.hex}
ZAPAPPS=${ZAPS:%.zap=%.zap.app}

CROSS=../../../asl/

ZAP2APP=../../tools/zap2app
AFLAGS=-i ../../include/dl150 -cpu datalink
AS=${CROSS}asl ${AFLAGS}
P2BIN=${CROSS}p2bin

default:${STAMPS}

numpad.asm:numpad.zsm
	sed -e 's/^INCLUDE/ INCLUDE/' < $< > $@ || /bin/rm -f $@

numpad-a.asm:numpad.asm
	sed -e '/?C{/,/?C}/d' < $< | sed -e '/?A{/,/?A}/d' > $@ || /bin/rm -f $@

numpad-b.asm:numpad.asm
	sed -e '/?C{/,/?C}/d' < $< > $@ || /bin/rm -f $@

numpad-c.asm:numpad.asm
	sed -e '/?B{/,/?B}/d' < $< > $@ || /bin/rm -f $@

numpad-d.asm:numpad.asm
	sed -e '/?C{/,/?C}/d' < $< | sed -e '/?W{/,/?W}/d' > $@ || /bin/rm -f $@

%.p:%.asm
	${AS} -L ${@:%.p=%.lst} -o $@ $<

%.app:%.p
	${P2BIN} $< $@ -r 0x110-\$$


%.hex:% 
	yes '' | dd bs=272 count=1 | cat - $< | hexdump -C > $@ || /bin/rm -f $@


%.stamp:%.app.hex %.zap.app.hex
	diff  -uN ${@:%.stamp=%.app.hex}  ${@:%.stamp=%.zap.app.hex} && touch $@

%.zap.app:%.zap
	${ZAP2APP} $< $@

.PRECIOUS:${APPS}

clean:
	/bin/rm -f ${APPS} ${PS} ${LSTS} ${HEX} ${STAMPS} ${ZAPAPPS} ${ASMS}