0bed1171bb822b828247e6a07443a471269a7579
[fw/sdcc] / support / regression / ports / mcs51 / spec.mk
1 # Port specification for the mcs51 port running with uCsim
2
3 # path to uCsim
4 S51 = ../../sim/ucsim/s51.src/s51
5
6 SDCCFLAGS += --lesspedantic -DREENTRANT=reentrant --stack-after-data
7
8 OBJEXT = .rel
9 EXEEXT = .ihx
10
11 EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
12
13 # Rule to link into .ihx
14 %$(EXEEXT): %$(OBJEXT) $(EXTRAS)
15         $(SDCC) $(SDCCFLAGS) $(EXTRAS) $<
16         mv fwk/lib/testfwk.ihx $@
17         mv fwk/lib/testfwk.map $(@:.ihx=.map)
18
19 %$(OBJEXT): %.c
20         $(SDCC) $(SDCCFLAGS) -c $<
21
22 # run simulator with 5 seconds timeout
23 %.out: %$(EXEEXT) ports/$(PORT)/timeout
24         mkdir -p `dirname $@`
25         -ports/$(PORT)/timeout 5 $(S51) -t32 -S in=/dev/null,out=$@ $< < ports/mcs51/uCsim.cmd >/dev/null || \
26           echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
27         -grep -n FAIL $@ /dev/null || true
28
29 ports/$(PORT)/timeout: ports/$(PORT)/timeout.c
30         gcc -o $@ $<
31
32 _clean:
33         rm -f ports/$(PORT)/timeout ports/$(PORT)/timeout.exe ports/$(PORT)/*.rel ports/$(PORT)/*.rst \
34               ports/$(PORT)/*.lst ports/$(PORT)/*.sym ports/$(PORT)/*.asm temp.lnk
35