2a568d9d3d8767e24ca8ce18bae2294e24fe99d3
[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 RRZ80 = $(SDCC_EXTRA_DIR)/emu/rrz80/rrz80
5
6 SDCCFLAGS +=-mz80 --nostdinc --less-pedantic --profile -DREENTRANT=
7 LINKFLAGS = --nostdlib
8 LINKFLAGS += z80.lib
9 LIBDIR = $(SDCC_DIR)/device/lib/build/z80
10
11 EXEEXT = .bin
12
13 # Needs parts of gbdk-lib, namely the internal mul/div/mod functions.
14 EXTRAS = ports/$(PORT)/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
15
16 # Rule to generate a Emulator .bin file from the .ihx linker output.
17 %$(EXEEXT): %.ihx
18         $(SDCC_DIR)/bin/makebin -s 32768 < $< > $@
19
20 # Rule to link into .ihx
21 %.ihx: %.c $(EXTRAS)
22         $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) -L $(LIBDIR) $(EXTRAS) $< -o $@
23
24 %$(OBJEXT): %.asm
25         $(SDCC_DIR)/bin/as-z80 -plosgff $@ $<
26
27 %$(OBJEXT): %.s
28         $(SDCC_DIR)/bin/as-z80 -plosgff $@ $<
29
30 %$(OBJEXT): %.c
31         $(SDCC) $(SDCCFLAGS) -c $< -o $@
32
33 ports/$(PORT)/%$(OBJEXT): fwk/lib/%.c
34         $(SDCC) $(SDCCFLAGS) -c $< -o $@
35
36 # PENDING: Path to sdcc-extra
37 %.out: %$(EXEEXT)
38         mkdir -p `dirname $@`
39         $(RRZ80) --maxruntime=3 --mapfile=$(<:.bin=.sym) $< > $@
40         -grep -n FAIL $@ /dev/null || true
41
42 _clean:
43         rm -f ports/$(PORT)/testfwk.asm ports/$(PORT)/*.lst ports/$(PORT)/*.o ports/$(PORT)/*.sym
44