#!/bin/sh
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check silent-rules mode, languages other than C.
+# This test partly overlaps with other silent*.test, but it serves as
+# a stress test by using many different languages at once -- so don't
+# remove this test script.
+# FIXME: generic C++/Fortran compilers should suffice here
required='g++ gfortran flex bison'
. ./defs
set -e
+# Avoids too much code duplication.
+do_and_check_silent_build ()
+{
+ case $1 in
+ --rebuild) rebuild=true;;
+ *) rebuild=false;;
+ esac
+
+ $MAKE >stdout || { cat stdout; Exit 1; }
+ cat stdout
+
+ $EGREP ' (-c|-o)' stdout && Exit 1
+ $EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+ grep 'CXX .*foo1\.' stdout
+ grep 'CXX .*baz1\.' stdout
+ grep 'FC .*foo2\.' stdout
+ grep 'FC .*baz2\.' stdout
+ grep 'F77 .*foo3\.' stdout
+ grep 'F77 .*baz3\.' stdout
+ grep ' CC .*foo5\.' stdout
+ grep ' CC .*baz5\.' stdout
+ grep ' CC .*foo6\.' stdout
+ grep ' CC .*baz6\.' stdout
+
+ grep 'CXXLD .*foo' stdout
+ grep 'CCLD .*bar' stdout
+ grep 'CXXLD .*baz' stdout
+ grep 'CCLD .*bla' stdout
+
+ if $rebuild; then :; else
+ grep 'YACC .*foo6\.' stdout
+ grep 'YACC .*baz6\.' stdout
+ grep 'LEX .*foo5\.' stdout
+ grep 'LEX .*baz5\.' stdout
+ fi
+
+ unset rebuild
+}
+
+# Avoids too much code duplication.
+do_and_check_verbose_build ()
+{
+
+ case $1 in
+ --rebuild) rebuild=true;;
+ *) rebuild=false;;
+ esac
+
+ $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+ cat stdout
+
+ grep ' -c ' stdout
+ grep ' -o ' stdout
+
+ grep '(CC|CXX|FC|F77|LD) ' stdout && Exit 1
+
+ if $rebuild; then :; else
+ grep 'ylwrap ' stdout
+ grep '(LEX|YACC) ' stdout && Exit 1
+ fi
+
+ unset rebuild
+}
+
mkdir sub
cat >>configure.in <<'EOF'
$AUTOCONF
# configure once for fastdep, once for non-fastdep, once for nodep
-for config_args in '' am_cv_CC_dependencies_compiler_type=gcc \
+for config_args in \
+ '' \
+ am_cv_CC_dependencies_compiler_type=gcc \
--disable-dependency-tracking
do
- ./configure $config_args --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
- cat stdout
- grep ' -c' stdout && Exit 1
- grep ' -o ' stdout && Exit 1
- grep 'mv ' stdout && Exit 1
- grep 'CXX .*foo1\.' stdout
- grep 'CXX .*baz1\.' stdout
- grep 'FC .*foo2\.' stdout
- grep 'FC .*baz2\.' stdout
- grep 'F77 .*foo3\.' stdout
- grep 'F77 .*baz3\.' stdout
- grep 'LEX .*foo5\.' stdout
- grep 'LEX .*baz5\.' stdout
- grep ' CC .*foo5\.' stdout
- grep ' CC .*baz5\.' stdout
- grep 'YACC .*foo6\.' stdout
- grep 'YACC .*baz6\.' stdout
- grep ' CC .*foo6\.' stdout
- grep ' CC .*baz6\.' stdout
+ ./configure $config_args --enable-silent-rules
- grep 'CXXLD .*foo' stdout
- grep 'CCLD .*bar' stdout
- grep 'CXXLD .*baz' stdout
- grep 'CCLD .*bla' stdout
+ do_and_check_silent_build
+ # Cleaning and then rebuilding with the same V flag (and without
+ # removing the generated sources in between) shouldn't trigger a
+ # different set of rules.
+ $MAKE clean
+ do_and_check_silent_build --rebuild
+ # Ensure a clean rebuild.
$MAKE clean
- $MAKE V=1 >stdout || { cat stdout; Exit 1; }
- cat stdout
- grep ' -c' stdout
- grep ' -o ' stdout
+ # This is required, since these files are not removed by `make clean'
+ # (as dictated by the GNU Coding Standards).
+ rm -f foo5.c foo6.[ch] sub/baz5.c sub/baz6.[ch]
+
+ do_and_check_verbose_build
+ # Cleaning and then rebuilding with the same V flag (and without
+ # removing the generated sources in between) shouldn't trigger a
+ # different set of rules.
+ $MAKE clean
+ do_and_check_verbose_build --rebuild
- grep 'CXX .*foo1\.' stdout && Exit 1
- grep 'CXX .*baz1\.' stdout && Exit 1
- grep 'FC .*foo2\.' stdout && Exit 1
- grep 'FC .*baz2\.' stdout && Exit 1
- grep 'F77 .*foo3\.' stdout && Exit 1
- grep 'F77 .*baz3\.' stdout && Exit 1
- grep 'LEX .*foo5\.' stdout && Exit 1
- grep 'LEX .*baz5\.' stdout && Exit 1
- grep ' CC .*foo5\.' stdout && Exit 1
- grep ' CC .*baz5\.' stdout && Exit 1
- grep 'YACC .*foo6\.' stdout && Exit 1
- grep 'YACC .*baz6\.' stdout && Exit 1
- grep ' CC .*foo6\.' stdout && Exit 1
- grep ' CC .*baz6\.' stdout && Exit 1
-
- grep 'CXXLD .*foo' stdout && Exit 1
- grep 'CCLD .*bar' stdout && Exit 1
- grep 'CXXLD .*baz' stdout && Exit 1
- grep 'CCLD .*bla' stdout && Exit 1
+ # Ensure a clean reconfiguration/rebuild.
$MAKE clean
$MAKE maintainer-clean
+
done
: