Imported Upstream version 2.9.0
[debian/cc1111] / support / regression / ports / mcs51-common / spec.mk
1 # Common regression test specification for the mcs51 targets running with uCsim
2
3 ifndef DEV_NULL
4   DEV_NULL = /dev/null
5 endif
6
7 # path to uCsim
8 ifdef SDCC_BIN_PATH
9   S51 = $(SDCC_BIN_PATH)/s51
10 else
11   S51A = $(top_builddir)/sim/ucsim/s51.src/s51
12   S51B = $(top_builddir)/bin/s51
13
14   S51 = $(shell if [ -f $(S51A) ]; then echo $(S51A); else echo $(S51B); fi)
15
16   SDCCFLAGS += --nostdinc -I$(INC_DIR)/mcs51 -I$(top_srcdir)
17   LINKFLAGS += --nostdlib -L$(LIBDIR)
18 endif
19
20 SDCCFLAGS += --less-pedantic -DREENTRANT=reentrant
21 LINKFLAGS += mcs51.lib libsdcc.lib liblong.lib libint.lib libfloat.lib
22
23 OBJEXT = .rel
24 EXEEXT = .ihx
25
26 EXTRAS = $(PORT_CASES_DIR)/testfwk$(OBJEXT) $(PORT_CASES_DIR)/support$(OBJEXT)
27 FWKLIB = $(PORT_CASES_DIR)/T2_isr$(OBJEXT)
28
29 # Rule to link into .ihx
30 %$(EXEEXT): %$(OBJEXT) $(EXTRAS) $(FWKLIB) $(PORT_CASES_DIR)/fwk.lib
31         $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) $(EXTRAS) $(PORT_CASES_DIR)/fwk.lib $< -o $@
32
33 %$(OBJEXT): %.c
34         $(SDCC) $(SDCCFLAGS) -c $< -o $@
35
36 $(PORT_CASES_DIR)/%$(OBJEXT): $(PORTS_DIR)/mcs51-common/%.c
37         $(SDCC) $(SDCCFLAGS) -c $< -o $@
38
39 $(PORT_CASES_DIR)/%$(OBJEXT): fwk/lib/%.c
40         $(SDCC) $(SDCCFLAGS) -c $< -o $@
41
42 $(PORT_CASES_DIR)/fwk.lib:
43         cp $(PORTS_DIR)/mcs51-common/fwk.lib $@
44
45 # run simulator with 30 seconds timeout
46 %.out: %$(EXEEXT) gen/timeout
47         mkdir -p $(dir $@)
48         -gen/timeout 30 "$(S51)" -t32 -S in=$(DEV_NULL),out=$@ $< < $(PORTS_DIR)/mcs51-common/uCsim.cmd > $(@:.out=.sim) \
49           || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
50         python $(srcdir)/get_ticks.py < $(@:.out=.sim) >> $@
51         -grep -n FAIL $@ /dev/null || true
52
53
54 gen/timeout: $(srcdir)/fwk/lib/timeout.c
55         $(CC) $(CFLAGS) $< -o $@
56
57 _clean: