tests: Let 'ltorder.sh' run successfully with Guix dynamic loader
[automake.git] / t / recurs-user-deeply-nested.sh
blob771adf2e3693221b8138e4f2915b22550dda2ee8
1 #! /bin/sh
2 # Copyright (C) 2012-2018 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 that recursion on user-defined targets can be made to work
18 # with "deeply" nested uses of $(SUBDIRS).
20 . test-init.sh
22 cat >> configure.ac <<'END'
23 AC_CONFIG_FILES([
24 sub1/Makefile
25 sub1/sub2/Makefile
26 sub1/sub2/sub3/Makefile
27 sub1/sub2/sub3/sub4/Makefile
29 AM_EXTRA_RECURSIVE_TARGETS([foo])
30 AC_OUTPUT
31 END
33 dirs='sub1 sub1/sub2 sub1/sub2/sub3 sub1/sub2/sub3/sub4'
35 mkdir $dirs
37 cat > Makefile.am <<'END'
38 SUBDIRS = sub1
40 foo-local:
41 cp sub1/foo foo
42 MOSTLYCLEANFILES = foo
44 .PHONY: test
45 test:
46 echo 'It works!' > exp
47 diff exp foo
48 diff exp sub1/foo
49 test ! -f sub1/sub2/foo
50 test ! -f sub1/sub2/sub3/foo
51 diff exp sub1/sub2/sub3/sub4/foo
52 rm -f exp
54 all-local: foo
55 check-local: test
56 END
58 cat > sub1/Makefile.am <<'END'
59 SUBDIRS = sub2
60 foo-local:
61 test ! -f sub2/sub3/foo
62 cp sub2/sub3/sub4/foo foo
63 MOSTLYCLEANFILES = foo
64 END
66 # Here we deliberately lack an explicit definition the 'foo-local'
67 # target; that shouldn't stop 'foo' recursion into subdirectory
68 # 'sub3/sub4'.
69 echo SUBDIRS = sub3 > sub1/sub2/Makefile.am
70 echo SUBDIRS = sub4 > sub1/sub2/sub3/Makefile.am
72 cat > sub1/sub2/sub3/sub4/Makefile.am <<'END'
73 foo-local:
74 echo 'It works!' > foo
75 MOSTLYCLEANFILES = foo
76 END
78 $ACLOCAL
79 $AUTOCONF
80 $AUTOMAKE
82 for d in $dirs; do
83 $FGREP foo-am $d/Makefile.in || exit 1
84 case $d in
85 */sub4);;
86 *) $FGREP foo-recursive $d/Makefile.in || exit 1;;
87 esac
88 done
90 ./configure
92 $MAKE foo
93 $MAKE test
95 $MAKE distcheck