Skip to content

Commit f3e12f6

Browse files
daviesrobpd3
authored andcommitted
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 <rmd+git@sanger.ac.uk>
1 parent 15a4091 commit f3e12f6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,13 @@ endif
130130
# version.h: force
131131
# echo '#define BCFTOOLS_VERSION "`git describe --always --dirty`"' > $@
132132
version.h:
133-
echo '#define BCFTOOLS_VERSION "$(PACKAGE_VERSION)"' > $@
133+
@if test 'x$(PACKAGE_VERSION)' != x ; then \
134+
echo "echo '#define BCFTOOLS_VERSION "'"$(PACKAGE_VERSION)"'"' > $@" ; \
135+
echo '#define BCFTOOLS_VERSION "$(PACKAGE_VERSION)"' > $@ ; \
136+
else \
137+
echo "Error: PACKAGE_VERSION is not defined." 1>&2 ; \
138+
false ; \
139+
fi
134140

135141
print-version:
136142
@echo $(PACKAGE_VERSION)

0 commit comments

Comments
 (0)