From a8d8f93843c6e0dabbb86639a94dc19d31908e23 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Tue, 26 Mar 2002 21:27:05 +0000 Subject: [PATCH] * move-if-changed: New script. * post.in (depend-postrecurse): Use it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14289 dc483132-0cff-0310-8789-dd5450dbe970 --- src/config/ChangeLog | 5 +++++ src/config/move-if-changed | 17 +++++++++++++++++ src/config/post.in | 3 +-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/config/move-if-changed diff --git a/src/config/ChangeLog b/src/config/ChangeLog index 1cd7396d9..c65d72bc1 100644 --- a/src/config/ChangeLog +++ b/src/config/ChangeLog @@ -1,3 +1,8 @@ +2002-03-26 Ken Raeburn + + * move-if-changed: New script. + * post.in (depend-postrecurse): Use it. + 2002-01-08 Ken Raeburn * shlib.conf: For Linux, always add "-lc" at the end of the link diff --git a/src/config/move-if-changed b/src/config/move-if-changed new file mode 100644 index 000000000..21403e129 --- /dev/null +++ b/src/config/move-if-changed @@ -0,0 +1,17 @@ +#!/bin/sh +# Move file 1 to file 2 if they don't already match. +# Good for "make depend" for example, where it'd be nice to keep the +# old datestamp. +if [ $# != 2 ]; then + echo 2>&1 usage: $0 newfile oldfilename + exit 1 +fi +# +if [ ! -r "$2" ]; then + exec mv -f "$1" "$2" +fi +if cmp "$1" "$2" >/dev/null; then + echo "$2 is unchanged" + exec rm -f "$1" +fi +exec mv -f "$1" "$2" diff --git a/src/config/post.in b/src/config/post.in index 35ae07c34..3ca6f0c11 100644 --- a/src/config/post.in +++ b/src/config/post.in @@ -41,8 +41,7 @@ depend-postrecurse:: .depend sed -e '/^# +++ Dependency line eater +++/,$$d' \ < $(srcdir)/Makefile.in | cat - .depend \ > $(srcdir)/Makefile.in.new; \ - $(MV) $(srcdir)/Makefile.in $(srcdir)/Makefile.in.old; \ - $(MV) $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in; \ + $(SRCTOP)/config/move-if-changed $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in ; \ else :; fi depend:: depend-prerecurse depend-recurse depend-postrecurse -- 2.26.2