Merge branch 'yacc-work' into yl-work-for-master
[platform/upstream/automake.git] / contrib / check-html.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 ## Free Software Foundation, Inc.
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 ## Makefile.am fragment to produce HTML output from RST-formatted
19 ## log files produced by the parallel-tests output.
20 ## This fragment was part of the automake core in the 1.11.x release
21 ## series, but has been then moved to contrib.
22
23 TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
24
25 mostlyclean-local: mostlyclean-check-html
26 .PHONY: mostlyclean-check-html
27 mostlyclean-check-html:
28 ## Expand $(TEST_LOGS) only once, to avoid exceeding line length limits.
29         list='$(TEST_LOGS:.log=.html)'; test -z "$$list" || rm -f $$list
30         rm -f $(TEST_SUITE_HTML)
31
32 .log.html:
33         @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py';            \
34         for r2h in $$list; do                                           \
35           if ($$r2h --version) >/dev/null 2>&1; then                    \
36             R2H=$$r2h;                                                  \
37           fi;                                                           \
38         done;                                                           \
39         if test -z "$$R2H"; then                                        \
40           echo >&2 "cannot find rst2html, cannot create $@";            \
41           exit 2;                                                       \
42         fi;                                                             \
43         $$R2H $< >$@.tmp
44         @mv $@.tmp $@
45
46 # Be sure to run check first, and then to convert the result.
47 # Beware of concurrent executions.  Run "check" not "check-TESTS", as
48 # check-SCRIPTS and other dependencies are rebuilt by the former only.
49 # And expect check to fail.
50 check-html recheck-html:
51         @target=`echo $@ | sed 's/-html$$//'`; \
52         rv=0; $(MAKE) $(AM_MAKEFLAGS) $$target || rv=$$?; \
53 ## The nullification of $(TEST_LOGS) is required to ensure that
54 ## "make recheck-html" do not try to uselessly re-run tests.
55         $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) TEST_LOGS= || exit 4; \
56         exit $$rv
57
58 .PHONY: check-html recheck-html
59 .MAKE: check-html recheck-html