doc: update Vala documentation
[automake.git] / t / posixsubst-sources.sh
blob266c7aa7d36c69ef8d3f9104895b156f36651130
1 #! /bin/sh
2 # Copyright (C) 2010-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 # Test that POSIX variable expansion '$(var:str=rpl)' works when used
18 # with the SOURCES primary.
20 required=cc
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AC_OUTPUT
26 END
28 cat > Makefile.am << 'END'
29 bin_PROGRAMS = foo
31 FOO = foo.cxx
32 BAR = bar__
33 BAZ = baz.
35 # Also try an empty match suffix, to ensure that the ':=' in there is
36 # not confused by the parser with an unportable assignment operator.
37 foo_SOURCES = main.c $(FOO:.cxx=.c)
38 dist_foo_SOURCES = $(BAR:__=.c)
39 nodist_foo_SOURCES = $(BAZ:=c)
41 bar.c baz.c:
42 echo 'int $@ (void) { return 0; }' | sed 's/\.c //' > $@
43 CLEANFILES = baz.c
44 CLEANFILES += bar.c # For FreeBSD make.
46 .PHONY: test test2
47 check-local: test1 test2
48 test1:
49 ls -l . $(srcdir)
50 test -f $(srcdir)/bar.c
51 test -f baz.c
52 test2: distdir
53 ls -l $(distdir)
54 ## These sources should be distributed ...
55 test -f $(distdir)/bar.c
56 test -f $(distdir)/foo.c
57 test -f $(distdir)/main.c
58 ## ... and this shouldn't.
59 test ! -r $(distdir)/baz.c
60 END
62 cat > main.c <<'END'
63 int main(void)
65 int foo(void), bar(void), baz(void);
66 return foo() + bar() + baz();
68 END
70 echo 'int foo(void) { return 0; }' > foo.c
72 $ACLOCAL
73 $AUTOCONF
74 $AUTOMAKE
76 ./configure
77 $MAKE
78 $MAKE test1 test2
79 $MAKE distcheck