Ensure PACKAGE_VERSION is set in the Makefile#2038
Merged
Conversation
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 <rmd+git@sanger.ac.uk>
Member
|
Because PACKAGE_VERSION is constructed using GNU Make-specific functions, there's probably no downside to a GNU Make-specific check. E.g., how about something like PACKAGE_VERSION := $(shell $(srcdir)/version.sh)
+ifeq "$(PACKAGE_VERSION)" ""
+$(error PACKAGE_VERSION is not defined. Check version.sh works)
+endifWhich admittedly differs from your version in not letting you avoid the check by manually making version.h. Which is either a good or a bad thing. |
Member
Author
|
True, but I preferred a more traditional solution, although it did get a bit more complicated by hiding the if statement from the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This variable is set by expanding
$(shell version.sh). As this is not in a normal Makefile rule, failing to runversion.shjust 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 theversion.hfile.See also samtools/samtools#2337. Failing here is unlikely to result in broken files, but we should probably catch it anyway.