From 5a8fcef5eade610c6b105e25cd524a876ddf8a46 Mon Sep 17 00:00:00 2001 From: Rob Davies Date: Tue, 16 Jun 2026 17:12:40 +0100 Subject: [PATCH] Ensure PACKAGE_VERSION is set in the Makefile In git repositories, this is set by expanding $(shell git describe --always --dirty). As this is not in a normal Makefile rule, failure just results in an empty variable. To check that it really was set, add a check to ensure it's not empty in the rule that builds the version.h file. Signed-off-by: Rob Davies --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 72153f9f..c68669c1 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,13 @@ endif # version.h: force # echo '#define BCFTOOLS_VERSION "`git describe --always --dirty`"' > $@ version.h: - echo '#define BCFTOOLS_VERSION "$(PACKAGE_VERSION)"' > $@ + @if test 'x$(PACKAGE_VERSION)' != x ; then \ + echo "echo '#define BCFTOOLS_VERSION "'"$(PACKAGE_VERSION)"'"' > $@" ; \ + echo '#define BCFTOOLS_VERSION "$(PACKAGE_VERSION)"' > $@ ; \ + else \ + echo "Error: PACKAGE_VERSION is not defined." 1>&2 ; \ + false ; \ + fi print-version: @echo $(PACKAGE_VERSION)