{"thread":{"id":"55403","subject":"[PATCH] Makefile: add QUIET_GEN to \"tags\" and \"TAGS\" targets","startedAt":"2021-03-28T02:19:13Z","lastAt":"2021-03-31T21:22:36Z","messageCount":3,"participants":["Ævar Arnfjörð Bjarmason","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"420343","messageId":"patch-1.1-afd0c18ca86-20210328T021814Z-avarab@gmail.com","threadId":"55403","inReplyTo":null,"subject":"[PATCH] Makefile: add QUIET_GEN to \"tags\" and \"TAGS\" targets","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-28T02:18:34Z","receivedAt":"2021-03-28T02:19:13Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Don't show the very verbose $(FIND_SOURCE_FILES) command on every\n\"make TAGS\" invocation. Let's also use the \"cmd >x+ && mv x+ x\"\npattern here so we don't momentarily clobber the file.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 55c8035fa80..f317af1b602 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2690,12 +2690,15 @@ FIND_SOURCE_FILES = ( \\\n \t)\n \n $(ETAGS_TARGET): FORCE\n-\t$(RM) $(ETAGS_TARGET)\n-\t$(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)\n+\techo $(ALL_SOURCE_FILES)\n+\t$(QUIET_GEN)$(RM) \"$(ETAGS_TARGET)+\" && \\\n+\t$(FIND_SOURCE_FILES) | xargs etags -a -o \"$(ETAGS_TARGET)+\" && \\\n+\tmv \"$(ETAGS_TARGET)+\" \"$(ETAGS_TARGET)\"\n \n tags: FORCE\n-\t$(RM) tags\n-\t$(FIND_SOURCE_FILES) | xargs ctags -a\n+\t$(QUIET_GEN)$(RM) tags+ && \\\n+\t$(FIND_SOURCE_FILES) | xargs ctags -a -o tags+ && \\\n+\tmv tags+ tags\n \n cscope:\n \t$(RM) cscope*\n-- \n2.31.1.442.g6c06c9fe35c\n\n"},{"id":"420361","messageId":"xmqqpmzjom7n.fsf@gitster.g","threadId":"55403","inReplyTo":"patch-1.1-afd0c18ca86-20210328T021814Z-avarab@gmail.com","subject":"Re: [PATCH] Makefile: add QUIET_GEN to \"tags\" and \"TAGS\" targets","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-28T05:56:28Z","receivedAt":"2021-03-28T06:17:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Don't show the very verbose $(FIND_SOURCE_FILES) command on every\n> \"make TAGS\" invocation. Let's also use the \"cmd >x+ && mv x+ x\"\n> pattern here so we don't momentarily clobber the file.\n\nWe do not \"redirect\" ctags and etags output into x+.  \n\n\tLet's use \"generate into temporary and rename to the final\n\tafter seeing the command that generated the output finished\n\tsuccessfully\" pattern.\n\nPlease also correct the explanation of why it is a good idea to use\nthe pattern in this case.  It is not about avoiding momentarily\nclobbering the output.  It is to avoid leaving an incorrect output\ngenerated by a failed command in the file with the filename that\nconsumers expect.\n\nThanks for making our Makefile a bit less noisy.  Anybody who makes\n\"clean\" and its friends quiet will get a gold star ;-)\n\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  Makefile | 11 +++++++----\n>  1 file changed, 7 insertions(+), 4 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 55c8035fa80..f317af1b602 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -2690,12 +2690,15 @@ FIND_SOURCE_FILES = ( \\\n>  \t)\n>  \n>  $(ETAGS_TARGET): FORCE\n> -\t$(RM) $(ETAGS_TARGET)\n> -\t$(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)\n> +\techo $(ALL_SOURCE_FILES)\n> +\t$(QUIET_GEN)$(RM) \"$(ETAGS_TARGET)+\" && \\\n> +\t$(FIND_SOURCE_FILES) | xargs etags -a -o \"$(ETAGS_TARGET)+\" && \\\n> +\tmv \"$(ETAGS_TARGET)+\" \"$(ETAGS_TARGET)\"\n>  \n>  tags: FORCE\n> -\t$(RM) tags\n> -\t$(FIND_SOURCE_FILES) | xargs ctags -a\n> +\t$(QUIET_GEN)$(RM) tags+ && \\\n> +\t$(FIND_SOURCE_FILES) | xargs ctags -a -o tags+ && \\\n> +\tmv tags+ tags\n>  \n>  cscope:\n>  \t$(RM) cscope*\n"},{"id":"420749","messageId":"xmqq5z176mwd.fsf@gitster.g","threadId":"55403","inReplyTo":"xmqqpmzjom7n.fsf@gitster.g","subject":"Re: [PATCH] Makefile: add QUIET_GEN to \"tags\" and \"TAGS\" targets","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-31T21:20:18Z","receivedAt":"2021-03-31T21:22:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> Don't show the very verbose $(FIND_SOURCE_FILES) command on every\n>> \"make TAGS\" invocation. Let's also use the \"cmd >x+ && mv x+ x\"\n>> pattern here so we don't momentarily clobber the file.\n>\n> We do not \"redirect\" ctags and etags output into x+.  \n>\n> \tLet's use \"generate into temporary and rename to the final\n> \tafter seeing the command that generated the output finished\n> \tsuccessfully\" pattern.\n>\n> Please also correct the explanation of why it is a good idea to use\n> the pattern in this case.  It is not about avoiding momentarily\n> clobbering the output.  It is to avoid leaving an incorrect output\n> generated by a failed command in the file with the filename that\n> consumers expect.\n>\n> Thanks for making our Makefile a bit less noisy.  Anybody who makes\n> \"clean\" and its friends quiet will get a gold star ;-)\n>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> ---\n>>  Makefile | 11 +++++++----\n>>  1 file changed, 7 insertions(+), 4 deletions(-)\n>>\n>> diff --git a/Makefile b/Makefile\n>> index 55c8035fa80..f317af1b602 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -2690,12 +2690,15 @@ FIND_SOURCE_FILES = ( \\\n>>  \t)\n>>  \n>>  $(ETAGS_TARGET): FORCE\n>> -\t$(RM) $(ETAGS_TARGET)\n>> -\t$(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)\n>> +\techo $(ALL_SOURCE_FILES)\n\nThis echo I presume is a debugging aid to be removed?\n\n>> +\t$(QUIET_GEN)$(RM) \"$(ETAGS_TARGET)+\" && \\\n>> +\t$(FIND_SOURCE_FILES) | xargs etags -a -o \"$(ETAGS_TARGET)+\" && \\\n>> +\tmv \"$(ETAGS_TARGET)+\" \"$(ETAGS_TARGET)\"\n>>  \n>>  tags: FORCE\n>> -\t$(RM) tags\n>> -\t$(FIND_SOURCE_FILES) | xargs ctags -a\n>> +\t$(QUIET_GEN)$(RM) tags+ && \\\n>> +\t$(FIND_SOURCE_FILES) | xargs ctags -a -o tags+ && \\\n>> +\tmv tags+ tags\n>>  \n>>  cscope:\n>>  \t$(RM) cscope*\n"}]}