Improve dependencies for include/nuttx/version.h

`include/nuttx/version.h` is dependent on `.version`, which needs to run for every invocation of make, since git info can update at any time.
Currently the `.version` target is PHONY, thus making `include/nuttx/version.h` and `context` targets (and every target that depends on `context`) have to run every time.

This PR modifies `.version` so it's a real rule. Additionally, `tools/version.sh` is run every invocation of make. This maintains the current behavior while preventing some targets from needlessly running every time
This commit is contained in:
Alan Rosenthal 2021-12-28 21:01:34 -05:00 committed by Abdelatif Guettouche
parent 828f04f0e5
commit 0951f70df6
1 changed files with 6 additions and 5 deletions

View File

@ -42,10 +42,12 @@ CONFIG_VERSION_BUILD ?= "0"
VERSION_ARG = -v $(CONFIG_VERSION_STRING) -b $(CONFIG_VERSION_BUILD)
else
# Generate .version every time from GIT history
.PHONY: $(TOPDIR)/.version
# Generate .version.tmp every time from GIT history
# Only update .version if the contents of version.tmp actually changes
# Note: this is executed before any rule is run
$(shell tools/version.sh .version.tmp)
$(shell $(call TESTANDREPLACEFILE, .version.tmp, .version))
endif
# Process architecture specific directories
@ -225,8 +227,7 @@ $(TOPDIR)/.version:
include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion$(HOSTEXEEXT)
$(Q) echo "Create version.h"
$(Q) tools/mkversion $(TOPDIR) > $@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
$(Q) tools/mkversion $(TOPDIR) > $@
# Targets used to build include/nuttx/config.h. Creation of config.h is
# part of the overall NuttX configuration sequence. Notice that the