Make etags path used by build system configurable

This commit allows users to specify a path to their "etags"
executable for use when doing "make tags".
I based this patch off of this one from upstream automake:
https://git.savannah.gnu.org/cgit/automake.git/commit/m4?id=d2ccbd7eb38d6a4277d6f42b994eb5a29b1edf29
This means that I just supplied variables that the user can override
for the tags programs, rather than having the configure scripts
actually check for them. I handle etags and ctags separately because
the intl subdirectory has separate targets for them. This commit
only affects the subdirectories that use handwritten Makefiles; the
ones that use automake will have to wait until we update the version
of automake used to be 1.16.4 or newer before they'll be fixed.

Addresses #103021

gcc/ChangeLog:

	PR other/103021
	* Makefile.in: Substitute CTAGS, ETAGS, and CSCOPE
	variables. Use ETAGS variable in TAGS target.
	* configure: Regenerate.
	* configure.ac: Allow CTAGS, ETAGS, and CSCOPE
	variables to be overridden.

gcc/ada/ChangeLog:

	PR other/103021
	* gcc-interface/Make-lang.in: Use ETAGS variable in
	TAGS target.

gcc/c/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/cp/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/d/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/fortran/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/go/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/objc/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/objcp/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

intl/ChangeLog:

	PR other/103021
	* Makefile.in: Use ETAGS variable in TAGS target,
	CTAGS variable in CTAGS target, and MKID variable
	in ID target.
	* configure: Regenerate.
	* configure.ac: Allow CTAGS, ETAGS, and MKID
	variables to be overridden.

libcpp/ChangeLog:

	PR other/103021
	* Makefile.in: Use ETAGS variable in TAGS target.
	* configure: Regenerate.
	* configure.ac: Allow ETAGS variable to be overridden.

libiberty/ChangeLog:

	PR other/103021
	* Makefile.in: Use ETAGS variable in TAGS target.
	* configure: Regenerate.
	* configure.ac: Allow ETAGS variable to be overridden.
This commit is contained in:
Eric Gallager 2021-11-29 13:24:12 -05:00
parent 85289ba36c
commit 909b30a17e
20 changed files with 120 additions and 25 deletions

View File

@ -4319,6 +4319,10 @@ paranoia: paranoia.o real.o $(LIBIBERTY)
# These exist for maintenance purposes.
CTAGS=@CTAGS@
ETAGS=@ETAGS@
CSCOPE=@CSCOPE@
# Update the tags table.
TAGS: lang.tags
(cd $(srcdir); \
@ -4328,14 +4332,14 @@ TAGS: lang.tags
incs="$$incs --include $$dir/TAGS.sub"; \
fi; \
done; \
etags -o TAGS.sub c-family/*.h c-family/*.c c-family/*.cc \
$(ETAGS) -o TAGS.sub c-family/*.h c-family/*.c c-family/*.cc \
*.h *.c *.cc \
../include/*.h ../libiberty/*.c \
../libcpp/*.c ../libcpp/include/*.h \
--language=none --regex="/\(char\|unsigned int\|int\|bool\|void\|HOST_WIDE_INT\|enum [A-Za-z_0-9]+\) [*]?\([A-Za-z_0-9]+\)/\2/" common.opt \
--language=none --regex="/\(DEF_RTL_EXPR\|DEFTREECODE\|DEFGSCODE\|DEFTIMEVAR\|DEFPARAM\|DEFPARAMENUM5\)[ ]?(\([A-Za-z_0-9]+\)/\2/" rtl.def tree.def gimple.def timevar.def \
; \
etags --include TAGS.sub $$incs)
$(ETAGS) --include TAGS.sub $$incs)
# -----------------------------------------------------
# Rules for generating translated message descriptions.

View File

@ -805,8 +805,8 @@ ada.srcextra:
ada.srcman:
ada.tags: force
cd $(srcdir)/ada && etags -o TAGS.sub *.c *.h *.ads *.adb && \
etags --include TAGS.sub --include ../TAGS.sub
cd $(srcdir)/ada && $(ETAGS) -o TAGS.sub *.c *.h *.ads *.adb && \
$(ETAGS) --include TAGS.sub --include ../TAGS.sub
# Generate documentation.

View File

@ -109,8 +109,8 @@ c.srcinfo:
c.srcextra: gengtype-lex.c
-cp -p $^ $(srcdir)
c.tags: force
cd $(srcdir)/c; etags -o TAGS.sub *.c *.h; \
etags --include TAGS.sub --include ../TAGS.sub
cd $(srcdir)/c; $(ETAGS) -o TAGS.sub *.c *.h; \
$(ETAGS) --include TAGS.sub --include ../TAGS.sub
c.man:
c.srcman:

21
gcc/configure vendored
View File

@ -714,6 +714,9 @@ gcc_tooldir
enable_lto
DO_LINK_SERIALIZATION
DO_LINK_MUTEX
CSCOPE
ETAGS
CTAGS
MAINT
zlibinc
zlibdir
@ -19455,7 +19458,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 19458 "configure"
#line 19461 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -19561,7 +19564,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 19564 "configure"
#line 19567 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -31378,6 +31381,19 @@ else
MAINT='#'
fi
if test -z "$CTAGS"; then
CTAGS=ctags
fi
if test -z "$ETAGS"; then
ETAGS=etags
fi
if test -z "$CSCOPE"; then
CSCOPE=cscope
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to avoid linking multiple front-ends at once" >&5
$as_echo_n "checking whether to avoid linking multiple front-ends at once... " >&6; }
@ -33941,3 +33957,4 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
_AC_FINALIZE

View File

@ -7040,6 +7040,20 @@ else
fi
AC_SUBST(MAINT)dnl
dnl Variables for tags utilities; copied from automake 1.16.4+'s init.m4
if test -z "$CTAGS"; then
CTAGS=ctags
fi
AC_SUBST([CTAGS])
if test -z "$ETAGS"; then
ETAGS=etags
fi
AC_SUBST([ETAGS])
if test -z "$CSCOPE"; then
CSCOPE=cscope
fi
AC_SUBST([CSCOPE])
dnl Whether to prevent multiple front-ends from linking at the same time
AC_MSG_CHECKING([whether to avoid linking multiple front-ends at once])

View File

@ -174,9 +174,9 @@ c++.srcinfo:
c++.srcextra:
c++.tags: force
cd $(srcdir)/cp; etags -o TAGS.sub *.c *.cc *.h --language=none \
cd $(srcdir)/cp; $(ETAGS) -o TAGS.sub *.c *.cc *.h --language=none \
--regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' cp-tree.def; \
etags --include TAGS.sub --include ../TAGS.sub
$(ETAGS) --include TAGS.sub --include ../TAGS.sub
c++.man: doc/g++.1

View File

@ -221,8 +221,8 @@ d.srcextra:
d.tags: force
cd $(srcdir)/d; \
etags -o TAGS.sub *.c *.cc *.h dmd/*.c dmd/*.h dmd/root/*.h dmd/root/*.c; \
etags --include TAGS.sub --include ../TAGS.sub
$(ETAGS) -o TAGS.sub *.c *.cc *.h dmd/*.c dmd/*.h dmd/root/*.h dmd/root/*.c; \
$(ETAGS) --include TAGS.sub --include ../TAGS.sub
d.man: doc/gdc.1
d.srcman: doc/gdc.1

View File

@ -113,8 +113,8 @@ fortran.srcinfo: doc/gfortran.info
-cp -p $^ $(srcdir)/fortran
fortran.tags: force
cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
etags --include TAGS.sub --include ../TAGS.sub
cd $(srcdir)/fortran; $(ETAGS) -o TAGS.sub *.c *.h; \
$(ETAGS) --include TAGS.sub --include ../TAGS.sub
fortran.info: doc/gfortran.info doc/gfc-internals.info

View File

@ -133,8 +133,8 @@ go.srcinfo: doc/gccgo.info
go.srcextra:
go.tags: force
cd $(srcdir)/go; \
etags -o TAGS.sub *.c *.h gofrontend/*.h gofrontend/*.cc; \
etags --include TAGS.sub --include ../TAGS.sub
$(ETAGS) -o TAGS.sub *.c *.h gofrontend/*.h gofrontend/*.cc; \
$(ETAGS) --include TAGS.sub --include ../TAGS.sub
go.man: doc/gccgo.1
go.srcman: doc/gccgo.1
-cp -p $^ $(srcdir)/doc

View File

@ -102,8 +102,8 @@ objc.srcman:
objc.install-plugin:
objc.tags: force
cd $(srcdir)/objc; etags -o TAGS.sub *.c *.h; \
etags --include TAGS.sub --include ../TAGS.sub
cd $(srcdir)/objc; $(ETAGS) -o TAGS.sub *.c *.h; \
$(ETAGS) --include TAGS.sub --include ../TAGS.sub
lang_checks += check-objc

View File

@ -136,8 +136,8 @@ obj-c++.man:
obj-c++.install-plugin:
obj-c++.tags: force
cd $(srcdir)/objcp; etags -o TAGS.sub *.c *.h; \
etags --include TAGS.sub --include ../TAGS.sub
cd $(srcdir)/objcp; $(ETAGS) -o TAGS.sub *.c *.h; \
$(ETAGS) --include TAGS.sub --include ../TAGS.sub
lang_checks += check-obj-c++

View File

@ -50,6 +50,10 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
DEFS = -DHAVE_CONFIG_H
CTAGS = @CTAGS@
ETAGS = @ETAGS@
MKID = @MKID@
COMPILE = $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(DEFS-$@) $(INCLUDES)
HEADERS = \
@ -176,17 +180,17 @@ localealias.o localcharset.o relocatable.o: relocatable.h
tags: TAGS
TAGS: $(HEADERS) $(SOURCES)
here=`pwd`; cd $(srcdir) && \
etags -o $$here/TAGS $(HEADERS) $(SOURCES)
$(ETAGS) -o $$here/TAGS $(HEADERS) $(SOURCES)
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES)
here=`pwd`; cd $(srcdir) && \
ctags -o $$here/CTAGS $(HEADERS) $(SOURCES)
$(CTAGS) -o $$here/CTAGS $(HEADERS) $(SOURCES)
id: ID
ID: $(HEADERS) $(SOURCES)
here=`pwd`; cd $(srcdir) && \
mkid -f$$here/ID $(HEADERS) $(SOURCES)
$(MKID) -f$$here/ID $(HEADERS) $(SOURCES)
mostlyclean:
rm -f *.a *.la *.o *.obj *.lo core core.* libintl.h

16
intl/configure vendored
View File

@ -627,6 +627,9 @@ BISON3_NO
BISON3_YES
INCINTL
LIBINTL_DEP
MKID
ETAGS
CTAGS
MAINT
AUTOHEADER
AUTOCONF
@ -6799,6 +6802,19 @@ else
fi
if test -z "$CTAGS"; then
CTAGS=ctags
fi
if test -z "$ETAGS"; then
ETAGS=etags
fi
if test -z "$MKID"; then
MKID=mkid
fi
# Additional info for config.intl.

View File

@ -32,6 +32,20 @@ else
fi
AC_SUBST(MAINT)
dnl Variables for tags utilities; based on automake 1.16.4+'s init.m4
if test -z "$CTAGS"; then
CTAGS=ctags
fi
AC_SUBST([CTAGS])
if test -z "$ETAGS"; then
ETAGS=etags
fi
AC_SUBST([ETAGS])
if test -z "$MKID"; then
MKID=mkid
fi
AC_SUBST([MKID])
# Additional info for config.intl.
AC_SUBST(LIBINTL_DEP)
AC_SUBST(INCINTL)

View File

@ -264,11 +264,13 @@ po/$(PACKAGE).pot: $(libcpp_a_SOURCES)
sed 's:$(srcdir)/::g' <po/$(PACKAGE).pot.tmp >po/$(PACKAGE).pot
rm po/$(PACKAGE).pot.tmp
ETAGS = @ETAGS@
TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h system.h ucnid.h \
include/cpplib.h include/line-map.h include/mkdeps.h include/symtab.h
TAGS: $(TAGS_SOURCES)
cd $(srcdir) && etags $(TAGS_SOURCES)
cd $(srcdir) && $(ETAGS) $(TAGS_SOURCES)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

6
libcpp/configure vendored
View File

@ -652,6 +652,7 @@ noexception_flags
WARN_PEDANTIC
c_warn
warn
ETAGS
AUTOHEADER
AUTOCONF
ACLOCAL
@ -4896,6 +4897,11 @@ done
test -n "$AUTOHEADER" || AUTOHEADER="$MISSING autoheader"
if test -z "$ETAGS"; then
ETAGS=etags
fi
# Figure out what compiler warnings we can enable.
# See config/warnings.m4 for details.

View File

@ -22,6 +22,11 @@ AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
if test -z "$ETAGS"; then
ETAGS=etags
fi
AC_SUBST([ETAGS])
# Figure out what compiler warnings we can enable.
# See config/warnings.m4 for details.

View File

@ -429,8 +429,10 @@ stamp-noasandir:
.PHONY: all etags tags TAGS ls clean stage1 stage2
ETAGS = @ETAGS@
etags tags TAGS: etags-subdir
cd $(srcdir) && etags $(CFILES)
cd $(srcdir) && $(ETAGS) $(CFILES)
# The standalone demangler (c++filt) has been moved to binutils.
# But make this target work anyway for demangler hacking.

6
libiberty/configure vendored
View File

@ -659,6 +659,7 @@ HAVE_PERL
PERL
BUILD_INFO
MAKEINFO
ETAGS
NOTMAINT
MAINT
libiberty_topdir
@ -2558,6 +2559,11 @@ else
NOTMAINT=''
fi
if test -z "$ETAGS"; then
ETAGS=etags
fi
# Do we have a single-tree copy of texinfo? Even if we do, we can't
# rely on it - libiberty is built before texinfo.
# Extract the first word of "makeinfo", so it can be a program name with args.

View File

@ -61,6 +61,11 @@ fi
AC_SUBST(MAINT)dnl
AC_SUBST(NOTMAINT)dnl
if test -z "$ETAGS"; then
ETAGS=etags
fi
AC_SUBST([ETAGS])
# Do we have a single-tree copy of texinfo? Even if we do, we can't
# rely on it - libiberty is built before texinfo.
AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )