From 35c3cbe0abf3b9e12567376ecb0948806bd8188a Mon Sep 17 00:00:00 2001 From: Ken Sedgwick Date: Thu, 15 Aug 2024 23:53:10 -0700 Subject: [PATCH] Improve commit_hash.h dependencies and generation The previous setup was not regenerating commit_hash.h correctly when the dev tree was modified by git operations. --- Makefile.am | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 750638325..865f7eac9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -673,9 +673,21 @@ create-tarball: create-tarball.in Makefile chmod +x create-tarball BUILT_SOURCES = commit_hash.h -CLEANFILES += commit_hash.h -commit_hash.h: - ./generate_commit_hash.sh +commit_hash.h: FORCE + @if test -e $(srcdir)/.git/logs/HEAD; then \ + if [ ! -f $@ ] || [ $(srcdir)/.git/logs/HEAD -nt $@ ]; then \ + echo "Regenerating commit_hash.h..."; \ + $(SHELL) $(srcdir)/generate_commit_hash.sh; \ + else \ + echo "commit_hash.h is up-to-date."; \ + fi \ + else \ + echo "Using existing commit_hash.h"; \ + fi + +FORCE: + +.PHONY: FORCE clboss libclboss.la: $(BUILT_SOURCES)