summaryrefslogtreecommitdiffstats
path: root/testsuites/automake/subdirs.am
blob: d03122c037d909a89907f703968b627fd0b0df76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## Borrowed from automake/subdir.am which borrowed automake-1.4 and adapted to RTEMS

## NOTE: This is a temporary work-around until automake is removed from RTEMS.
##   It is a hack within many hacks and is designed to keep the source as clean
##   as possible.

define TESTDIR
.PHONY: $1
$1:
	@+set fnord $(MAKEFLAGS); \
	subdir=$(1); \
	target=`echo $(MAKECMDGOALS) | sed s/-recursive//`; \
	if test "$$$$target" = "all-local-am"; then \
	  target="all-am"; \
	fi; \
	if test "$$$$target" = "all-local"; then \
	  target="all"; \
	fi; \
	tcheck="$(top_srcdir)/../../tools/build/rtems-test-check-py"; \
	tdata="$(RTEMS_BSP)-testsuite.tcfg"; \
	tincludes="$(top_srcdir)/../../c/src/lib/libbsp/$(RTEMS_CPU)/$(RTEMS_BSP_FAMILY)/make/custom:$(top_srcdir)/.."; \
	if test -f "$$$$tdata"; then \
	  vtdata="$(RTEMS_CPU)/$(RTEMS_BSP_FAMILY)/make/custom/$(RTEMS_BSP)-testsuite.tcfg"; \
	else \
	  vtdata="all tests"; \
	fi; \
	echo "BSP Testsuite Data: $$$$vtdata"; \
	if test -f $$$$tcheck; then \
	  list=`$$$$tcheck exclude $(RTEMS_BSP) $$tdata $$$$tincludes $(_SUBDIRS)`; \
	else \
	  list=$(_SUBDIRS); \
	fi; \
	if test "$$$${list#*$$$$subdir}" != "$$$${list}"; then \
	  echo "Making $$$$target in $$$$subdir"; \
	  if test "$$$$subdir" != "."; then \
	    if test -f $$$$tcheck; then \
	      test_FLAGS=`$$$$tcheck flags $(RTEMS_BSP) $$$$tdata $$$$tincludes $$$$subdir`; \
	    fi; \
	    local_target="$$$$target"; \
	    if test -z "$$$$test_FLAGS"; then \
	      echo "BSP Testsuite Flags: $$$$subdir: PASS"; \
	    else \
	      echo "BSP Testsuite Flags: $$$$subdir: $$$$test_FLAGS"; \
	    fi; \
	    cd $$$$subdir; \
	    $(MAKE) $(AM_MAKEFLAGS) TEST_FLAGS="$$$$test_FLAGS" $$$$local_target; \
	  fi; \
	fi;
endef

$(foreach T,$(_SUBDIRS),$(eval $(call TESTDIR,$(strip $(T)))))

all-local:  $(_SUBDIRS)