[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] gnulib-tool plays nice with make
From: |
Derek Price |
Subject: |
[bug-gnulib] gnulib-tool plays nice with make |
Date: |
Wed, 02 Mar 2005 12:37:51 -0500 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
I've updated gnulib-tool --import to copy files iff they have changed so
that when no files have changed, then the second make in the sequence:
make
../gnulib/gnulib-tool --import MODULELIST
make
will do nothing when no files change. Patch attached.
2005-03-02 Derek Price <address@hidden>
* gnulib-tool: Avoid munging timestamps unnecessarily to play
nice with make.
Regards,
Derek
Index: gnulib-tool
===================================================================
RCS file: /cvsroot/gnulib/gnulib/gnulib-tool,v
retrieving revision 1.38
diff -u -p -r1.38 gnulib-tool
--- gnulib-tool 5 Jan 2005 02:50:04 -0000 1.38
+++ gnulib-tool 2 Mar 2005 17:32:11 -0000
@@ -515,6 +515,7 @@ func_import ()
|| func_fatal_error "refusing to do nothing"
# Copy files.
+ test -n "$dry_run" && dry=echo
for f in $files; do
source=
case "$f" in
@@ -523,8 +524,10 @@ func_import ()
m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
*) g="$f" ;;
esac
- test -n "$dry_run" && dry=echo
- $dry cp -p "$gnulib_dir/$f" "$destdir/$g"
+ # Avoid munging timestamps if the file hasn't changed.
+ if cmp "$gnulib_dir/$f" "$destdir/$g" >/dev/null 2>&1; then :; else
+ $dry cp -p "$gnulib_dir/$f" "$destdir/$g"
+ fi
# Update license.
if test -z "$dry_run" && test -n "$lgpl" && test -n "$source"; then
perl -pi -e 's/GNU General/GNU Lesser General/g;' \
@@ -546,18 +549,26 @@ func_import ()
actioncmd="gnulib-tool --import --dir=$destdir --lib=$libname
--source-base=$sourcebase --m4-base=$m4base $opt_libtool $opt_lgpl `echo
$modules`"
# Create lib/Makefile.am.
- echo "Creating $destdir/$sourcebase/Makefile.am..."
+ echo "Creating $destdir/$sourcebase/Makefile.am.new..."
if test -z "$dry_run"; then
- func_emit_lib_Makefile_am > $destdir/$sourcebase/Makefile.am
+ func_emit_lib_Makefile_am > $destdir/$sourcebase/Makefile.am.new
else
func_emit_lib_Makefile_am
fi
+ # Avoid munging timestamps if the file hasn't changed.
+ if cmp $destdir/$sourcebase/Makefile.am.new \
+ $destdir/$sourcebase/Makefile.am >/dev/null 2>&1; then
+ $dry rm $destdir/$sourcebase/Makefile.am.new
+ else
+ $dry mv $destdir/$sourcebase/Makefile.am.new \
+ $destdir/$sourcebase/Makefile.am
+ fi
# Create gnulib.m4.
- echo "Creating $destdir/$m4base/gnulib.m4..."
+ echo "Creating $destdir/$m4base/gnulib.m4.new..."
(
if test -z "$dry_run"; then
- exec > $destdir/$m4base/gnulib.m4
+ exec > $destdir/$m4base/gnulib.m4.new
else
echo "# $destdir/$m4base/gnulib.m4"
fi
@@ -616,6 +627,13 @@ func_import ()
echo
echo "# gnulib.m4 ends here"
)
+ # Avoid munging timestamps if the file hasn't changed.
+ if cmp $destdir/$m4base/gnulib.m4.new \
+ $destdir/$m4base/gnulib.m4 >/dev/null 2>&1; then
+ $dry rm $destdir/$m4base/gnulib.m4.new
+ else
+ $dry mv $destdir/$m4base/gnulib.m4.new $destdir/$m4base/gnulib.m4
+ fi
echo "Finished."
echo
echo "You may need to add #include directives for the following .h files."
signature.asc
Description: OpenPGP digital signature
- [bug-gnulib] gnulib-tool plays nice with make,
Derek Price <=