From 965e1316a303639461a3f087d6e0eb4de433015f Mon Sep 17 00:00:00 2001 From: Chris Guida Date: Thu, 24 Oct 2024 17:08:14 -0600 Subject: [PATCH] build: Fix building clboss as a git submodule --- Makefile.am | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7f31dff66..e1ea718ee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -679,8 +679,10 @@ create-tarball: create-tarball.in Makefile BUILT_SOURCES = commit_hash.h commit_hash.h: FORCE - @if test -e $(srcdir)/.git/logs/HEAD; then \ - if [ ! -f $(srcdir)/commit_hash.h ] || [ $(srcdir)/.git/logs/HEAD -nt $(srcdir)/commit_hash.h ]; then \ + @if git -C $(srcdir) rev-parse --is-inside-work-tree > /dev/null 2>&1; then \ + CURRENT_HASH="$$(git -C $(srcdir) rev-parse HEAD)"; \ + if [ ! -f $(srcdir)/commit_hash.h ] || \ + [ "$$(grep -oE '[0-9a-f]{40}' $(srcdir)/commit_hash.h)" != "$$CURRENT_HASH" ]; then \ echo "Regenerating $(srcdir)/commit_hash.h..."; \ $(SHELL) $(srcdir)/generate_commit_hash.sh; \ else \