cpm: initial cbios
[z80.git] / z80 / cpm / Makefile
1 # makefile
2
3 PROG    = cbios
4 OBJS    = cbios.rel
5
6 AS      = sdasz80
7 CC      = sdcc -mz80 --all-callee-saves --no-std-crt0
8 LD      = sdldz80
9
10 .PHONY: all clean
11 all: dump.hex
12
13 dump.hex: cbios.hex cpm20.hex
14         srec_cat -Output -Intel --address-length=2 \
15                 cbios.hex -Intel cpm20.hex -Intel > dump.hex
16
17 cpm20.hex: cpm20.sys
18         objcopy -I binary -O ihex --change-addresses=0x3400 cpm20.sys cpm20.hex
19
20 $(PROG).hex: $(PROG).ihx
21         @echo -e "\tMV\t$@"
22         @mv $< $@
23
24 $(PROG).ihx: $(OBJS)
25         @echo -e "\tLD\t$@"
26         @$(LD) -i $(OBJS)
27
28 %.rel: %.c
29         @echo -e "\tCC\t$@"
30         @$(CC) -c -o $@ $^
31
32 %.rel: %.S
33         @echo -e "\tAS\t$@"
34         @$(AS) -l -p -o $@ $^
35
36 clean:
37         @echo -e "\tCLEAN"
38         rm -f *.asm *.hex *.lk *.lst *.map *.noi *.rel *.sym
39         rm -f cpm20.hex dump.hex
40