Enabled VPATH feature: changed nearly all Makefiles (149 files).
[fw/sdcc] / support / regression / ports / ucz80 / spec.mk
index 3543fb1462066ee0cbeb6ef4f7c068dd49e89904..1ea814a7b5cb260811743cb75cbd3ea94c0fc3b6 100644 (file)
@@ -2,39 +2,48 @@
 #
 
 # path to uCsim
-UCZ80 = $(SDCC_DIR)/bin/sz80
-#UCZ80 = $(SDCC_DIR)/bin/s51
+# path to uCsim
+SZ80A = $(top_builddir)sim/ucsim/z80.src/sz80
+SZ80B = $(top_builddir)bin/sz80
+
+UCZ80 = $(shell if [ -f $(SZ80A) ]; then echo $(SZ80A); else echo $(SZ80B); fi)
 
-SDCCFLAGS +=-mz80 --lesspedantic --profile -DREENTRANT=
-#SDCCFLAGS +=--lesspedantic -DREENTRANT=reentrant --stack-after-data
+SDCCFLAGS +=-mz80 --less-pedantic --profile -DREENTRANT= -I$(top_srcdir)
+#SDCCFLAGS +=--less-pedantic -DREENTRANT=reentrant
+LINKFLAGS = --nostdlib
+LINKFLAGS += z80.lib
+LIBDIR = $(top_builddir)device/lib/build/z80
 
 #OBJEXT = .o
 EXEEXT = .ihx
 
-EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
+EXTRAS = $(PORT_CASES_DIR)/testfwk$(OBJEXT) $(PORT_CASES_DIR)/support$(OBJEXT)
 
 # Rule to link into .ihx
-#%$(EXEEXT): %$(OBJEXT) $(EXTRAS)
+%.ihx: %.c $(EXTRAS)
+       $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) -L $(LIBDIR) $(EXTRAS) $< -o $@
 
-%$(EXEEXT): %.c $(EXTRAS)
-       $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) -o $@
-
-%$(OBJEXT): %.asm
-       $(SDCC_DIR)/bin/as-z80 -plosgff $@ $<
+$(PORT_CASES_DIR)/%$(OBJEXT): $(PORTS_DIR)/$(PORT)/%.asm
+       $(top_builddir)bin/as-z80 -plosgff $@ $<
 
 %$(OBJEXT): %.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 10 seconds timeout
-%.out: %$(EXEEXT) fwk/lib/timeout
-       mkdir -p `dirname $@`
-       -fwk/lib/timeout 10 $(UCZ80) -t32 $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \
+%.out: %$(EXEEXT) $(CASES_DIR)/timeout
+       mkdir -p $(dir $@)
+       -$(CASES_DIR)/timeout 10 $(UCZ80) $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \
          || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
+       python $(srcdir)/get_ticks.py < $@ >> $@
        -grep -n FAIL $@ /dev/null || true
 
-fwk/lib/timeout: fwk/lib/timeout.c
+$(CASES_DIR)/timeout: fwk/lib/timeout.c
+       $(CC) $< -o $@
 
 _clean:
-       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 temp.lnk
-