summaryrefslogtreecommitdiff
path: root/t/pattern-rules.sh
blob: 4f3d1308af6651c396587027001d1ddc1b001628 (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
#! /bin/sh
# Copyright (C) 2011-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/>.

# Automake do not complain about nor messes up pattern rules.

. test-init.sh

echo AC_OUTPUT >> configure.ac

cat > Makefile.am <<'END'
foo/%.out: bar/%.in
	test -d $(dir $@) || $(MKDIR_P) $(dir $@)
	cp $< $@
%.sh: %/z
	cp $< $@
%:
	echo True > $@
noinst_DATA = foo/one.out
noinst_SCRIPTS = two.sh mu.py
END

mkdir bar two
echo "123456789" > bar/one.in
echo "#!/bin/sh" > two/z

$ACLOCAL
$AUTOCONF
$AUTOMAKE

for vpath in : false; do
  if $vpath; then
    mkdir build
    cd build
    srcdir=..
  else
    srcdir=.
  fi
  $srcdir/configure
  $MAKE
  diff $srcdir/bar/one.in ./foo/one.out
  diff $srcdir/two/z ./two.sh
  test "$(cat mu.py)" = True
  cd $srcdir
done

: