{"thread":{"id":"54795","subject":"[PATCH v3 1/5] Documentation/Makefile: conditionally include doc.dep","startedAt":"2020-12-08T22:32:32Z","lastAt":"2020-12-08T22:32:32Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":3,"patchTotal":5},"messages":[{"id":"411789","messageId":"88d87207-0668-2119-e63a-49384897c789@ramsayjones.plus.com","threadId":"54795","inReplyTo":null,"subject":"[PATCH v3 1/5] Documentation/Makefile: conditionally include doc.dep","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2020-12-08T22:31:44Z","receivedAt":"2020-12-08T22:32:32Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'\ninvocation of 'make clean'. For example, the second 'make clean' below:\n\n  $ make clean >/dev/null 2>&1\n  $ make clean\n  GIT_VERSION = 2.29.0\n  ...\n  make[1]: Entering directory '/home/ramsay/git/Documentation'\n      GEN mergetools-list.made\n      GEN cmd-list.made\n      GEN doc.dep\n  ...\n  $\n\nhas been timed at 23.339s, using git v2.29.0, on my laptop (an old core\ni5-4200M @ 2.50GHz, 8GB RAM, 1TB HDD).\n\nNotice that, since the 'doc.dep' file does not exist, make takes the\ntime (about 8s) to generate several files in order to create the doc.dep\ninclude file. (If an 'include' file is missing, but a target for the\nsaid file is present in the Makefile, make will execute that target\nand, if that file now exists, throw away all its internal data and\nre-read and re-parse the Makefile). Having spent the time to include\nthe 'doc.dep' file, the 'clean' target immediately deletes those files.\nThe document dependencies specified in the 'doc.dep' include file,\nexpressed as make targets and prerequisites, do not affect what the\n'clean' target removes. Therefore, the time spent in generating the\ndependencies is completely wasted effort.\n\nIn order to eliminate such wasted effort, use the value of the internal\n$(MAKECMDGOALS) variable to only '-include doc.dep' when the target is\nnot 'clean'. (This drops the time down to 12.364s, on my laptop, giving\nan improvement of 47.02%).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n Documentation/Makefile | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\nindex 80d1908a44..652d57a1b6 100644\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -286,7 +286,9 @@ doc.dep : $(docdep_prereqs) $(wildcard *.txt) $(wildcard config/*.txt) build-doc\n \t$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \\\n \tmv $@+ $@\n \n+ifneq ($(MAKECMDGOALS),clean)\n -include doc.dep\n+endif\n \n cmds_txt = cmds-ancillaryinterrogators.txt \\\n \tcmds-ancillarymanipulators.txt \\\n-- \n2.29.0\n"}]}