Makefile: don't use "FORCE" for tags targets
Remove the "FORCE" dependency from the "tags", "TAGS" and "cscope" targets, instead make them depend on whether or not the relevant source files have changed. For the cscope target we need to change it to depend on the actual generated file while we generate while we're at it, as the next commit will discuss we always generate a cscope.out file. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Jul 22, 2021 at 01:23 UTC
7171221d82249cb8ce4b73a40852a487d1cebde7
1 file changed
+12
-8
Makefile
+12
-8
@@ -2727,20 +2727,24 @@ FIND_SOURCE_FILES = ( \
2727
| sed -e 's|^\./||' \
2728
)
2729
2730
-$(ETAGS_TARGET): FORCE
2730
+FOUND_SOURCE_FILES = $(shell $(FIND_SOURCE_FILES))
2731
+
2732
+$(ETAGS_TARGET): $(FOUND_SOURCE_FILES)
2733
$(QUIET_GEN)$(RM) "$(ETAGS_TARGET)+" && \
2732
- $(FIND_SOURCE_FILES) | xargs etags -a -o "$(ETAGS_TARGET)+" && \
2734
+ echo $(FOUND_SOURCE_FILES) | xargs etags -a -o "$(ETAGS_TARGET)+" && \
2735
mv "$(ETAGS_TARGET)+" "$(ETAGS_TARGET)"
2736
2735
-tags: FORCE
2737
+tags: $(FOUND_SOURCE_FILES)
2738
$(QUIET_GEN)$(RM) tags+ && \
2737
- $(FIND_SOURCE_FILES) | xargs ctags -a -o tags+ && \
2739
+ echo $(FOUND_SOURCE_FILES) | xargs ctags -a -o tags+ && \
2740
mv tags+ tags
2741
2740
-.PHONY: cscope
2741
-cscope:
2742
+cscope.out: $(FOUND_SOURCE_FILES)
2743
$(QUIET_GEN)$(RM) cscope* && \
2743
- $(FIND_SOURCE_FILES) | xargs cscope -b
2744
+ echo $(FOUND_SOURCE_FILES) | xargs cscope -b
2745
+
2746
+.PHONY: cscope
2747
+cscope: cscope.out
2748
2749
### Detect prefix changes
2750
TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
@@ -2921,7 +2925,7 @@ check: config-list.h command-list.h
2925
exit 1; \
2926
fi
2927
2924
-FOUND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
2928
+FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
2929
COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
2930
2931
%.cocci.patch: %.cocci $(COCCI_SOURCES)