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
90
91
92
93
94
95
96
97
98
99
100
|
#! /bin/sh
# Copyright (C) 2012-2015 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 <http://www.gnu.org/licenses/>.
# Test Automake-provided internal make macros to deal with VPATH rewrites.
. test-init.sh
echo AC_OUTPUT >> configure.ac
cat > Makefile.am << END
bsub:
mkdir \$@
bsub/foo: bsub
mkdir \$@
bsub/foo/bar: bsub/foo
mkdir \$@
bsub/mu.c++: bsub/foo
touch \$@
bsub/foo/pu.cxx: bsub/foo
touch \$@
clean-local:
rm -rf bsub
## Yes, I'm a lazy typist.
vr = \$(am.vpath.rewrite)
test-common: bsub/foo/bar bsub/mu.c++ bsub/foo/pu.cxx
test '\$(call vr,Makefile)' = Makefile
test '\$(call vr,$tab config.status )' = config.status
test '\$(call vr,.)' = .
## FIXME: These two do not work apparently :-( Such use cases are not
## FIXME: required presently though, so this is not a big deal.
: test '\$(call vr, bsub$tab )' = bsub
: test '\$(call vr,bsub)' = bsub
test '\$(call vr,bsub/.)' = bsub/.
test '\$(call vr,bsub/mu.c++)' = bsub/mu.c++
test '\$(call vr,bsub/foo/pu.cxx)' = bsub/foo/pu.cxx
test '\$(call vr,bsub/foo )' = bsub/foo
test '\$(call vr,bsub/foo/bar)' = bsub/foo/bar
test '\$(call vr,nonesuch)' = \$(srcdir)/nonesuch
test '\$(call vr, $tab nonesuch2 )' = \$(srcdir)/nonesuch2
test '\$(call vr, sub/none)' = \$(srcdir)/sub/none
test-vpath: test-common
test '\$(call vr,ssub)' = \$(srcdir)/ssub
test '\$(call vr,ssub/foo )' = \$(srcdir)/ssub/foo
test '\$(call vr, ssub/foo/bar)' = \$(srcdir)/ssub/foo/bar
test '\$(call vr,Makefile.in )' = \$(srcdir)/Makefile.in
test '\$(call vr,zap/paz.c)' = \$(srcdir)/zap/paz.c
test '\$(call vr,configure $tab)' = \$(srcdir)/configure
test '\$(call vr, configure.ac$tab )' = \$(srcdir)/configure.ac
test-intree: test-common
test '\$(call vr,ssub)' = ssub
test '\$(call vr,ssub/foo )' = ssub/foo
test '\$(call vr, ssub/foo/bar)' = ssub/foo/bar
test '\$(call vr,Makefile.in )' = Makefile.in
test '\$(call vr,zap/paz.c)' = zap/paz.c
test '\$(call vr,configure $tab)' = configure
test '\$(call vr, configure.ac$tab )' = configure.ac
END
$ACLOCAL
$AUTOMAKE
$AUTOCONF
mkdir zap ssub ssub/foo ssub/foo/bar
: > zap/paz.c
./configure
$MAKE test-intree
$MAKE distclean
mkdir build
cd build
../configure
$MAKE test-vpath
cd ..
ocwd=$(pwd) || fatal_ "couldn't get current working directory"
mkdir build2 build2/subbuild
cd build2/subbuild
"$ocwd"/configure
$MAKE test-vpath
:
|