Merge branch 'minor'
[automake.git] / t / recurs-user.sh
bloba3f95ff45dfdd555851b4bbda720fb2990d6b789
1 #! /bin/sh
2 # Copyright (C) 2012-2017 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 checks on user-defined recursive rules.
18 # Check that user recursion respect $(SUBDIRS) order,
19 # and proceeds in a depth-first fashion.
21 . test-init.sh
23 cat >> configure.ac <<'END'
24 AM_EXTRA_RECURSIVE_TARGETS([foo])
25 AC_CONFIG_FILES([
26 sub1/Makefile
27 sub2/Makefile
28 sub3/Makefile
29 sub3/deeper/Makefile
31 AC_OUTPUT
32 END
34 mkdir sub1 sub2 sub3 sub3/deeper
36 cat > Makefile.am <<'END'
37 SUBDIRS = sub1 . sub3 sub2
38 foo-local:
39 echo '.' >> $(top_builddir)/got
40 .PHONY: test
41 test: foo
42 cat $(srcdir)/exp
43 cat ./got
44 diff $(srcdir)/exp ./got
45 check-local: test
46 MOSTLYCLEANFILES = got
47 EXTRA_DIST = exp
48 END
50 for i in 1 2 3; do
51 cat > sub$i/Makefile.am <<END
52 foo-local:
53 echo 'sub$i' >> \$(top_builddir)/got
54 END
55 done
57 echo SUBDIRS = deeper >> sub3/Makefile.am
59 cat >> sub3/deeper/Makefile.am <<'END'
60 foo-local:
61 echo sub3/deeper >> $(top_builddir)/got
62 END
64 cat >> exp <<'END'
65 sub1
67 sub3/deeper
68 sub3
69 sub2
70 END
72 $ACLOCAL
73 $AUTOCONF
74 $AUTOMAKE
76 ./configure
78 $MAKE test
79 $MAKE distcheck