Fixed up s51 autodetect
[fw/sdcc] / support / regression / ports / mcs51 / spec.mk
index 0bed1171bb822b828247e6a07443a471269a7579..d2d05045c133dc05dad58d5ea307f3e0dec28438 100644 (file)
@@ -1,14 +1,19 @@
 # Port specification for the mcs51 port running with uCsim
+#
+# model small
 
 # path to uCsim
-S51 = ../../sim/ucsim/s51.src/s51
+S51A = $(SDCC_DIR)/sim/ucsim/s51.src/s51
+S51B = $(SDCC_DIR)/bin/s51
 
-SDCCFLAGS += --lesspedantic -DREENTRANT=reentrant --stack-after-data
+S51 = $(shell if [ -f $(S51A) ]; then echo $(S51A); else echo $(S51B); fi)
+
+SDCCFLAGS +=--lesspedantic -DREENTRANT=reentrant --stack-after-data
 
 OBJEXT = .rel
 EXEEXT = .ihx
 
-EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
+EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
 
 # Rule to link into .ihx
 %$(EXEEXT): %$(OBJEXT) $(EXTRAS)
@@ -19,17 +24,16 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
 %$(OBJEXT): %.c
        $(SDCC) $(SDCCFLAGS) -c $<
 
-# run simulator with 5 seconds timeout
-%.out: %$(EXEEXT) ports/$(PORT)/timeout
+# run simulator with 10 seconds timeout
+%.out: %$(EXEEXT) fwk/lib/timeout
        mkdir -p `dirname $@`
-       -ports/$(PORT)/timeout 5 $(S51) -t32 -S in=/dev/null,out=$@ $< < ports/mcs51/uCsim.cmd >/dev/null || \
-          echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
+       -fwk/lib/timeout 10 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \
+         || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@
        -grep -n FAIL $@ /dev/null || true
 
-ports/$(PORT)/timeout: ports/$(PORT)/timeout.c
-       gcc -o $@ $<
+fwk/lib/timeout: fwk/lib/timeout.c
 
 _clean:
-       rm -f ports/$(PORT)/timeout ports/$(PORT)/timeout.exe ports/$(PORT)/*.rel ports/$(PORT)/*.rst \
-             ports/$(PORT)/*.lst ports/$(PORT)/*.sym ports/$(PORT)/*.asm temp.lnk
+       rm -f fwk/lib/timeout fwk/lib/timeout.exe $(PORTS_DIR)/$(PORT)/*.rel $(PORTS_DIR)/$(PORT)/*.rst \
+             $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym $(PORTS_DIR)/$(PORT)/*.asm temp.lnk