{"thread":{"id":"54796","subject":"[PATCH v3 2/5] Documentation/Makefile: conditionally include ../GIT-VERSION-FILE","startedAt":"2020-12-08T22:33:28Z","lastAt":"2020-12-08T22:33:28Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":3,"patchTotal":5},"messages":[{"id":"411790","messageId":"7ada81c3-bb8a-6d63-88a9-e24ba11f1138@ramsayjones.plus.com","threadId":"54796","inReplyTo":null,"subject":"[PATCH v3 2/5] Documentation/Makefile: conditionally include ../GIT-VERSION-FILE","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2020-12-08T22:33:05Z","receivedAt":"2020-12-08T22:33:28Z","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\nsubstantial improvement made by the previous patch. For example, the\nsecond invocation of 'make clean' below:\n\n  $ make clean >/dev/null 2>&1\n  $ make clean\n  ...\n  make[1]: Entering directory '/home/ramsay/git/Documentation'\n  make[2]: Entering directory '/home/ramsay/git'\n  make[2]: 'GIT-VERSION-FILE' is up to date.\n  make[2]: Leaving directory '/home/ramsay/git'\n  ...\n  $\n\nhas been timed at 12.364s on my laptop (an old core i5-4200M @ 2.50GHz,\n8GB RAM, 1TB HDD).\n\nNotice that the 'clean' target is making a nested call to the parent\nMakefile to ensure that the GIT-VERSION-FILE is up-to-date (prior to\nthe previous patch, there would have been _two_ such invocations).\nThis is to ensure that the $(GIT_VERSION) make variable is set, once\nthat file had been included.  However, the 'clean' target does not use\nthe $(GIT_VERSION) variable, directly or indirectly, so it does not\nhave any affect on what the target removes. Therefore, the time spent\non ensuring an up to date GIT-VERSION-FILE is 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 10.361s, on my laptop,\ngiving an improvement of 16.20%).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n Documentation/Makefile | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\nindex 652d57a1b6..5c680024eb 100644\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -272,7 +272,9 @@ install-html: html\n ../GIT-VERSION-FILE: FORCE\n \t$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE\n \n+ifneq ($(MAKECMDGOALS),clean)\n -include ../GIT-VERSION-FILE\n+endif\n \n #\n # Determine \"include::\" file references in asciidoc files.\n-- \n2.29.0\n"}]}