summaryrefslogtreecommitdiff
path: root/t/remake-recurs-user.sh
blob: 5cbd4d8235f56d8f2f1a44d3da0beb46caa1ab0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#! /bin/sh
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Remake rules and user-defined recursive rules.

. test-init.sh

cat >> configure.ac << 'END'
m4_include([extra-targets.m4])
AC_CONFIG_FILES([sub/Makefile])
AC_OUTPUT
END

echo 'AM_EXTRA_RECURSIVE_TARGETS([foo])' > extra-targets.m4

cat > Makefile.am << 'END'
SUBDIRS = sub
all-local: foo
foo-local:
	: > foo
bar-local:
	: > bar
MOSTLYCLEANFILES = foo
END

mkdir sub
cat > sub/Makefile.am << 'END'
foo-local:
	: > foo2
MOSTLYCLEANFILES = foo2
bar-local: later-target
END

$ACLOCAL
$AUTOCONF
$AUTOMAKE

./configure

$MAKE
test -f foo
test -f sub/foo2
test ! -f bar
test ! -f sub/zardoz
$MAKE distcheck

$sleep

echo 'AM_EXTRA_RECURSIVE_TARGETS([bar])' >> extra-targets.m4

cat >> Makefile.am <<'END'
MOSTLYCLEANFILES += bar oof
all-local: bar
foo-local: oof
oof:
	: > $@
END

echo 'include $(srcdir)/more.am' >> sub/Makefile.am

cat > sub/more.am << 'END'
later-target:
	: > zardoz
DISTCLEANFILES = zardoz
END

using_gmake || $MAKE Makefile
$MAKE
test -f foo
test -f oof
test -f sub/foo2
test -f bar
test -f sub/zardoz
$MAKE distcheck

: