From 849255a3c5cb476700c8ab0ed6d8df0f46d6cedc Mon Sep 17 00:00:00 2001 From: Rob Davies Date: Tue, 16 Jun 2026 16:37:06 +0100 Subject: [PATCH] Ensure PACKAGE_VERSION is set in the Makefile This variable is set by expanding $(shell version.sh). As this is not in a normal Makefile rule, failing to run version.sh 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 8125d3aaa..3b328a9b4 100644 --- a/Makefile +++ b/Makefile @@ -167,7 +167,13 @@ MACH_O_CURRENT_VERSION = 3.1.23 version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force)) version.h: - echo '#define HTS_VERSION_TEXT "$(PACKAGE_VERSION)"' > $@ + @if test 'x$(PACKAGE_VERSION)' != x ; then \ + echo "echo '#define HTS_VERSION_TEXT "'"$(PACKAGE_VERSION)"'"' > $@" ; \ + echo '#define HTS_VERSION_TEXT "$(PACKAGE_VERSION)"' > $@ ; \ + else \ + echo "Error: PACKAGE_VERSION is not defined. Check version.sh works." 1>&2 ; \ + false ; \ + fi print-version: @echo $(PACKAGE_VERSION)