From 83bc64364d21712865913ca5b4627c3ea8ec0071 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 13 Dec 2017 21:12:21 -0500 Subject: [PATCH 2/4] Make TAGS file in the srcdir for out-of-tree builds * Makefile.in: * lisp/Makefile.in: * lwlib/Makefile.in: * src/Makefile.in: Create TAGS files in ${srcdir}, not build dir. --- Makefile.in | 2 +- lisp/Makefile.in | 2 +- lwlib/Makefile.in | 6 +++--- src/Makefile.in | 18 ++++++++++-------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Makefile.in b/Makefile.in index 238df40ded..8a0a505320 100644 --- a/Makefile.in +++ b/Makefile.in @@ -929,7 +929,7 @@ extraclean: $(extraclean_dirs: # The src subdir knows how to do the right thing # even when the build directory and source dir are different. .PHONY: TAGS tags -TAGS tags: lib lib-src src +${srcdir}/TAGS tags: lib lib-src src $(MAKE) -C src tags .PHONY: have-tests diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 05fca9579f..373ce60d12 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -258,7 +258,7 @@ ${ETAGS}: ## etags. It might be better to use find in a similar way to ## compile-main. But maybe this is not even necessary any more now ## that this uses relative filenames. -TAGS: ${ETAGS} ${tagsfiles} +${srcdir}/TAGS: ${ETAGS} ${tagsfiles} $(AM_V_at)rm -f $@ $(AM_V_at)touch $@ $(AM_V_GEN)ls ${tagsfiles} | xargs $(XARGS_LIMIT) "${ETAGS}" -a -o $@ diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in index 32d7a91f9b..1cb35337c9 100644 --- a/lwlib/Makefile.in +++ b/lwlib/Makefile.in @@ -129,8 +129,8 @@ ctagsfiles= FORCE: .PHONY: tags FORCE -tags: TAGS -TAGS: ${ETAGS} $(ctagsfiles) - ${ETAGS} $(ctagsfiles) +tags: ${srcdir}/TAGS +${srcdir}/TAGS: ${ETAGS} $(ctagsfiles) + $(AM_V_GEN)${ETAGS} -o $@ $(ctagsfiles) ### Makefile.in ends here diff --git a/src/Makefile.in b/src/Makefile.in index d914dfebbd..cb4f8ae6c6 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -674,13 +674,15 @@ ${ETAGS}: ctagsfiles1 = $(wildcard ${srcdir}/*.[hc]) ctagsfiles2 = $(wildcard ${srcdir}/*.m) -## FIXME? In out-of-tree builds, should TAGS be generated in srcdir? +## In out-of-tree builds, TAGS should be generated in srcdir. ## This does not need to depend on ../lisp and ../lwlib TAGS files, ## because etags "--include" only includes a pointer to the file, -## rather than the file contents. -TAGS: ${ETAGS} $(ctagsfiles1) $(ctagsfiles2) - $(AM_V_GEN)${ETAGS} --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \ +## rather than the file contents. The "--include" reference is +## relative to the location of the generated TAGS file, so it doesn't +## need to use ${srcdir}. +${srcdir}/TAGS: ${ETAGS} $(ctagsfiles1) $(ctagsfiles2) + $(AM_V_GEN)${ETAGS} -o $@ --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \ --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/\1/' \ --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"[^"]+",[ ]\([A-Za-z0-9_]+\)/\1/' \ $(ctagsfiles1) \ @@ -690,13 +692,13 @@ TAGS: ## Arrange to make tags tables for ../lisp and ../lwlib, ## which the above TAGS file for the C files includes by reference. -../lisp/TAGS: FORCE - $(MAKE) -C ../lisp TAGS ETAGS="$(ETAGS)" +${srcdir}/../lisp/TAGS: FORCE + $(MAKE) -C ../lisp ${top_srcdir}/lisp/TAGS ETAGS="$(ETAGS)" -$(lwlibdir)/TAGS: FORCE +${srcdir}/$(lwlibdir)/TAGS: FORCE $(MAKE) -C $(lwlibdir) TAGS ETAGS="$(ETAGS)" -tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS +tags: ${srcdir}/TAGS ${srcdir}/../lisp/TAGS ${srcdir}/$(lwlibdir)/TAGS .PHONY: tags -- 2.11.0