fa92ec6d0dc2ed7eea4323687d5935d2d0b0cece
[fw/sdcc] / support / regression / ports / pic16 / spec.mk
1 # Port specification for the pic16 port running with gpsim
2
3 # path to gpsim
4 ifdef GPSIM_PATH
5   GPSIM := $(GPSIM_PATH)/gpsim
6 else
7   GPSIM := gpsim
8 endif
9
10 SDCCFLAGS += -mpic16 -pp18f452 -I$(SDCC_DIR)/device/include/pic16 --nostdinc --less-pedantic -Wl,-t255 -Wl,-q -DREENTRANT=reentrant
11 LINKFLAGS = --nostdlib
12 LINKFLAGS += libsdcc.lib libc18f.lib libm18f.lib
13 LIBDIR = $(SDCC_DIR)/device/lib/build/pic16
14
15 OBJEXT = .o
16 EXEEXT = .cod
17
18 EXTRAS = $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
19
20 # Rule to link into .ihx
21 %$(EXEEXT): %$(OBJEXT) $(EXTRAS)
22         $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) -L $(LIBDIR) $(EXTRAS) $< -o $@
23
24 %$(OBJEXT): %.c
25         $(SDCC) $(SDCCFLAGS) -c $< -o $@
26
27 $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT): fwk/lib/testfwk.c
28         $(SDCC) $(SDCCFLAGS) -c $< -o $@
29
30 # run simulator with 25 seconds timeout
31 %.out: %$(EXEEXT) fwk/lib/timeout
32         mkdir -p `dirname $@`
33         -fwk/lib/timeout 25 $(GPSIM) -i -s $< -c $(PORTS_DIR)/pic16/gpsim.cmd > $@ || \
34           echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
35         python get_ticks.py < $@ >> $@
36         -grep -n FAIL $@ /dev/null || true
37
38 fwk/lib/timeout: fwk/lib/timeout.c
39
40 _clean:
41         rm -f fwk/lib/timeout fwk/lib/timeout.exe $(PORTS_DIR)/$(PORT)/*.rel $(PORTS_DIR)/$(PORT)/*.rst \
42               $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym $(PORTS_DIR)/$(PORT)/*.asm \
43               $(PORTS_DIR)/$(PORT)/*.lnk $(PORTS_DIR)/$(PORT)/*.map $(PORTS_DIR)/$(PORT)/*.mem