Enabled VPATH feature: changed nearly all Makefiles (149 files).
[fw/sdcc] / support / regression / ports / mcs51 / spec.mk
index 6d188c0642c9f3b9b6ef5a9eb09e246adae47191..86ec82a267099851a00ea70276dd6741052f0de8 100644 (file)
@@ -1,35 +1,50 @@
 # Port specification for the mcs51 port running with uCsim
+#
+# model small
 
 # path to uCsim
-S51 = ../../sim/ucsim/s51.src/s51
+S51A = $(top_builddir)sim/ucsim/s51.src/s51
+S51B = $(top_builddir)bin/s51
 
-SDCCFLAGS += --lesspedantic -DREENTRANT=reentrant --stack-after-data
+S51 = $(shell if [ -f $(S51A) ]; then echo $(S51A); else echo $(S51B); fi)
+
+SDCCFLAGS +=--nostdinc --less-pedantic -DREENTRANT=reentrant -I$(INC_DIR)/mcs51 -I$(top_srcdir)
+LINKFLAGS = --nostdlib
+LINKFLAGS += mcs51.lib libsdcc.lib liblong.lib libint.lib libfloat.lib
+LIBDIR = $(top_builddir)device/lib/build/small
 
 OBJEXT = .rel
 EXEEXT = .ihx
 
-EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT)
+EXTRAS = $(PORT_CASES_DIR)/testfwk$(OBJEXT) $(PORT_CASES_DIR)/support$(OBJEXT)
+FWKLIB = $(PORT_CASES_DIR)/T2_isr$(OBJEXT)
 
 # Rule to link into .ihx
-%$(EXEEXT): %$(OBJEXT) $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $(EXTRAS) $<
-       mv fwk/lib/testfwk.ihx $@
-       mv fwk/lib/testfwk.map $(@:.ihx=.map)
+%$(EXEEXT): %$(OBJEXT) $(EXTRAS) $(FWKLIB) $(PORT_CASES_DIR)/fwk.lib
+       $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) -L $(LIBDIR) $(EXTRAS) $(PORT_CASES_DIR)/fwk.lib $< -o $@
 
 %$(OBJEXT): %.c
-       $(SDCC) $(SDCCFLAGS) -c $<
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
+
+$(PORT_CASES_DIR)/%$(OBJEXT): $(PORTS_DIR)/$(PORT)/%.c
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
+
+$(PORT_CASES_DIR)/%$(OBJEXT): fwk/lib/%.c
+       $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
-# run simulator with 5 seconds timeout
-%.out: %$(EXEEXT) ports/$(PORT)/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 >> $@
+$(PORT_CASES_DIR)/fwk.lib:
+       cp $(PORTS_DIR)/mcs51/fwk.lib $@
+
+# run simulator with 30 seconds timeout
+%.out: %$(EXEEXT) gen/timeout
+       mkdir -p $(dir $@)
+       -gen/timeout 30 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd > $(@:.out=.sim) \
+         || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
+       python $(srcdir)/get_ticks.py < $(@:.out=.sim) >> $@
        -grep -n FAIL $@ /dev/null || true
 
-ports/$(PORT)/timeout: ports/$(PORT)/timeout.c
-       gcc -o $@ $<
 
-_clean:
-       rm -f ports/$(PORT)/timeout ports/$(PORT)/*.rel ports/$(PORT)/*.rst ports/$(PORT)/*.lst \
-          ports/$(PORT)/*.sym ports/$(PORT)/*.asm temp.lnk
+gen/timeout: $(srcdir)/fwk/lib/timeout.c
+       $(CC) $< -o $@
 
+_clean: