| 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 | # Make sure aclocal does not overwrite aclocal.m4 needlessly.
|
|---|
| 22 | # Also make sure automake --no-force does not overwrite Makefile.in needlessly.
|
|---|
| 23 |
|
|---|
| 24 | . ./defs || exit 1
|
|---|
| 25 |
|
|---|
| 26 | set -e
|
|---|
| 27 |
|
|---|
| 28 | cat >> configure.in << 'END'
|
|---|
| 29 | SOME_DEFS
|
|---|
| 30 | AC_CONFIG_FILES([sub/Makefile])
|
|---|
| 31 | END
|
|---|
| 32 |
|
|---|
| 33 | mkdir sub
|
|---|
| 34 | : > sub/Makefile.am
|
|---|
| 35 |
|
|---|
| 36 | cat >> Makefile.am << 'END'
|
|---|
| 37 | SUBDIRS = sub
|
|---|
| 38 | include fragment.inc
|
|---|
| 39 | END
|
|---|
| 40 |
|
|---|
| 41 | : > fragment.inc
|
|---|
| 42 |
|
|---|
| 43 | mkdir m4
|
|---|
| 44 | echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
|
|---|
| 45 |
|
|---|
| 46 | $sleep
|
|---|
| 47 |
|
|---|
| 48 | $ACLOCAL -I m4
|
|---|
| 49 |
|
|---|
| 50 | # Automake will take aclocal.m4 to be newer if it has the same timestamp
|
|---|
| 51 | # as Makefile.in. Avoid the confusing by sleeping.
|
|---|
| 52 | $sleep
|
|---|
| 53 |
|
|---|
| 54 | $AUTOMAKE --no-force
|
|---|
| 55 |
|
|---|
| 56 | $sleep
|
|---|
| 57 |
|
|---|
| 58 | touch foo
|
|---|
| 59 | $ACLOCAL -I m4
|
|---|
| 60 | $AUTOMAKE --no-force
|
|---|
| 61 |
|
|---|
| 62 | # aclocal.m4 and Makefile.in should not have been updated, so `foo'
|
|---|
| 63 | # should be younger
|
|---|
| 64 | test `ls -1t aclocal.m4 Makefile.in sub/Makefile.in foo | sed 1q` = foo
|
|---|
| 65 |
|
|---|
| 66 | $sleep
|
|---|
| 67 | $ACLOCAL -I m4 --force
|
|---|
| 68 | test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
|
|---|
| 69 | # We still use --no-force for automake, but since aclocal.m4 has
|
|---|
| 70 | # changed all Makefile.ins should be updated.
|
|---|
| 71 | $sleep
|
|---|
| 72 | $AUTOMAKE --no-force
|
|---|
| 73 | test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
|
|---|
| 74 | test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
|
|---|
| 75 |
|
|---|
| 76 | touch m4/somedefs.m4
|
|---|
| 77 | $sleep
|
|---|
| 78 | touch foo
|
|---|
| 79 | $sleep
|
|---|
| 80 | $ACLOCAL -I m4
|
|---|
| 81 | $sleep
|
|---|
| 82 | $AUTOMAKE --no-force
|
|---|
| 83 |
|
|---|
| 84 | # aclocal.m4 should have been updated, although its contents haven't changed.
|
|---|
| 85 | test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
|
|---|
| 86 | test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
|
|---|
| 87 | test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
|
|---|
| 88 |
|
|---|
| 89 | touch fragment.inc
|
|---|
| 90 | $sleep
|
|---|
| 91 | touch foo
|
|---|
| 92 | $ACLOCAL -I m4
|
|---|
| 93 | $AUTOMAKE --no-force
|
|---|
| 94 | # Only ./Makefile.in should change.
|
|---|
| 95 | test `ls -1t aclocal.m4 foo | sed 1q` = foo
|
|---|
| 96 | test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
|
|---|
| 97 | test `ls -1t sub/Makefile.in foo | sed 1q` = foo
|
|---|
| 98 |
|
|---|
| 99 | grep README Makefile.in && exit 1
|
|---|
| 100 |
|
|---|
| 101 | : > README
|
|---|
| 102 | $sleep
|
|---|
| 103 | touch foo
|
|---|
| 104 | $AUTOMAKE --no-force
|
|---|
| 105 | # Even if no dependency change, the content changed.
|
|---|
| 106 | test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
|
|---|
| 107 | test `ls -1t sub/Makefile.in foo | sed 1q` = foo
|
|---|
| 108 |
|
|---|
| 109 | grep README Makefile.in
|
|---|
| 110 |
|
|---|
| 111 | : > sub/Makefile.in
|
|---|
| 112 | $sleep
|
|---|
| 113 | touch foo
|
|---|
| 114 | $ACLOCAL -I m4
|
|---|
| 115 | $AUTOMAKE --no-force
|
|---|
| 116 | # Only sub/Makefile.in should change.
|
|---|
| 117 | test `ls -1t aclocal.m4 foo | sed 1q` = foo
|
|---|
| 118 | test `ls -1t Makefile.in foo | sed 1q` = foo
|
|---|
| 119 | test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
|
|---|