summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLibravatar Ramsay Jones <ramsay@ramsayjones.plus.com>2020-12-07 00:39:30 +0000
committerLibravatar Pratyush Yadav <me@yadavpratyush.com>2020-12-18 00:34:15 +0530
commit5bc8b5d5c11bc01eac84e98657d9cfc0541ae6a3 (patch)
tree361a52fd2f5e76610e650aeb981d3e8e84fa7b1d /Makefile
parentMerge branch 'sh/macos-labels' (diff)
downloadtgif-5bc8b5d5c11bc01eac84e98657d9cfc0541ae6a3.tar.xz
Makefile: conditionally include GIT-VERSION-FILE
The 'clean' target is noticeably slow on cygwin, even for a 'do-nothing' invocation of 'make clean'. For example, the second 'make clean' given below: $ make clean >/dev/null 2>&1 $ make clean GITGUI_VERSION = 0.21.0.85.g3e5c rm -rf git-gui lib/tclIndex po/*.msg rm -rf GIT-VERSION-FILE GIT-GUI-VARS $ has been timed at 1.934s on my laptop (an old core i5-4200M @ 2.50GHz, 8GB RAM, 1TB HDD). Notice that the Makefile, as part of processing the 'clean' target, is updating the 'GIT-VERSION-FILE' file. This is to ensure that the $(GITGUI_VERSION) make variable is set, once that file had been included. However, the 'clean' target does not use the $(GITGUI_VERSION) variable, so this is wasted effort. In order to eliminate such wasted effort, use the value of the internal $(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the target is not 'clean'. (This drops the time down to 0.676s, on my laptop, giving an improvement of 65.05%). Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile2
1 files changed, 2 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index f10caedaa7..56c85a85c1 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,9 @@ all::
GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
+ifneq ($(MAKECMDGOALS),clean)
-include GIT-VERSION-FILE
+endif
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')