doc: typos in test file.
[automake.git] / t / built-sources.sh
blob2a425111188762506d08a5bcec488bcbc963b950
1 #! /bin/sh
2 # Copyright (C) 2003-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 # Basic test on BUILT_SOURCES.
19 required=cc
20 . test-init.sh
22 cat >> configure.ac <<'END'
23 AC_PROG_CC
24 AC_OUTPUT
25 END
27 cat > Makefile.am << 'END'
28 BUILT_SOURCES = foo.c
29 noinst_PROGRAMS = bar baz
30 foo.c:
31 rm -f $@ $@-t
32 ## Use printf, not echo, to avoid spurious interpretation of
33 ## the "\n" as a newline (seen on NetBSD 5.1).
34 printf '%s\n' '#include <stdio.h>' > $@-t
35 printf '%s\n' 'int main (void)' >> $@-t
36 printf '%s\n' '{ ' >> $@-t
37 printf '%s\n' ' printf ("%s\n", FOOMSG);' >> $@-t
38 printf '%s\n' ' return 0;' >> $@-t
39 printf '%s\n' '}' >> $@-t
40 mv -f $@-t $@
41 CLEANFILES = foo.c
42 END
44 cat > bar.c <<'END'
45 #define FOOMSG "Howdy, World"
46 #include "foo.c"
47 END
49 cat > baz.c <<'END'
50 #define FOOMSG "Hello, Earth"
51 #include "foo.c"
52 END
54 $ACLOCAL
55 $AUTOMAKE
56 $AUTOCONF
58 ./configure
59 $MAKE
60 if cross_compiling; then :; else
61 ./bar
62 ./bar | grep 'Howdy, World'
63 ./baz
64 ./baz | grep 'Hello, Earth'
66 $MAKE distcheck