Skip to contentSkip to conversation

Fix TAGS creation

PATCH Applied David Gibson 3 participants 3 messages Mar 7, 2013 – Mar 19, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix TAGS creation

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.

---
 Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index 2262410..bb576da 100644
@@ -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.*
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 17 lines · David Gibson

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.

---
 Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +0 -0
index 2262410..bb576da 100644

Makefile test speed: all · line 338

Quoted 9 lines
Makefile +2 -1
@@ -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 {} +