Skip to content

Commit 5bc8b5d

Browse files
ramsay-jonesprati0100
authored andcommitted
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 <[email protected]> Signed-off-by: Pratyush Yadav <[email protected]>
1 parent 7d6d21f commit 5bc8b5d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ all::
99

1010
GIT-VERSION-FILE: FORCE
1111
@$(SHELL_PATH) ./GIT-VERSION-GEN
12+
ifneq ($(MAKECMDGOALS),clean)
1213
-include GIT-VERSION-FILE
14+
endif
1315

1416
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
1517
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')

0 commit comments

Comments
 (0)