aafc6f4b6a377c00610e9a213c4dc8a7937123b2
[fw/sdcc] / support / regression / ports / z80 / spec.mk
1 # Port specification for the z80 port running ontop of the Java based
2 # 'ConsoleZ80' emulator.
3
4 # PENDING: Path to gbdk-lib for stdarg
5 GBDK_LIB = ../../../gbdk-lib
6 RRZ80 = $(SDCC_EXTRA_DIR)/emu/rrz80/rrz80
7
8 SDCCFLAGS += -I$(GBDK_LIB)/include --lesspedantic
9
10 EXEEXT = .bin
11
12 # Needs parts of gbdk-lib, namely the internal mul/div/mod functions.
13 EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) \
14         $(GBDK_LIB)/libc/asm/z80/mul$(OBJEXT) \
15         $(GBDK_LIB)/libc/asm/z80/div$(OBJEXT)
16
17 # Rule to generate a Emulator .bin file from the .ihx linker output.
18 %$(EXEEXT): %.ihx
19         ../makebin/makebin -s 32768 < $< > $@  # Must be 32768 due to a bug in ConsoleZ80
20
21 # Rule to link into .ihx
22 %.ihx: %$(OBJEXT) $(EXTRAS)
23         ../../bin/link-z80 -n -- -b_CODE=0x200 -b_DATA=0x8000 -j -i $@ $< $(EXTRAS)
24
25 %$(OBJEXT): %.c fwk/include/*.h
26         $(SDCC) $(SDCCFLAGS) -c $<
27
28 %$(OBJEXT): %.asm
29         ../../bin/as-z80 -plosgff $@ $<
30
31 %$(OBJEXT): %.s
32         ../../bin/as-z80 -plosgff $@ $<
33
34 # PENDING: Path to sdcc-extra
35 %.out: %$(EXEEXT)
36         mkdir -p `dirname $@`
37         $(RRZ80) --maxruntime=3 --mapfile=$(<:.bin=.sym) $< > $@
38         -grep -n FAIL $@ /dev/null || true
39