Skip to content

Commit 7171221

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 033395b commit 7171221

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,20 +2727,24 @@ FIND_SOURCE_FILES = ( \
27272727
| sed -e 's|^\./||' \
27282728
)
27292729

2730-
$(ETAGS_TARGET): FORCE
2730+
FOUND_SOURCE_FILES = $(shell $(FIND_SOURCE_FILES))
2731+
2732+
$(ETAGS_TARGET): $(FOUND_SOURCE_FILES)
27312733
$(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)+" && \
27332735
mv "$(ETAGS_TARGET)+" "$(ETAGS_TARGET)"
27342736

2735-
tags: FORCE
2737+
tags: $(FOUND_SOURCE_FILES)
27362738
$(QUIET_GEN)$(RM) tags+ && \
2737-
$(FIND_SOURCE_FILES) | xargs ctags -a -o tags+ && \
2739+
echo $(FOUND_SOURCE_FILES) | xargs ctags -a -o tags+ && \
27382740
mv tags+ tags
27392741

2740-
.PHONY: cscope
2741-
cscope:
2742+
cscope.out: $(FOUND_SOURCE_FILES)
27422743
$(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
27442748

27452749
### Detect prefix changes
27462750
TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
@@ -2921,7 +2925,7 @@ check: config-list.h command-list.h
29212925
exit 1; \
29222926
fi
29232927

2924-
FOUND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
2928+
FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
29252929
COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
29262930

29272931
%.cocci.patch: %.cocci $(COCCI_SOURCES)

0 commit comments

Comments
 (0)