doc: update Vala documentation
[automake.git] / t / silent-many-languages.sh
blobce989156d53791db42d99fa1ddfc7fe3d7b6d8f2
1 #!/bin/sh
2 # Copyright (C) 2009-2024 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 # Check silent-rules mode, with many languages at once.
18 # This test partly overlaps with other 'silent*.sh', but it serves as
19 # a stress test by using many different languages at once -- so don't
20 # remove this test script.
22 required='cc c++ fortran fortran77 lex yacc'
23 . test-init.sh
25 # Avoids too much code duplication.
26 do_and_check_silent_build ()
28 case $1 in
29 --rebuild) rebuild=true;;
30 *) rebuild=false;;
31 esac
33 run_make -O
34 # Avoid spurious failures with SunStudio Fortran compilers.
35 sed '/^NOTICE:/d' stdout > t
36 mv -f t stdout
37 cat stdout
39 $EGREP ' (-c|-o)' stdout && exit 1
40 $EGREP '(mv|ylwrap) ' stdout && exit 1
42 grep 'CXX .*foo1\.' stdout
43 grep 'CXX .*baz1\.' stdout
44 grep 'FC .*foo2\.' stdout
45 grep 'FC .*baz2\.' stdout
46 grep 'F77 .*foo3\.' stdout
47 grep 'F77 .*baz3\.' stdout
48 grep ' CC .*foo5\.' stdout
49 grep ' CC .*baz5\.' stdout
50 grep ' CC .*foo6\.' stdout
51 grep ' CC .*baz6\.' stdout
53 grep 'CXXLD .*foo' stdout
54 grep 'CCLD .*bar' stdout
55 grep 'CXXLD .*baz' stdout
56 grep 'CCLD .*bla' stdout
58 if ! $rebuild; then
59 grep 'YACC .*foo6\.' stdout
60 grep 'YACC .*baz6\.' stdout
61 grep 'LEX .*foo5\.' stdout
62 grep 'LEX .*baz5\.' stdout
65 unset rebuild
68 # Avoids too much code duplication.
69 do_and_check_verbose_build ()
71 case $1 in
72 --rebuild) rebuild=true;;
73 *) rebuild=false;;
74 esac
76 run_make -O V=1
78 grep ' -c ' stdout
79 grep ' -o ' stdout
81 $EGREP '(CC|CXX|FC|F77|LD) ' stdout && exit 1
83 if ! $rebuild; then
84 grep 'ylwrap ' stdout
85 $EGREP '(LEX|YACC) ' stdout && exit 1
88 unset rebuild
91 mkdir sub
93 cat >>configure.ac <<'EOF'
94 AC_PROG_F77
95 AC_PROG_FC
96 AC_PROG_LEX
97 AC_PROG_YACC
98 AC_PROG_CXX
100 # The SunStudio C++ compiler is unfortunately named 'sunCC' (or even just
101 # 'CC', yuck!); similarly and the Portland group C++ compiler is named
102 # 'pgCC'. This can cause problems with our grepping checks on the output
103 # from make. Avoid these problems by invoking a wrapper script, as
104 # filtering the make output proved too fragile.
105 case " $CXX " in
106 *'CC '*)
107 AC_MSG_WARN([the C++ compiler '$CXX' name ends with 'CC'])
108 AC_MSG_WARN([it will be wrapped with the custom script 'am--cxx'])
109 echo '#!/bin/sh' > bin/am--cxx
110 echo 'PATH=$saved_PATH; export PATH' >> bin/am--cxx
111 echo "case \$# in" >> bin/am--cxx
112 echo " 0) exec $CXX ;;" >> bin/am--cxx
113 echo " *) exec $CXX \"\$@\" ;;" >> bin/am--cxx
114 echo "esac" >> bin/am--cxx
115 chmod a+x bin/am--cxx
116 CXX=am--cxx
117 esac
119 AC_CONFIG_FILES([sub/Makefile])
120 AC_OUTPUT
123 cat > Makefile.am <<'EOF'
124 # Need generic and non-generic rules.
125 bin_PROGRAMS = foo bar fo2
126 bar_CFLAGS = $(AM_CFLAGS)
127 foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y
128 fo2_SOURCES = $(foo_SOURCES)
129 fo2_CPPFLAGS = $(AM_CPPFLAGS)
130 fo2_FFLAGS = $(AM_FFLAGS)
131 fo2_FCFLAGS = $(AM_FCFLAGS)
132 fo2_YFLAGS = -v
133 fo2_LFLAGS = -n
134 fo2_LDADD = $(LEXLIB)
135 SUBDIRS = sub
136 AM_YFLAGS = -d
137 BUILT_SOURCES = foo6.h
140 cat > sub/Makefile.am <<'EOF'
141 AUTOMAKE_OPTIONS = subdir-objects
142 # Need generic and non-generic rules.
143 bin_PROGRAMS = baz bla ba2
144 bla_CFLAGS = $(AM_CFLAGS)
145 baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y
146 ba2_SOURCES = $(baz_SOURCES)
147 ba2_CPPFLAGS = $(AM_CPPFLAGS)
148 ba2_FFLAGS = $(AM_FFLAGS)
149 ba2_FCFLAGS = $(AM_FCFLAGS)
150 ba2_YFLAGS = -v
151 ba2_LFLAGS = -n
152 ba2_LDADD = $(LEXLIB)
153 AM_YFLAGS = -d
154 AM_LFLAGS = --never-interactive
155 BUILT_SOURCES = baz6.h
158 cat > foo1.cpp <<'EOF'
159 int main ()
161 return 0;
164 cat > foo2.f90 <<'EOF'
165 subroutine foo2
166 return
169 cat > foo3.f <<'EOF'
170 subroutine foo3
171 return
174 cat > foo5.l <<'EOF'
176 #define YY_NO_UNISTD_H 1
177 int isatty (int fd) { return 0; }
180 "END" return EOF;
183 /* Avoid possible link errors. */
184 int yywrap (void)
186 return 1;
189 cat > foo6.y <<'EOF'
191 extern int yylex (void);
192 void yyerror (const char *s) {}
194 %token EOF
196 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
198 cp foo1.cpp bar.c
199 cp foo1.cpp sub/baz.c
200 cp foo1.cpp sub/bla.c
201 cp foo1.cpp sub/baz1.cpp
202 cp foo2.f90 sub/baz2.f90
203 cp foo3.f sub/baz3.f
204 cp foo5.l sub/baz5.l
205 cp foo6.y sub/baz6.y
207 mkdir bin
208 saved_PATH=$PATH; export saved_PATH
209 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
211 $ACLOCAL
212 $AUTOMAKE --add-missing
213 $AUTOCONF
215 # Ensure per-target rules are used, to ensure their coverage below.
216 # (We do not do an exhaustive check, that wouldn't be practical).
217 $FGREP 'bar-bar.o' Makefile.in
218 $FGREP 'fo2-foo5.c' Makefile.in
219 $FGREP 'fo2-foo6.c' Makefile.in
221 # Force dependency tracking explicitly, so that slow dependency
222 # extractors are not rejected. Try also with dependency tracking
223 # explicitly disabled.
224 for config_args in \
225 --enable-dependency-tracking --disable-dependency-tracking
228 ./configure $config_args --enable-silent-rules
230 do_and_check_silent_build
231 # Cleaning and then rebuilding with the same V flag (and without
232 # removing the generated sources in between) shouldn't trigger a
233 # different set of rules.
234 $MAKE clean
235 do_and_check_silent_build --rebuild
237 # Ensure a clean rebuild.
238 $MAKE clean
239 # This is required, since these files are not removed by 'make clean'
240 # (as dictated by the GNU Coding Standards).
241 rm -f *foo5.c *foo6.[ch] sub/*baz5.c sub/*baz6.[ch]
243 do_and_check_verbose_build
244 # Cleaning and then rebuilding with the same V flag (and without
245 # removing the generated sources in between) shouldn't trigger a
246 # different set of rules.
247 $MAKE clean
248 do_and_check_verbose_build --rebuild
250 # Ensure a clean reconfiguration/rebuild.
251 $MAKE clean
252 $MAKE maintainer-clean
254 done