[Bug 260128] "make tags" fails with "gtags not found", src/Makefile undesirably rewrites PATH

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 30 Nov 2021 22:55:35 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260128

Jory Folker <jfolker11@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jfolker11@gmail.com

--- Comment #4 from Jory Folker <jfolker11@gmail.com> ---
For now, I propose setting /usr/local/bin/gtags in bsd.dep.mk, and here is my
diff:

freebsd% cat bsd.dep.mk.diff
--- bsd.dep.mk  2021-11-30 16:09:01.231877000 -0600
+++ bsd.dep.mk.new      2021-11-30 16:08:25.988490000 -0600
@@ -45,7 +45,7 @@
 .error bsd.dep.mk cannot be included directly.
 .endif

-CTAGS?=                gtags
+CTAGS?=                /usr/local/bin/gtags
 CTAGSFLAGS?=
 GTAGSFLAGS?=   -o
 HTAGSFLAGS?=
freebsd% 

If we could eliminate a dependency on an executable from outside the base
system, then defaulting to ctags and allowing the user to change it by
exporting CTAGS in their env is ideal.

However, when I run 'make tags' with ctags, stderr is flooded with superfluous
"Duplicate entry" warnings for redefined macros, functions defined using
macros, etc, like this:

Duplicate entry in file
/usr/home/jfolker/freebsd/src/contrib/ntp/ntpdc/ntpdc.c, line 1910:
__attribute__
Second entry ignored
Duplicate entry in file
/usr/home/jfolker/freebsd/src/contrib/ntp/ntpdc/ntpdc.c, line 1926:
__attribute__
Second entry ignored

This isn't itself bad, but it gives reasonable suspicion that we will lose
other functionality switching from gtags to ctags.

But I found something else worth noting: unless the install dest for GNU global
was changed in the ports tree Makefile, 'make tags' has been broken for over 18
years.

freebsd% git blame src/Makefile
d672a60908a4 (Ruslan Ermilov      2002-04-29 15:22:01 +0000 214) 
76499f153979 (Ruslan Ermilov      2003-01-29 10:00:42 +0000 215) PATH= 
/sbin:/bin:/usr/sbin:/usr/bin
2e84ab947d9c (Ruslan Ermilov      2002-12-02 14:31:21 +0000 216)
MAKEOBJDIRPREFIX?=     /usr/obj
freebsd%
freebsd% git blame src/share/mk/bsd.dep.mk
5ffdf3618ef7 (Ruslan Ermilov      2002-04-22 10:04:41 +0000  44) .if
!target(__<bsd.init.mk>__)
5ffdf3618ef7 (Ruslan Ermilov      2002-04-22 10:04:41 +0000  45) .error
bsd.dep.mk cannot be included directly.
5ffdf3618ef7 (Ruslan Ermilov      2002-04-22 10:04:41 +0000  46) .endif
b16495e786c9 (Wolfram Schneider   1996-04-01 18:58:28 +0000  47) 
ccc4bab1047d (Ruslan Ermilov      2002-10-17 13:48:13 +0000  48) CTAGS?=       
        gtags
ccc4bab1047d (Ruslan Ermilov      2002-10-17 13:48:13 +0000  49) CTAGSFLAGS?=
ccc4bab1047d (Ruslan Ermilov      2002-10-17 13:48:13 +0000  50) GTAGSFLAGS?=  
-o
ccc4bab1047d (Ruslan Ermilov      2002-10-17 13:48:13 +0000  51) HTAGSFLAGS?=
ccc4bab1047d (Ruslan Ermilov      2002-10-17 13:48:13 +0000  52)

-- 
You are receiving this mail because:
You are the assignee for the bug.