From bff084c10a90a77cf21cccd89e58b5efd5ed8d43 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 1 Oct 2021 14:13:00 -0700 Subject: [PATCH] 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. --- Makefile.in | 8 ++++---- mkgitver | 16 +++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0b5973b1..c4c00e96 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/mkgitver b/mkgitver index 8e76774c..49aa150b 100755 --- a/mkgitver +++ b/mkgitver @@ -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 -- 2.47.2