Patchwork Fix TAGS creation

login
register
mail settings
Submitter David Gibson
Date March 7, 2013, 2:48 a.m.
Message ID <1362624481-31087-1-git-send-email-david@gibson.dropbear.id.au>
Download mbox | patch
Permalink /patch/225708/
State New
Headers show

Comments

David Gibson - March 7, 2013, 2:48 a.m.
Currently the Makefile creates TAGS for emacs with the command:
    find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
That works only if xargs ends up invoking etags just once.  If xargs runs
etags several times, as it will if there are enough files, then the later
invocations will overwrite the output from the earlier invocations.  This
patch uses the etags --append option to fix the bug.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Markus Armbruster - March 7, 2013, 7:29 a.m.
David Gibson <david@gibson.dropbear.id.au> writes:

> Currently the Makefile creates TAGS for emacs with the command:
>     find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
> That works only if xargs ends up invoking etags just once.  If xargs runs
> etags several times, as it will if there are enough files, then the later
> invocations will overwrite the output from the earlier invocations.  This
> patch uses the etags --append option to fix the bug.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  Makefile |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 2262410..bb576da 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -331,7 +331,8 @@ test speed: all
>  
>  .PHONY: TAGS
>  TAGS:
> -	find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
> +	rm -f $@
> +	find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags --append
>  
>  cscope:
>  	rm -f ./cscope.*

Slightly more portable:

    find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
Anthony Liguori - March 19, 2013, 1:38 a.m.
Applied.  Thanks.

Regards,

Anthony Liguori

Patch

diff --git a/Makefile b/Makefile
index 2262410..bb576da 100644
--- a/Makefile
+++ b/Makefile
@@ -331,7 +331,8 @@  test speed: all
 
 .PHONY: TAGS
 TAGS:
-	find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
+	rm -f $@
+	find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags --append
 
 cscope:
 	rm -f ./cscope.*