{"thread":{"id":"54587","subject":"[PATCH 8/8] Makefile: conditionally include GIT-VERSION-FILE","startedAt":"2020-11-05T21:10:55Z","lastAt":"2020-11-05T21:10:55Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"409229","messageId":"75576fd6-29d7-9700-22a0-bcb30b6ba6bb@ramsayjones.plus.com","threadId":"54587","inReplyTo":null,"subject":"[PATCH 8/8] Makefile: conditionally include GIT-VERSION-FILE","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2020-11-05T21:10:51Z","receivedAt":"2020-11-05T21:10:55Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe 'clean' target is still noticeably slow on cygwin, despite the\nimprovements made by previous patches. For example, the second\ninvocation of 'make clean' below:\n\n  $ make clean >/dev/null 2>&1\n  $ make clean\n  GIT_VERSION = 2.29.0.7.g273f7f9394\n  ...\n  $\n\nhas been timed at 6.430s on my laptop (on old core i5-4200M @ 2.50GHz,\n8GB RAM, 1TB HDD).\n\nNotice that the 'clean' target is still causing the $(GIT_VERSION) make\nvariable to be set (executing the GIT-VERSION-GEN script in the\nprocess). However, the last few commits have removed all dependency on\nthe $(GIT_VERSION) variable from the 'clean' target. The calculation of\nthe git version, in order to set this variable, is thus wasted effort.\n\nIn order to eliminate such wasted effort, use the value of the internal\n$(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the\ntarget is not 'clean'. (This drops the time down to 4.064s, on my laptop,\ngiving an improvement of 36.80%).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n Makefile | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex bc9ce28bc3..ca65259e10 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -502,7 +502,9 @@ all::\n \n GIT-VERSION-FILE: FORCE\n \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n+ifneq ($(MAKECMDGOALS),clean)\n -include GIT-VERSION-FILE\n+endif\n \n # Set our default configuration.\n #\n-- \n2.29.0\n"}]}