[PATCH 3/3] Makefile: don't use "FORCE" for tags targets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove the "FORCE" dependency from the "tags", "TAGS" and "cscope.out"
targets, instead make them depend on whether or not the relevant
source files have changed.

I'm also removing the "-o" option from them, that seems to have been
cargo-culted when they were initially added in f81e7c626f3 (Makefile:
Add TAGS and tags targets, 2006-03-18). It would make sense to use
that option if we had been appending to tag files, it doesn't make any
sense that it was used after we'd just removed the files file being
appended to.

This will potentially cause a partial file to be left behind if the
command dies, but my in-flight series to use the ".DELETE_ON_ERROR"
flag in the Makefile[1] will make that problem go away. I think even
without that it's not problem we need to worry about in these cases.

1. https://lore.kernel.org/git/patch-1.1-9420448e74f-20210622T141100Z-avarab@xxxxxxxxx/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 Makefile | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 25d2a3e5ddc..89d261230fb 100644
--- a/Makefile
+++ b/Makefile
@@ -2727,18 +2727,19 @@ FIND_SOURCE_FILES = ( \
 		| sed -e 's|^\./||' \
 	)
 
-$(ETAGS_TARGET): FORCE
-	$(QUIET_GEN)$(RM) "$(ETAGS_TARGET)+" && \
-	$(FIND_SOURCE_FILES) | xargs etags -a -o "$(ETAGS_TARGET)+" && \
-	mv "$(ETAGS_TARGET)+" "$(ETAGS_TARGET)"
+FOUND_SOURCE_FILES = $(shell $(FIND_SOURCE_FILES))
 
-tags: FORCE
-	$(QUIET_GEN)$(RM) tags+ && \
-	$(FIND_SOURCE_FILES) | xargs ctags -a -o tags+ && \
-	mv tags+ tags
+$(ETAGS_TARGET): $(FOUND_SOURCE_FILES)
+	$(QUIET_GEN)echo $(FOUND_SOURCE_FILES) | \
+	xargs etags -o $@
+
+tags: $(FOUND_SOURCE_FILES)
+	$(QUIET_GEN)echo $(FOUND_SOURCE_FILES) | \
+	xargs ctags -o $@
 
 cscope.out:
-	$(FIND_SOURCE_FILES) | xargs cscope -f$@ -b
+	$(QUIET_GEN)echo $(FOUND_SOURCE_FILES) | \
+	xargs cscope -f$@ -b
 
 .PHONY: cscope
 cscope: cscope.out
@@ -2922,7 +2923,7 @@ check: config-list.h command-list.h
 		exit 1; \
 	fi
 
-FOUND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
+FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
 COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
 
 %.cocci.patch: %.cocci $(COCCI_SOURCES)
-- 
2.32.0.599.g3967b4fa4ac




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux