You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2022/01/04 16:49:48 UTC

[incubator-nuttx] branch master updated: Improve dependencies for include/nuttx/version.h

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0951f70  Improve dependencies for include/nuttx/version.h
0951f70 is described below

commit 0951f70df6473cbde0fa338586da51edc604fe8f
Author: Alan Rosenthal <al...@google.com>
AuthorDate: Tue Dec 28 21:01:34 2021 -0500

    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
---
 tools/Makefile.unix | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/Makefile.unix b/tools/Makefile.unix
index a2413a5..6729350 100644
--- a/tools/Makefile.unix
+++ b/tools/Makefile.unix
@@ -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