{"thread":{"id":"54583","subject":"[PATCH 4/8] git-gui/Makefile: conditionally include GIT-VERSION-FILE","startedAt":"2020-11-05T21:06:27Z","lastAt":"2020-11-05T21:06:27Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"409225","messageId":"f4e1a949-f543-7d2e-6cf3-d09a42d9c9f4@ramsayjones.plus.com","threadId":"54583","inReplyTo":null,"subject":"[PATCH 4/8] git-gui/Makefile: conditionally include GIT-VERSION-FILE","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2020-11-05T21:06:22Z","receivedAt":"2020-11-05T21:06:27Z","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 -C git-gui clean\n  make[1]: Entering directory '/home/ramsay/git/git-gui'\n  GITGUI_VERSION = 0.21.0.78.g38c2a\n  rm -rf git-gui lib/tclIndex po/*.msg\n  ...\n  $\n\nhas been timed at 8.430s on my laptop (on old core i5-4200M @ 2.50GHz,\n8GB RAM, 1TB HDD).\n\nNotice that the Makefile, as part of processing the 'clean' target, is\nupdating the 'git-gui/GIT-VERSION-FILE' (not to be confused with the\nsimilarly named file at the root directory of the repository). This is\nto ensure that the $(GITGUI_VERSION) make variable is set, once that file\nhad been included. (The Makefile target uses the 'git-gui/GIT-VERSION-GEN'\nscript to generate that file, which should also not be confused with the\nsimilarly named script at the root). However, the 'clean' target does not\nuse the $(GITGUI_VERSION) variable, 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 6.454s, on my laptop,\ngiving an improvement of 23.44%).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n git-gui/Makefile | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/git-gui/Makefile b/git-gui/Makefile\nindex f10caedaa7..56c85a85c1 100644\n--- a/git-gui/Makefile\n+++ b/git-gui/Makefile\n@@ -9,7 +9,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 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')\n-- \n2.29.0\n"}]}