85a5c3087111263e7e6fc28bc5a74d85609cc457
[fw/sdcc] / support / regression / ports / mcs51 / spec.mk
1 # Port specification for the mcs51 port running with uCsim
2 #
3 # model small
4
5 # path to uCsim
6 S51A = $(SDCC_DIR)/sim/ucsim/s51.src/s51
7 S51B = $(SDCC_DIR)/bin/s51
8
9 S51 = $(shell if [ -f $(S51A) ]; then echo $(S51A); else echo $(S51B); fi)
10
11 SDCCFLAGS +=--lesspedantic -DREENTRANT=reentrant
12
13 OBJEXT = .rel
14 EXEEXT = .ihx
15
16 EXTRAS = $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT)
17
18 # Rule to link into .ihx
19 %$(EXEEXT): %$(OBJEXT) $(EXTRAS)
20         $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< -o $@
21
22 %$(OBJEXT): %.c
23         $(SDCC) $(SDCCFLAGS) -c $< -o $@
24
25 $(PORTS_DIR)/$(PORT)/testfwk$(OBJEXT): fwk/lib/testfwk.c
26         $(SDCC) $(SDCCFLAGS) -c $< -o $@
27
28 # run simulator with 30 seconds timeout
29 %.out: %$(EXEEXT) fwk/lib/timeout
30         mkdir -p `dirname $@`
31         -fwk/lib/timeout 30 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \
32           || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
33         -grep -n FAIL $@ /dev/null || true
34
35 fwk/lib/timeout: fwk/lib/timeout.c
36
37
38 _clean:
39         rm -f fwk/lib/timeout fwk/lib/timeout.exe $(PORTS_DIR)/$(PORT)/*.rel $(PORTS_DIR)/$(PORT)/*.rst \
40               $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym $(PORTS_DIR)/$(PORT)/*.asm \
41               $(PORTS_DIR)/$(PORT)/*.lnk $(PORTS_DIR)/$(PORT)/*.map $(PORTS_DIR)/$(PORT)/*.mem