From c6d3c60f283a9c2071b4db185773a00e53e20a61 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 6 Jan 2016 18:25:47 -0500 Subject: [PATCH] Build tweaks related to tags files. * lib-src/Makefile.in (tagsfiles): New variable. (TAGS): Also depend on the source files. Use our own etags program. * lisp/Makefile.in (ETAGS): Add EXEEXT. (lisptagsfiles1, lisptagsfiles2, lisptagsfiles3, lisptagsfiles4): Remove. (tagsfiles): New, replacing lisptagsfiles1 etc. Remove irrelevant source files here rather than in the TAGS rule. (${ETAGS}): New rule. (TAGS): Also depend on the etags executable. * lwlib/Makefile.in (EXEEXT): New, set by configure. (ETAGS): Add EXEEXT. (${ETAGS}): New rule. (ctagsfiles): Use "wildcard". (TAGS): Also depend on the etags executable. * nt/Makefile.in (ETAGS, tagsfiles): New variables. (${ETAGS}): New rule. (TAGS): Fix dependencies. * oldXMenu/Makefile.in (EXEEXT): New, set by configure. (ETAGS): New variable, replacing $TAGS. Use our own etags program. Remove "-t" argument. (${ETAGS}): New rule. (tagsfiles): New variable. (TAGS): New rule, with proper dependencies. * src/Makefile.in (ETAGS): Add EXEEXT. Add a build rule. (ctagsfiles1, ctagsfiles2): Use "wildcard". (ctagsfiles3): Remove. (TAGS): Depend on etags. (../lisp/TAGS, $(lwlibdir)/TAGS): Let the rules in the relevant directories decide if updates are needed. --- lib-src/Makefile.in | 7 +++++-- lisp/Makefile.in | 22 ++++++++++++---------- lwlib/Makefile.in | 15 +++++++++------ nt/Makefile.in | 13 +++++++++++-- oldXMenu/Makefile.in | 17 +++++++++++++---- src/Makefile.in | 22 ++++++++++++---------- 6 files changed, 62 insertions(+), 34 deletions(-) diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 2b65cb2e1a..b666508e59 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -345,9 +345,12 @@ extraclean: maintainer-clean check: @echo "We don't have any tests for the lib-src/ directory yet." +tagsfiles = $(wildcard ${srcdir}/*.[ch]) + +.PHONY: tags tags: TAGS -TAGS: etags${EXEEXT} - etags *.[ch] +TAGS: etags${EXEEXT} ${tagsfiles} + ./etags ${tagsfiles} ../lib/libgnu.a: $(config_h) $(MAKE) -C ../lib all diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 3d0c95dcb5..5f72e6ce23 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -220,26 +220,28 @@ update-authors: $(emacs) -L "$(top_srcdir)/admin" -l authors \ -f batch-update-authors "$(top_srcdir)/etc/AUTHORS" "$(top_srcdir)" +FORCE: +.PHONY: FORCE -ETAGS = ../lib-src/etags +tagsfiles = $(shell find ${srcdir} -name '*.el') +tagsfiles := $(filter-out ${srcdir}/%loaddefs.el,${tagsfiles}) +tagsfiles := $(filter-out ${srcdir}/ldefs-boot.el,${tagsfiles}) +tagsfiles := $(filter-out ${srcdir}/eshell/esh-groups.el,${tagsfiles}) -lisptagsfiles1 = $(srcdir)/*.el -lisptagsfiles2 = $(srcdir)/*/*.el -lisptagsfiles3 = $(srcdir)/*/*/*.el -lisptagsfiles4 = $(srcdir)/*/*/*/*.el +ETAGS = ../lib-src/etags${EXEEXT} + +${ETAGS}: FORCE + ${MAKE} -C ../lib-src $(notdir $@) ## The ls | sed | xargs is to stop the command line getting too long ## on MS Windows, when the MSYS Bash passes it to a MinGW compiled ## 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: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4) +TAGS: ${ETAGS} ${tagsfiles} rm -f $@ touch $@ - ls $(lisptagsfiles1) $(lisptagsfiles2) \ - $(lisptagsfiles3) $(lisptagsfiles4) | \ - sed -e '/loaddefs/d; /\/ldefs-boot/d; /esh-groups\.el/d' | \ - xargs $(XARGS_LIMIT) "$(ETAGS)" -a -o $@ + ls ${tagsfiles} | xargs $(XARGS_LIMIT) "${ETAGS}" -a -o $@ # The src/Makefile.in has its own set of dependencies and when they decide diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in index bfeef16571..be12b4235b 100644 --- a/lwlib/Makefile.in +++ b/lwlib/Makefile.in @@ -44,6 +44,7 @@ RANLIB=@RANLIB@ AR = @AR@ ARFLAGS = @ARFLAGS@ MKDIR_P = @MKDIR_P@ +EXEEXT = @EXEEXT@ LUCID_OBJS = lwlib-Xlw.o xlwmenu.o lwlib-Xaw.o MOTIF_OBJS = lwlib-Xm.o @@ -128,15 +129,17 @@ distclean: clean bootstrap-clean maintainer-clean: distclean rm -f TAGS +ETAGS = ../lib-src/etags${EXEEXT} -ETAGS = ../lib-src/etags +${ETAGS}: FORCE + ${MAKE} -C ../lib-src $(notdir $@) -ctagsfiles= $(srcdir)/*.[ch] +ctagsfiles= $(wildcard ${srcdir}/*.[ch]) -TAGS: $(ctagsfiles) - "$(ETAGS)" $(ctagsfiles) +FORCE: +.PHONY: tags FORCE tags: TAGS -.PHONY: tags - +TAGS: ${ETAGS} $(ctagsfiles) + ${ETAGS} $(ctagsfiles) ### Makefile.in ends here diff --git a/nt/Makefile.in b/nt/Makefile.in index fc6887f163..86fca5f8e3 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -225,9 +225,18 @@ extraclean: maintainer-clean check: @echo "We don't have any tests for the nt/ directory yet." +ETAGS = ../lib-src/etags${EXEEXT} + +${ETAGS}: FORCE + ${MAKE} -C ../lib-src $(notdir $@) + +tagsfiles= $(wildcard ${srcdir}/*.[ch]) + +FORCE: +.PHONY: tags FORCE tags: TAGS -TAGS: ${EXE_FILES:${EXEEXT}=.c} - ../lib-src/etags *.[ch] +TAGS: ${ETAGS} ${tagsfiles} + ${ETAGS} ${tagsfiles} ## Build the programs addpm${EXEEXT}: ${srcdir}/addpm.c ../src/epaths.h diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in index de5b8e1114..71dd5663f4 100644 --- a/oldXMenu/Makefile.in +++ b/oldXMenu/Makefile.in @@ -58,12 +58,12 @@ CC=@CC@ CFLAGS=@CFLAGS@ CPPFLAGS = @CPPFLAGS@ -TAGS = etags RM = rm -f RANLIB = @RANLIB@ AR = @AR@ ARFLAGS = @ARFLAGS@ MKDIR_P = @MKDIR_P@ +EXEEXT = @EXEEXT@ OBJS = Activate.o \ AddPane.o \ @@ -152,8 +152,17 @@ clean mostlyclean: bootstrap-clean maintainer-clean distclean: clean rm -f Makefile -.PHONY: tags -tags: - $(TAGS) -t *.[ch] +ETAGS = ../lib-src/etags${EXEEXT} + +${ETAGS}: FORCE + ${MAKE} -C ../lib-src $(notdir $@) + +tagsfiles = $(wildcard ${srcdir}/*.[ch]) + +FORCE: +.PHONY: tags FORCE +tags: TAGS +TAGS: ${ETAGS} ${tagsfiles} + ${ETAGS} ${tagsfiles} ### Makefile.in ends here diff --git a/src/Makefile.in b/src/Makefile.in index f96ebb2aee..97505b9868 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -649,32 +649,34 @@ extraclean: distclean -rm -f *~ \#* -ETAGS = ../lib-src/etags +ETAGS = ../lib-src/etags${EXEEXT} -ctagsfiles1 = [xyzXYZ]*.[hc] -ctagsfiles2 = [a-wA-W]*.[hc] -ctagsfiles3 = [a-zA-Z]*.m +${ETAGS}: FORCE + ${MAKE} -C ../lib-src $(notdir $@) + +ctagsfiles1 = $(wildcard ${srcdir}/*.[hc]) +ctagsfiles2 = $(wildcard ${srcdir}/*.m) ## FIXME? In out-of-tree builds, should TAGS 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: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(srcdir)/$(ctagsfiles3) - "$(ETAGS)" --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \ +TAGS: ${ETAGS} $(ctagsfiles1) $(ctagsfiles2) + ${ETAGS} --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \ --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/\1/' \ --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"[^"]+",[ ]\([A-Za-z0-9_]+\)/\1/' \ - $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) \ + $(ctagsfiles1) \ --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/\1/' \ --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"[^"]+",[ ]\([A-Za-z0-9_]+\)/\1/' \ - $(srcdir)/$(ctagsfiles3) + $(ctagsfiles2) ## Arrange to make tags tables for ../lisp and ../lwlib, ## which the above TAGS file for the C files includes by reference. -../lisp/TAGS: +../lisp/TAGS: FORCE $(MAKE) -C ../lisp TAGS ETAGS="$(ETAGS)" -$(lwlibdir)/TAGS: +$(lwlibdir)/TAGS: FORCE $(MAKE) -C $(lwlibdir) TAGS ETAGS="$(ETAGS)" tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS -- 2.39.2