[PATCH 9/9] libtracefs: Have make tags and TAGS honor O= build directory

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

 



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 58b4219e7b62..bf085bfdb800 100644
--- a/Makefile
+++ b/Makefile
@@ -198,7 +198,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
 
@@ -221,18 +221,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




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux