]> git.ipfire.org Git - people/ms/gcc.git/commitdiff
Make etags path used by build system configurable
authorEric Gallager <egallager@gcc.gnu.org>
Mon, 29 Nov 2021 18:24:12 +0000 (13:24 -0500)
committerEric Gallager <egallager@gcc.gnu.org>
Mon, 29 Nov 2021 18:24:12 +0000 (13:24 -0500)
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.

20 files changed:
gcc/Makefile.in
gcc/ada/gcc-interface/Make-lang.in
gcc/c/Make-lang.in
gcc/configure
gcc/configure.ac
gcc/cp/Make-lang.in
gcc/d/Make-lang.in
gcc/fortran/Make-lang.in
gcc/go/Make-lang.in
gcc/objc/Make-lang.in
gcc/objcp/Make-lang.in
intl/Makefile.in
intl/configure
intl/configure.ac
libcpp/Makefile.in
libcpp/configure
libcpp/configure.ac
libiberty/Makefile.in
libiberty/configure
libiberty/configure.ac

index a4344d67f4448c8c023f77d3e747844e4cb4bda8..7054201db522374ff588725a7f167d6b99461c04 100644 (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.
index ae5158a54843e4c35185f226f069aeda4eccc992..c01945b4b9fa355aee77ce66141cd478e5f0d2e7 100644 (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.
index 67a40fc4662e1f13bfad5a91a1557b5aed66bc46..90900963d44065de630e14ae81119269861f3e0b 100644 (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:
 
index 74b9d9be4c853e55a6e2e2d7dcd0acc438722177..40b5ed9e797f2fc05f4cd8696dd41bc6a92be28e 100755 (executable)
@@ -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
index c9ee1fb8919e973de99195afdffd3dc8e5fdd549..aa2f6d834ed484a4eb81a7c1a4427ae4d1624b0a 100644 (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])
index de1fc0249e67d9a2af51fa39335768a598a078a8..3dfa9cee6b7a064d7cfdf9f43a196d786b732843 100644 (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
 
index 554a26e52c7aa7c7b631da367b2bf7708626b49b..1ed813443b396995e951151cf29c8dad2e881036 100644 (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
index 58ce589d83750d051faef52d289816a657971658..414f3ebf9d21f98caadca7114524d4bf1d65cfe8 100644 (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
 
index 4bdc8f6ea5ac944134f8f29bfe5bd57eea7dfa0d..6fdf55b1802a70dd5e47f508dd6538c20c9d7494 100644 (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
index d3f99c8de5501cf508b6f87435270fe486f42718..2a948158e0415461c4db18232eec33498589b3ab 100644 (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
 
index 180638637e92ab9b01ed4ace92e6e41fe94a5f76..33f448ada1a4aef2635eb39dc1cb3f6921ec02b7 100644 (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++
 
index ec8c648b7a96a2d3f4e653e260e1b57c6f651178..409d693c48e8eeb885f5bdd1638e9b88b489baa6 100644 (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
index 9d4f5000f9e22c43ff951d256b6a164e771b7e8d..03f40487a92b98bcf62711eb69e38c793264266f 100755 (executable)
@@ -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.
 
 
index 72b145958cfef20cfd211a86930fc8577a8ed9fd..16a740aa230aa29971893b3a59f7a570299e1a45 100644 (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)
index 34e4206957d878dc4d960ac9f141e04e666f8fa5..6b6554bd321c0ae58b355e537d45da48ea9b20d9 100644 (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.
index 9674cd9c7a7b97b6d8975ec55b99d3842810d688..2797292679fc77099adc93a0f054d332d5cd5b23 100755 (executable)
@@ -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.
 
index 1efa96f7ca3fb8f8600d58f126c2717469d1d406..bc2373c8718268b050a854755c0d6b54e0c3afff 100644 (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.
 
index 884cc6c4af216960ff972da401e3e2523a7ab53d..0d41a79cc98153e12adf8b1e2160748d314ade7e 100644 (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.
index 3c7e588b16b56e23a3cf0d18bf4edb20dd73a01d..0a797255c70c00f66a569c98ef2ddaa97d21e9f0 100755 (executable)
@@ -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.
index 4b78c1830c76f2c93864d60ff0d78f279d4bb273..84a7b378fad9d082951d79055a5dd2c435015b37 100644 (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, )