{"thread":{"id":"54781","subject":"[PATCH v2 3/5] gitweb/Makefile: conditionally include ../GIT-VERSION-FILE","startedAt":"2020-12-07T00:35:18Z","lastAt":"2020-12-07T03:27:02Z","messageCount":2,"participants":["Ramsay Jones","Felipe Contreras"],"isPatch":true,"patchVersion":2,"patchTotal":5},"messages":[{"id":"411575","messageId":"f96f5cf3-713f-5c89-d486-e1a3f1c97b07@ramsayjones.plus.com","threadId":"54781","inReplyTo":null,"subject":"[PATCH v2 3/5] gitweb/Makefile: conditionally include ../GIT-VERSION-FILE","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2020-12-07T00:34:29Z","receivedAt":"2020-12-07T00:35:18Z","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 (on 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, so this 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"},{"id":"411583","messageId":"CAMP44s1TQ3vmn2LT40jXA_3503hLWvadc3oDsatrOZ9weO_t3w@mail.gmail.com","threadId":"54781","inReplyTo":"f96f5cf3-713f-5c89-d486-e1a3f1c97b07@ramsayjones.plus.com","subject":"Re: [PATCH v2 3/5] gitweb/Makefile: conditionally include ../GIT-VERSION-FILE","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2020-12-07T03:26:09Z","receivedAt":"2020-12-07T03:27:02Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sun, Dec 6, 2020 at 6:37 PM Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:\n\n> Notice that the 'clean' target is making a nested call to the parent\n> Makefile to ensure that the GIT-VERSION-FILE is up-to-date. This is to\n> ensure that the $(GIT_VERSION) make variable is set, once that file had\n> been included. However, the 'clean' target does not use the $(GIT_VERSION)\n> variable, so this is wasted effort.\n\nSame goes here.\n\n-- \nFelipe Contreras\n"}]}