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