Merge branch 'minor'
[automake.git] / lib / am / dejagnu.am
blob4aa8f9cc23f116d2f87eccedb3ecfca111454b07
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-2017 Free Software Foundation, Inc.
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2, or (at your option)
7 ## any later version.
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 ## Name of tool to use.  Default is the same as the package.
18 DEJATOOL = $(PACKAGE)
20 ## Default flags to pass to dejagnu.  The user can override this.
21 RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
23 EXPECT = expect
24 RUNTEST = runtest
27 .PHONY: check-DEJAGNU
28 check-DEJAGNU: site.exp
29 ## Life is easiest with an absolute srcdir, so do that.
30         srcdir='$(srcdir)'; export srcdir; \
31         EXPECT=$(EXPECT); export EXPECT; \
32 ## If runtest can't be found, print a warning but don't die.  It is
33 ## pointless to cause a failure if the tests cannot be run at all.
34         if $(SHELL) -c "$(RUNTEST) --version" > /dev/null 2>&1; then \
35           exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
36             if $(RUNTEST) $(RUNTESTDEFAULTFLAGS) $(AM_RUNTESTFLAGS) $(RUNTESTFLAGS); \
37             then :; else exit_status=1; fi; \
38           done; \
39         else echo "WARNING: could not find '$(RUNTEST)'" 1>&2; :;\
40         fi; \
41         exit $$exit_status
44 ## ------------------- ##
45 ## Building site.exp.  ##
46 ## ------------------- ##
48 ## Note that in the rule we don't directly generate site.exp to avoid
49 ## the possibility of a corrupted site.exp if make is interrupted.
50 ## Jim Meyering has some useful text on this topic.
51 site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
52         @echo 'Making a new site.exp file ...'
53         @echo '## these variables are automatically generated by make ##' >site.tmp
54         @echo '# Do not edit here.  If you wish to override these values' >>site.tmp
55         @echo '# edit the last section' >>site.tmp
56         @echo 'set srcdir "$(srcdir)"' >>site.tmp
57         @echo "set objdir `pwd`" >>site.tmp
58 ## Quote the *_alias variables because they might be empty.
59 ?BUILD? @echo 'set build_alias "$(build_alias)"' >>site.tmp
60 ?BUILD? @echo 'set build_triplet $(build_triplet)' >>site.tmp
61 ?HOST?  @echo 'set host_alias "$(host_alias)"' >>site.tmp
62 ?HOST?  @echo 'set host_triplet $(host_triplet)' >>site.tmp
63 ?TARGET?        @echo 'set target_alias "$(target_alias)"' >>site.tmp
64 ?TARGET?        @echo 'set target_triplet $(target_triplet)' >>site.tmp
65 ## Allow the package author to extend site.exp.
66         @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
67           echo "## Begin content included from file $$f.  Do not modify. ##" \
68            && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
69            && echo "## End content included from file $$f. ##" \
70            || exit 1; \
71          done >> site.tmp
72         @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
73         @if test -f site.exp; then \
74            sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
75          fi
76         @-rm -f site.bak
77         @test ! -f site.exp || mv site.exp site.bak
78         @mv site.tmp site.exp
80 ## ---------- ##
81 ## Cleaning.  ##
82 ## ---------- ##
84 .PHONY distclean-am: distclean-DEJAGNU
86 distclean-DEJAGNU:
87 ## Any other cleaning must be done by the user or by the test suite
88 ## itself.  We can't predict what dejagnu or the test suite might
89 ## generate.
90         -rm -f site.exp site.bak
91         -l='$(DEJATOOL)'; for tool in $$l; do \
92           rm -f $$tool.sum $$tool.log; \
93         done