Skip to content

Commit bff084c

Browse files
committed
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.
1 parent 16c8b05 commit bff084c

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Makefile.in

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ rounding.h: rounding.c rsync.h proto.h
131131
fi
132132
@rm -f rounding.out
133133

134-
# While $(wildcard ...) is a GNU make idiom, at least other makes should just turn it into an
135-
# empty string (we need something that will vanish if we're not building a git checkout).
136-
# If you want an updated git version w/o GNU make, remove git-version.h after a pull.
137-
git-version.h: mkgitver $(wildcard $(srcdir)/.git/logs/HEAD)
134+
git-version.h: ALWAYS_RUN
138135
$(srcdir)/mkgitver
139136

137+
.PHONY: ALWAYS_RUN
138+
ALWAYS_RUN:
139+
140140
simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
141141
@$(srcdir)/cmd-or-msg disable-simd $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
142142

mkgitver

+11-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
srcdir=`dirname $0`
44
gitver=`git describe --abbrev=8 2>/dev/null`
55

6+
if [ ! -f git-version.h ]; then
7+
touch git-version.h
8+
fi
9+
610
case "$gitver" in
711
*.*)
8-
echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h
9-
;;
10-
*)
11-
# We either create an empty file or update the time on what the user gave us.
12-
touch git-version.h
12+
echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h.new
13+
if ! diff git-version.h.new git-version.h >/dev/null; then
14+
echo "Updating git-version.h"
15+
mv git-version.h.new git-version.h
16+
else
17+
rm git-version.h.new
18+
fi
1319
;;
1420
esac

0 commit comments

Comments
 (0)