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