From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> Currently if one does a "make O=/tmp/build tags" the tags are still built in the source directory. Although this is uncommon to do, the tags (and TAGS) target should still honor the build directory. Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- Makefile | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 85b3c39a867c..4910ebe140b9 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,7 @@ endif $(src)/$(UTEST_DIR)/$(UTEST_BINARY) define find_tag_files - find . -name '\.pc' -prune -o -name '*\.[ch]' -print -o -name '*\.[ch]pp' \ + find $(src) -name '\.pc' -prune -o -name '*\.[ch]' -print -o -name '*\.[ch]pp' \ ! -name '\.#' -print endef @@ -230,18 +230,26 @@ $(BUILD_PREFIX): force $(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template $(BUILD_PREFIX) $(VERSION_FILE) $(Q) $(call do_make_pkgconfig_file,$(prefix)) -tags: force - $(RM) tags - $(call find_tag_files) | xargs ctags --extra=+f --c-kinds=+px +VIM_TAGS = $(obj)/tags +EMACS_TAGS = $(obj)/TAGS +CSCOPE_TAGS = $(obj)/cscope -TAGS: force - $(RM) TAGS - $(call find_tag_files) | xargs etags +$(VIM_TAGS): force + $(RM) $@ + $(call find_tag_files) | (cd $(obj) && xargs ctags --extra=+f --c-kinds=+px) -cscope: force - $(RM) cscope* +$(EMACS_TAGS): force + $(RM) $@ + $(call find_tag_files) | (cd $(obj) && xargs etags) + +$(CSCOPE_TAGS): force + $(RM) $(obj)/cscope* $(call find_tag_files) | cscope -b -q +tags: $(VIM_TAGS) +TAGS: $(EMACS_TAGS) +cscope: $(CSCOPE_TAGS) + ifeq ("$(DESTDIR)", "") # If DESTDIR is not defined, then test if after installing the library # and running ldconfig, if the library is visible by ld.so. -- 2.33.0