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