tests: rename 'tests/' => 't/', '*.test' => '*.sh'
[platform/upstream/automake.git] / t / silentf77.sh
1 #!/bin/sh
2 # Copyright (C) 2010-2012 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Check silent-rules mode for Fortran 77.
18 # Keep this ins sync with the sister test silentf90.test.
19
20 required=fortran77
21 . ./defs || Exit 1
22
23 mkdir sub
24
25 cat >>configure.ac <<'EOF'
26 AM_SILENT_RULES
27 AC_PROG_F77
28 AC_CONFIG_FILES([sub/Makefile])
29 AC_OUTPUT
30 EOF
31
32 cat > Makefile.am <<'EOF'
33 # Need generic and non-generic rules.
34 bin_PROGRAMS = foo1 foo2
35 foo1_SOURCES = foo.f
36 foo2_SOURCES = $(foo1_SOURCES)
37 foo2_FFLAGS = $(AM_FFLAGS)
38 SUBDIRS = sub
39 EOF
40
41 cat > sub/Makefile.am <<'EOF'
42 AUTOMAKE_OPTIONS = subdir-objects
43 # Need generic and non-generic rules.
44 bin_PROGRAMS = bar1 bar2
45 bar1_SOURCES = bar.f
46 bar2_SOURCES = $(bar1_SOURCES)
47 bar2_FFLAGS = $(AM_FFLAGS)
48 EOF
49
50 cat > foo.f <<'EOF'
51       program foo
52       stop
53       end
54 EOF
55 cp foo.f sub/bar.f
56
57 $ACLOCAL
58 $AUTOMAKE --add-missing
59 $AUTOCONF
60
61 ./configure --enable-silent-rules
62 $MAKE >stdout || { cat stdout; Exit 1; }
63 cat stdout
64 # Avoid spurious failures with SunStudio Fortran compilers.
65 sed '/^NOTICE:/d' stdout > t
66 mv -f t stdout
67 cat stdout
68
69 $EGREP ' (-c|-o)' stdout && Exit 1
70 grep 'mv ' stdout && Exit 1
71
72 grep 'F77 .*foo\.'  stdout
73 grep 'F77 .*bar\.'  stdout
74 grep 'F77LD .*foo1' stdout
75 grep 'F77LD .*bar1' stdout
76 grep 'F77LD .*foo2' stdout
77 grep 'F77LD .*bar2' stdout
78
79 $EGREP '(FC|FCLD) ' stdout && Exit 1
80
81 # Ensure a clean rebuild.
82 $MAKE clean
83
84 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
85 cat stdout
86
87 grep ' -c ' stdout
88 grep ' -o ' stdout
89
90 $EGREP '(F77|FC|LD) ' stdout && Exit 1
91
92 :