1## Makefile.in for ICU tests
2## Copyright (c) 1999-2013, International Business Machines Corporation and
3## others. All Rights Reserved.
4
5## Source directory information
6srcdir = @srcdir@
7top_srcdir = @top_srcdir@
8
9top_builddir = ..
10
11include $(top_builddir)/icudefs.mk
12
13## Build directory information
14subdir = test
15
16@ICUIO_TRUE@IOTEST = iotest
17
18# status dir
19STATUS_TMP = tmp
20STATUS_FULL = $(shell pwd)/$(STATUS_TMP)
21
22## Files to remove for 'make clean'
23CLEANFILES = *~ $(STATUS_TMP)
24
25SUBDIRS = testdata intltest $(IOTEST) cintltst
26
27## List of phony targets
28.PHONY : everything all all-local all-recursive install install-local		\
29install-recursive clean clean-local clean-recursive distclean		\
30distclean-local distclean-recursive dist dist-recursive dist-local	\
31check check-recursive check-local xcheck xcheck-recursive xcheck-local	\
32check-exhaustive check-exhaustive-recursive
33
34## Clear suffix list
35.SUFFIXES :
36
37## List of standard targets
38everything: all-recursive all-local
39all:
40ifneq ($(RECURSIVE),YES)
41	@echo simply use \`make\' \(or \`make everything\'\) to do all
42endif
43
44install: install-recursive install-local
45clean: clean-recursive clean-local
46distclean : distclean-recursive distclean-local
47	$(RMV) hdrtst/Makefile
48	$(RMV) perf/convperf/Makefile
49	$(RMV) $(STATUS_TMP)
50
51dist: dist-recursive dist-local
52check: everything check-recursive check-local
53check-recursive: all-recursive
54# the xcheck targets create a ../test-*.xml file in JUnit format.
55xcheck: everything xcheck-recursive xcheck-local
56xcheck-recursive: all-recursive
57check-exhaustive: everything check-exhaustive-recursive check-local
58
59## Recursive targets
60all-recursive install-recursive clean-recursive distclean-recursive dist-recursive:
61	@dot_seen=no; \
62	target=`echo $@ | sed s/-recursive//`; \
63	list='$(SUBDIRS)'; for subdir in $$list; do \
64	  echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$target' in \`$$subdir'"; \
65	  if test "$$subdir" = "."; then \
66	    dot_seen=yes; \
67	    local_target="$$target-local"; \
68	  else \
69	    local_target="$$target"; \
70	  fi; \
71	  (cd $$subdir && $(MAKE) $$local_target) || exit; \
72	done; \
73	if test "$$dot_seen" = "no"; then \
74	  $(MAKE) "$$target-local" || exit; \
75	fi
76
77xcheck-recursive check-recursive check-exhaustive-recursive:
78	@$(MKINSTALLDIRS) $(STATUS_TMP)
79	@mystatus=$(STATUS_FULL)/status.$$$$.deleteme ; \
80	$(RMV) "$$mystatus".* ; \
81	@goods=; \
82	bads=; \
83	target=`echo $@ | sed s/-recursive//`; \
84	list='$(SUBDIRS)'; for subdir in $$list; do \
85	  echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$target' in \`$$subdir'"; \
86	  local_target="$$target"; \
87	  if (cd $$subdir && $(MAKE) $$local_target TEST_STATUS_FILE="$$mystatus.$$subdir" ); then \
88	    goods="$$goods $$subdir"; \
89          else \
90            bads="$$bads $$subdir"; \
91          fi; \
92	done; \
93	for subdir in $$list; do \
94	  if [ -f "$$mystatus.$$subdir" ]; then \
95	    echo "-------------" ; \
96	    echo "| ***     FAILING TEST SUMMARY FOR:              $$subdir  " ; \
97	    cat "$$mystatus.$$subdir" ; \
98	    echo "| *** END FAILING TEST SUMMARY FOR:              $$subdir" ; \
99	    $(RMV) "$$mystatus.$$subdir" ; \
100	  fi; \
101	done; \
102	echo "---------------"; \
103	echo "ALL TESTS SUMMARY:"; \
104        if test ! "x$$bads" = "x"; then \
105	  echo "ok: $$goods"; \
106	  echo "===== ERRS: $$bads"; exit 1; \
107	else \
108	  echo "All tests OK: $$goods"; \
109	fi
110
111# pcheck = parallel check. We don't care about the output interleaving,
112# just run it as fast as possible.
113# todo would be to merge this code into the above non-parallel check.
114STATUS_NUM:=$(shell echo $$$$)
115MYSTATUS_R=$(STATUS_FULL)/status.$(STATUS_NUM).deleteme
116STATUS_FILES=$(SUBDIRS:%=$(MYSTATUS_R).%)
117
118pcheck_setup: testdata
119	@$(MKINSTALLDIRS) $(STATUS_TMP)
120	$(RMV) "$(MYSTATUS_R)".*
121	@echo Beginning parallel make. Output may be interleaved!
122
123$(STATUS_FULL)/status.$(STATUS_NUM).deleteme.%: pcheck_setup
124	@$(MAKE) -C $* TEST_STATUS_FILE=$@ check || ( echo "FAILED: $* (other tests may still be running..)" ; touch $@.FAIL ; false )
125	-@touch $@.PASS
126	-@echo "PASSED: $* (other tests may still be running..)"
127
128# print out status
129pcheck: $(STATUS_FILES)
130	@goods= ; \
131	bads= ; \
132	echo "---------------"; \
133	for subdir in $(SUBDIRS); do \
134		if [ -f "$(MYSTATUS_R).$$subdir.FAIL" ]; \
135		then \
136			bads="$$bads $$subdir" ; \
137		elif [ -f "$(MYSTATUS_R).$$subdir.PASS" ]; \
138		then \
139			goods="$$goods $$subdir" ; \
140		else \
141			echo "*** subtest did not complete - $$subdir" ; \
142			bads="$$bads $$subdir" ; \
143		fi ; \
144	done ; \
145	echo "ALL TESTS SUMMARY:"; \
146        if test ! "x$$bads" = "x"; then \
147	  echo "(to get non-interleaved err output, use \"$(MAKE) check\" instead.)" ; \
148	  echo "ok: $$goods"; \
149	  echo "===== ERRS: $$bads"; exit 1; \
150	else \
151	  echo "All tests OK: $$goods"; \
152	fi
153	-@$(RMV) "$(MYSTATUS_R)".*
154
155all-local:
156
157install-local:
158
159dist-local:
160
161clean-local:
162	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
163
164distclean-local: clean-local
165	$(RMV) Makefile
166
167xcheck-local check-local: all-local
168
169Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
170	cd $(top_builddir) \
171	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
172
173