{"thread":{"id":"54797","subject":"[PATCH v3 3/5] gitweb/Makefile: conditionally include ../GIT-VERSION-FILE","startedAt":"2020-12-08T22:35:17Z","lastAt":"2020-12-08T22:35:17Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":3,"patchTotal":5},"messages":[{"id":"411791","messageId":"8aa9a686-94f1-e29c-6581-2d8d53bd55e0@ramsayjones.plus.com","threadId":"54797","inReplyTo":null,"subject":"[PATCH v3 3/5] gitweb/Makefile: conditionally include ../GIT-VERSION-FILE","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2020-12-08T22:34:28Z","receivedAt":"2020-12-08T22:35:17Z","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  ...\n  make[1]: Entering directory '/home/ramsay/git/gitweb'\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 10.361s 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. This is to\nensure that the $(GIT_VERSION) make variable is set, once that file had\nbeen included. However, the 'clean' target does not use the $(GIT_VERSION)\nvariable, directly or indirectly, so it does not have any affect on what\nthe target removes. Therefore, the time spent on ensuring an up to date\nGIT-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 8.430s, on my laptop,\ngiving an improvement of 18.64%).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n gitweb/Makefile | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nindex cd194d057f..f13e23c4de 100644\n--- a/gitweb/Makefile\n+++ b/gitweb/Makefile\n@@ -48,7 +48,9 @@ HIGHLIGHT_BIN = highlight\n ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE\n \t$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE\n \n+ifneq ($(MAKECMDGOALS),clean)\n -include ../GIT-VERSION-FILE\n+endif\n \n ### Build rules\n \n-- \n2.29.0\n"}]}