source: trunk/essentials/sys-devel/automake-1.9/tests/spy.test

Last change on this file was 3086, checked in by bird, 18 years ago

automake 1.9.6

File size: 3.2 KB
Line 
1#! /bin/sh
2# Copyright (C) 2003 Free Software Foundation, Inc.
3#
4# This file is part of GNU Automake.
5#
6# GNU Automake is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# GNU Automake is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Automake; see the file COPYING. If not, write to
18# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19# Boston, MA 02110-1301, USA.
20
21# Check whether double colon rules work. The Unix V7 make manual
22# mentions double-colon rules, but POSIX does not. They seem to be
23# supported by all Make implementation as we can tell. This test case
24# is a spy: we want to detect if there exist implementations where
25# these do not work. We might use these rules to simplify the rebuild
26# rules (instead of the $? hack).
27
28# Tom Tromey write:
29# | In the distant past we used :: rules extensively.
30# | Fran?ois convinced me to get rid of them:
31# |
32# | Thu Nov 23 18:02:38 1995 Tom Tromey <tromey@cambric>
33# | [ ... ]
34# | * subdirs.am: Removed "::" rules
35# | * header.am, libraries.am, mans.am, texinfos.am, footer.am:
36# | Removed "::" rules
37# | * scripts.am, programs.am, libprograms.am: Removed "::" rules
38# |
39# |
40# | I no longer remember the rationale for this. It may have only been a
41# | belief that they were unportable.
42
43# On a related topic, the Autoconf manual has the following text:
44# | `VPATH' and double-colon rules
45# | Any assignment to `VPATH' causes Sun `make' to only execute
46# | the first set of double-colon rules. (This comment has been
47# | here since 1994 and the context has been lost. It's probably
48# | about SunOS 4. If you can reproduce this, please send us a
49# | test case for illustration.)
50
51# We already know that overlapping ::-rule like
52#
53# a :: b
54# echo rule1 >> $@
55# a :: c
56# echo rule2 >> $@
57# a :: b c
58# echo rule3 >> $@
59#
60# do not work equally on all platforms. It seems that in all cases
61# Make attempts to run all matching rules. However at least GNU Make,
62# NetBSD Make, and FreeBSD Make will detect that $@ was updated by the
63# first matching rule and skip remaining matches (with the above
64# example that means that unless `a' was declared PHONY, only "rule1"
65# will be appended to `a' if both b and c have changed). Other
66# implementations like OSF1 Make and HP-UX Make do not perform such a
67# check and execute all matching rules whatever they do ("rule1",
68# "rule2", abd "rule3" will all be appended to `a' if b and c have
69# changed).
70
71# So it seems only non-overlapping ::-rule may be portable. This is
72# what we check now.
73
74. ./defs || exit 1
75
76set -e
77
78cat >Makefile <<\EOF
79a :: b
80 echo rule1 >> $@
81a :: c
82 echo rule2 >> $@
83EOF
84
85touch b c
86$sleep
87: > a
88$MAKE
89test "`cat a`" = ''
90$sleep
91touch b
92$MAKE
93test "`cat a`" = rule1
94: > a
95$sleep
96touch c
97$MAKE
98test "`cat a`" = rule2
Note: See TracBrowser for help on using the repository browser.