Always run mkgitver prior to a build

Some hosts were not running `mkgitver` when they should, so tweak the
script to only update the timestamp when the file's data changes and
then always run the script when performing a build.
This commit is contained in:
Wayne Davison
2021-10-01 14:13:00 -07:00
parent 16c8b05f11
commit bff084c10a
2 changed files with 15 additions and 9 deletions

View File

@@ -131,12 +131,12 @@ rounding.h: rounding.c rsync.h proto.h
fi
@rm -f rounding.out
# While $(wildcard ...) is a GNU make idiom, at least other makes should just turn it into an
# empty string (we need something that will vanish if we're not building a git checkout).
# If you want an updated git version w/o GNU make, remove git-version.h after a pull.
git-version.h: mkgitver $(wildcard $(srcdir)/.git/logs/HEAD)
git-version.h: ALWAYS_RUN
$(srcdir)/mkgitver
.PHONY: ALWAYS_RUN
ALWAYS_RUN:
simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
@$(srcdir)/cmd-or-msg disable-simd $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp

View File

@@ -3,12 +3,18 @@
srcdir=`dirname $0`
gitver=`git describe --abbrev=8 2>/dev/null`
if [ ! -f git-version.h ]; then
touch git-version.h
fi
case "$gitver" in
*.*)
echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h
;;
*)
# We either create an empty file or update the time on what the user gave us.
touch git-version.h
echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h.new
if ! diff git-version.h.new git-version.h >/dev/null; then
echo "Updating git-version.h"
mv git-version.h.new git-version.h
else
rm git-version.h.new
fi
;;
esac