]>
Commit | Line | Data |
---|---|---|
1 | # Build ddt180.com from ddt180.z80 | |
2 | ||
3 | PROG := ddt180 | |
4 | ||
5 | SRC := $(PROG).z80 | |
6 | ||
7 | OBJ := $(SRC:.z80=.rel) | |
8 | ||
9 | AS_OPT := MF | |
10 | ||
11 | ASM := zxcc slrz80.com | |
12 | LINK := zxcc link80.com | |
13 | ||
14 | .phony: all | |
15 | all: $(PROG).com | |
16 | ||
17 | ||
18 | ||
19 | $(PROG).com: $(PROG).prl | |
20 | @# Remove the PRL header record (256 bytes) | |
21 | dd status=none bs=256 skip=1 if=$< of=$@ | |
22 | ||
23 | $(PROG).prl: $(OBJ) | |
24 | $(LINK) -'$(PROG)[op,$$SZ]' | |
25 | ||
26 | ||
27 | ||
28 | .phony: clean | |
29 | clean: | |
30 | rm -f $(PROG).com *.rel *.lst *.prl | |
31 | ||
32 | .SUFFIXES: | |
33 | .SUFFIXES: .z80 .rel .prl | |
34 | ||
35 | ||
36 | define cpm-asm = | |
37 | COMMAND="$(ASM) -$(basename $<)/$(AS_OPT)"; \ | |
38 | OUTPUT=$$(mktemp); echo $${COMMAND}; \ | |
39 | $${COMMAND} > $${OUTPUT}; \ | |
40 | grep -q '^ 0 Error(s) Detected' $${OUTPUT}; ERROR=$$? ; \ | |
41 | if [ "$${ERROR}" != "0" ]; then cat $${OUTPUT}; rm -f $@; fi ; \ | |
42 | exit $${ERROR} | |
43 | endef | |
44 | ||
45 | %.rel %lst: %.z80 | |
46 | @$(cpm-asm) |