6f0a5bab31db494f31dc6936470eed555d37b0ee
[fw/sdcc] / support / regression / ports / ds390 / spec.mk
1 # Port specification for the ds390 port 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 +=-mds390 --nostdinc --less-pedantic -DREENTRANT=reentrant -Wl-r -I$(top_srcdir)
14 LINKFLAGS = --nostdlib
15 LINKFLAGS += libds390.lib libsdcc.lib liblong.lib libint.lib libfloat.lib
16 LIBDIR = $(top_builddir)device/lib/build/ds390
17
18 OBJEXT = .rel
19 EXEEXT = .ihx
20
21 EXTRAS = $(PORT_CASES_DIR)/testfwk$(OBJEXT) $(PORT_CASES_DIR)/support$(OBJEXT)
22
23 # Rule to link into .ihx
24 %$(EXEEXT): %$(OBJEXT) $(EXTRAS)
25         $(SDCC) $(SDCCFLAGS) $(LINKFLAGS) -L $(LIBDIR) $(EXTRAS) $< -o $@
26
27 %$(OBJEXT): %.c
28         $(SDCC) $(SDCCFLAGS) -c $< -o $@
29
30 $(PORT_CASES_DIR)/%$(OBJEXT): $(PORTS_DIR)/$(PORT)/%.c
31         $(SDCC) $(SDCCFLAGS) -c $< -o $@
32
33 $(PORT_CASES_DIR)/%$(OBJEXT): fwk/lib/%.c
34         $(SDCC) $(SDCCFLAGS) -c $< -o $@
35
36 # run simulator with 25 seconds timeout
37 %.out: %$(EXEEXT) $(CASES_DIR)/timeout
38         mkdir -p $(dir $@)
39         -$(CASES_DIR)/timeout 25 $(S51) -tds390f -S in=$(DEV_NULL),out=$@ $< < $(PORTS_DIR)/ds390/uCsim.cmd > $(@:.out=.sim) || \
40           echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@
41         python $(srcdir)/get_ticks.py < $(@:.out=.sim) >> $@
42         -grep -n FAIL $@ /dev/null || true
43
44 $(CASES_DIR)/timeout: fwk/lib/timeout.c
45         $(CC) $< -o $@
46
47 _clean: