Enabled VPATH feature: changed nearly all Makefiles (149 files).
[fw/sdcc] / support / regression / ports / pic16 / spec.mk
index fa92ec6d0dc2ed7eea4323687d5935d2d0b0cece..288edfefee382b13a7272924dba7f328f95cc94e 100644 (file)
@@ -7,15 +7,15 @@ else
   GPSIM := gpsim
 endif
 
-SDCCFLAGS += -mpic16 -pp18f452 -I$(SDCC_DIR)/device/include/pic16 --nostdinc --less-pedantic -Wl,-t255 -Wl,-q -DREENTRANT=reentrant
+SDCCFLAGS += -mpic16 -pp18f452 -I$(top_srcdir)/device/include/pic16 --nostdinc --less-pedantic -Wl,-t255 -Wl,-q -DREENTRANT=reentrant -I$(top_srcdir)
 LINKFLAGS = --nostdlib
 LINKFLAGS += libsdcc.lib libc18f.lib libm18f.lib
-LIBDIR = $(SDCC_DIR)/device/lib/build/pic16
+LIBDIR = $(top_builddir)device/lib/build/pic16
 
 OBJEXT = .o
 EXEEXT = .cod
 
-EXTRAS = $(PORTS_DIR)/$(PORT)/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)
@@ -24,20 +24,21 @@ EXTRAS = $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJ
 %$(OBJEXT): %.c
        $(SDCC) $(SDCCFLAGS) -c $< -o $@
 
-$(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT): fwk/lib/testfwk.c
+$(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 25 seconds timeout
-%.out: %$(EXEEXT) fwk/lib/timeout
-       mkdir -p `dirname $@`
-       -fwk/lib/timeout 25 $(GPSIM) -i -s $< -c $(PORTS_DIR)/pic16/gpsim.cmd > $@ || \
+%.out: %$(EXEEXT) $(CASES_DIR)/timeout
+       mkdir -p $(dir $@)
+       -$(CASES_DIR)/timeout 25 $(GPSIM) -i -s $< -c $(PORTS_DIR)/pic16/gpsim.cmd > $@ || \
           echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
-       python get_ticks.py < $@ >> $@
+       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 $(PORTS_DIR)/$(PORT)/*.asm \
-             $(PORTS_DIR)/$(PORT)/*.lnk $(PORTS_DIR)/$(PORT)/*.map $(PORTS_DIR)/$(PORT)/*.mem