Fix brought over from gettext.
[gnulib.git] / gnulib-tool
index 018ab80..519e461 100755 (executable)
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2006-05-02 14:31:00 $'
+cvsdatestamp='$Date: 2006-06-23 19:27:17 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 
@@ -136,13 +136,29 @@ Report bugs to <bug-gnulib@gnu.org>."
 # outputs to stdout the --version message.
 func_version ()
 {
+  year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'`
   echo "$progname (GNU $package) $version"
-  echo "Copyright (C) 2002-2005 Free Software Foundation, Inc.
+  echo "Copyright (C) $year Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
   echo "Written by" "Bruno Haible" "and" "Simon Josefsson"
 }
 
+# func_emit_copyright_notice
+# outputs to stdout a header for a generated file.
+func_emit_copyright_notice ()
+{
+  echo "# Copyright (C) 2004-2006 Free Software Foundation, Inc."
+  echo "#"
+  echo "# This file is free software, distributed under the terms of the GNU"
+  echo "# General Public License.  As a special exception to the GNU General"
+  echo "# Public License, this file may be distributed as part of a program"
+  echo "# that contains a configuration script generated by Autoconf, under"
+  echo "# the same distribution terms as the rest of that program."
+  echo "#"
+  echo "# Generated by gnulib-tool."
+}
+
 # func_tmpdir
 # creates a temporary directory.
 # Sets variable
@@ -716,15 +732,7 @@ func_emit_lib_Makefile_am ()
     perhapsLT=
   fi
   echo "## Process this file with automake to produce Makefile.in."
-  echo "# Copyright (C) 2004 Free Software Foundation, Inc."
-  echo "#"
-  echo "# This file is free software, distributed under the terms of the GNU"
-  echo "# General Public License.  As a special exception to the GNU General"
-  echo "# Public License, this file may be distributed as part of a program"
-  echo "# that contains a configuration script generated by Automake, under"
-  echo "# the same distribution terms as the rest of that program."
-  echo "#"
-  echo "# Generated by gnulib-tool."
+  func_emit_copyright_notice
   if test -n "$actioncmd"; then
     echo "# Reproduce by: $actioncmd"
   fi
@@ -741,6 +749,7 @@ func_emit_lib_Makefile_am ()
   echo "BUILT_SOURCES ="
   echo "SUFFIXES ="
   echo "MOSTLYCLEANFILES ="
+  echo "MOSTLYCLEANDIRS ="
   echo "CLEANFILES ="
   echo "DISTCLEANFILES ="
   echo "MAINTAINERCLEANFILES ="
@@ -769,6 +778,14 @@ func_emit_lib_Makefile_am ()
     fi
   done
   echo
+  echo "mostlyclean-local:"
+  echo "       @test -z \"\$(MOSTLYCLEANDIRS)\" || \\"
+  echo "         for dir in \$(MOSTLYCLEANDIRS); do \\"
+  echo "           if test -d \$\$dir; then \\"
+  echo "             echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
+  echo "           fi; \\"
+  echo "         done"
+  echo
   echo "# Makefile.am ends here"
 }
 
@@ -790,15 +807,7 @@ func_emit_tests_Makefile_am ()
   fi
   testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
   echo "## Process this file with automake to produce Makefile.in."
-  echo "# Copyright (C) 2004-2005 Free Software Foundation, Inc."
-  echo "#"
-  echo "# This file is free software, distributed under the terms of the GNU"
-  echo "# General Public License.  As a special exception to the GNU General"
-  echo "# Public License, this file may be distributed as part of a program"
-  echo "# that contains a configuration script generated by Automake, under"
-  echo "# the same distribution terms as the rest of that program."
-  echo "#"
-  echo "# Generated by gnulib-tool."
+  func_emit_copyright_notice
   echo
   # Generate dependencies here, since it eases the debugging of test failures.
   echo "AUTOMAKE_OPTIONS = 1.5 foreign"
@@ -818,6 +827,7 @@ func_emit_tests_Makefile_am ()
   echo "BUILT_SOURCES ="
   echo "SUFFIXES ="
   echo "MOSTLYCLEANFILES ="
+  echo "MOSTLYCLEANDIRS ="
   echo "CLEANFILES ="
   echo "DISTCLEANFILES ="
   echo "MAINTAINERCLEANFILES ="
@@ -848,6 +858,14 @@ func_emit_tests_Makefile_am ()
   echo "clean-local:"
   echo "       rm -rf SunWS_cache"
   echo
+  echo "mostlyclean-local:"
+  echo "       @test -z \"\$(MOSTLYCLEANDIRS)\" || \\"
+  echo "         for dir in \$(MOSTLYCLEANDIRS); do \\"
+  echo "           if test -d \$\$dir; then \\"
+  echo "             echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
+  echo "           fi; \\"
+  echo "         done"
+  echo
   echo "# Makefile.am ends here"
 }
 
@@ -1248,14 +1266,7 @@ func_import ()
   # Create m4/gnulib-cache.m4.
   func_dest_tmpfilename $m4base/gnulib-cache.m4
   (
-    echo "# Copyright (C) 2004 Free Software Foundation, Inc."
-    echo "# This file is free software, distributed under the terms of the GNU"
-    echo "# General Public License.  As a special exception to the GNU General"
-    echo "# Public License, this file may be distributed as part of a program"
-    echo "# that contains a configuration script generated by Autoconf, under"
-    echo "# the same distribution terms as the rest of that program."
-    echo "#"
-    echo "# Generated by gnulib-tool."
+    func_emit_copyright_notice
     echo "#"
     echo "# This file represents the specification of how gnulib-tool is used."
     echo "# It acts as a cache: It is written and read by gnulib-tool."
@@ -1309,14 +1320,7 @@ func_import ()
   # Create m4/gnulib-comp.m4.
   func_dest_tmpfilename $m4base/gnulib-comp.m4
   (
-    echo "# Copyright (C) 2004 Free Software Foundation, Inc."
-    echo "# This file is free software, distributed under the terms of the GNU"
-    echo "# General Public License.  As a special exception to the GNU General"
-    echo "# Public License, this file may be distributed as part of a program"
-    echo "# that contains a configuration script generated by Autoconf, under"
-    echo "# the same distribution terms as the rest of that program."
-    echo "#"
-    echo "# Generated by gnulib-tool."
+    func_emit_copyright_notice
     echo "#"
     echo "# This file represents the compiled summary of the specification in"
     echo "# gnulib-cache.m4. It lists the computed macro invocations that need"