Allow user to extend .PRECIOUS target
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 Dec 2013 18:31:15 +0000 (19:31 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 Dec 2013 18:31:15 +0000 (19:31 +0100)
References:
<http://lists.freedesktop.org/archives/systemd-devel/2013-July/012155.html>
<http://lists.gnu.org/archive/html/automake/2013-07/msg00011.html>

* bin/automake.in: Adjust to ensure we handle '.PRECIOUS' the same way
we do for '.PHONY' and '.MAKE'.
* lib/Automake/Rule.pm: Likewise.
* t/precious.sh: New test.
* t/list-of-tests.mk: Add it.
* t/phony.sh: Enhance a little while at it.
* NEWS: Update.
* THANKS: Likewise.

Reported-by: Holger Hans Peter Freyther <holger@freyther.de>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
THANKS
bin/automake.in
lib/Automake/Rule.pm
t/list-of-tests.mk
t/phony.sh
t/precious.sh [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 8d902c07c8a2030903a879ca66fc9095df8e516e..dd2812a82c699a0d16c0c43e94c4c77f8ab3d43c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -93,6 +93,11 @@ New in 1.15:
     implementation of the TAP driver (that is documented in the manual)
     is more portable and has feature parity with the perl implementation.
 
+* Bug fixes:
+
+  - The user can now extend the special .PRECIOUS target, the same way
+    he could already do with the .MAKE .and .PHONY targets.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.14.1:
diff --git a/THANKS b/THANKS
index 2b4f8eeec745f5f7aa29d72921de0d7e33df2da8..58dac98a96d035b67f066ff2d30fe974cfc7a89f 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -152,6 +152,7 @@ Harlan Stenn                    Harlan.Stenn@pfcs.com
 He Li                           tippa000@yahoo.com
 Henrik Frystyk Nielsen          frystyk@w3.org
 Hib Eris                        hib@hiberis.nl
+Holger Hans Peter Freyther      holger@freyther.de
 Ian Lance Taylor                ian@cygnus.com
 Ignacy Gawedzki                 i@lri.fr
 Илья Н. Голубев                 gin@mo.msk.ru
index 283d1bbfe28f27dea4db343add7defbb6cee0962..880830022a590c7314457a78b04e2ae132e5deb1 100644 (file)
@@ -4645,9 +4645,9 @@ sub handle_factored_dependencies ()
       # to append dependencies.  This would not work if Automake
       # refrained from defining its own .PHONY target as it does
       # with other overridden targets.
-      # Likewise for '.MAKE'.
+      # Likewise for '.MAKE' and '.PRECIOUS'.
       my @undefined_conds = (TRUE,);
-      if ($_ ne '.PHONY' && $_ ne '.MAKE')
+      if ($_ ne '.PHONY' && $_ ne '.MAKE' && $_ ne '.PRECIOUS')
        {
          @undefined_conds =
            Automake::Rule::define ($_, 'internal',
index a28a78d367197952b2fcfde03a08ca4d3cc3e2b7..5227009026ac1ddb23c18c1f254430f23a9b0b00 100644 (file)
@@ -340,8 +340,8 @@ sub reset()
      # Tarballing.
      'dist-all'             => [],
 
-     # Phonying.
      '.PHONY'               => [],
+     '.PRECIOUS'            => [],
      # Recursive install targets (so "make -n install" works for BSD Make).
      '.MAKE'               => [],
      );
index 54afd8f56da7fbdc368d692a97b8b48152b093d1..a9694d8169a7afc159b600ea8065adfd57f3c892 100644 (file)
@@ -838,6 +838,7 @@ t/percent.sh \
 t/percent2.sh \
 t/per-target-flags.sh \
 t/phony.sh \
+t/precious.sh \
 t/pluseq.sh \
 t/pluseq2.sh \
 t/pluseq3.sh \
index dd0c54a3fc1e5db59a0eda17d3782e7fe2e0f4f3..a632776182a2feaf499fb8775f99b7ada90063be 100644 (file)
@@ -26,6 +26,7 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+$FGREP '.PHONY:' Makefile.in  # For debugging.
 test $($FGREP -c '.PHONY:' Makefile.in) -eq 3
 
 :
diff --git a/t/precious.sh b/t/precious.sh
new file mode 100644 (file)
index 0000000..8750305
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copyright (C) 2013 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/>.
+
+# Make sure .PRECIOUS can be extended by the user, and can be given
+# dependencies several times.
+
+. test-init.sh
+
+cat >Makefile.am << 'EOF'
+.PRECIOUS: foo
+.PRECIOUS: bar
+EOF
+
+$ACLOCAL
+$AUTOMAKE
+$FGREP '.PRECIOUS:' Makefile.in  # For debugging.
+test $($FGREP -c '.PRECIOUS:' Makefile.in) -eq 3
+
+: