On 3/19/25 16:23, Chuck Silvers wrote:
On Wed, Mar 19, 2025 at 08:44:13PM +0000, Brooks Davis wrote:
On Wed, Mar 19, 2025 at 08:22:36PM +0000, Chuck Silvers wrote:
The branch main has been updated by chs:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=623be660fcc9860c0e8b99e8c2c4bbdefc121fd1

commit 623be660fcc9860c0e8b99e8c2c4bbdefc121fd1
Author:     Chuck Silvers <c...@freebsd.org>
AuthorDate: 2025-03-19 19:48:10 +0000
Commit:     Chuck Silvers <c...@freebsd.org>
CommitDate: 2025-03-19 19:48:10 +0000

     beep: add missing include of src.opts.mk, use LIBADD instead of LDFLAGS
Sponsored by: Netflix
---
  usr.bin/beep/Makefile | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/usr.bin/beep/Makefile b/usr.bin/beep/Makefile
index f252ab64f843..8388ff7ff986 100644
--- a/usr.bin/beep/Makefile
+++ b/usr.bin/beep/Makefile
@@ -1,6 +1,7 @@
+.include <src.opts.mk>

Why add src.opts.mk?  Nothing is using it and bsd.prog.mk will include
it.  Is there another change coming that will use it?

-- Brooks

+
  PROG= beep
  MAN=  beep.1
-
-LDFLAGS= -lm
+LIBADD=        m
.include <bsd.prog.mk>


the motivation for these changes is that I want to be able to add something
to LDFLAGS in /etc/src.conf and have that actually affect every executable
and shared library that is built.

we don't actually care about beep or trim, I just noticed that they were
not getting the LDFLAGS from src.conf and thought I would fix them
for completeness.  adding the include of src.opts.mk seemed to fix that.
also, a great many makefiles include src.opts.mk as the first thing and
I thought that was just some boilerplate that was expected to be done
everywhere and had been overlooked in these two.

at that point I had not changed the usage of LDFLAGS in these two makefiles.
then as I was arranging this stuff to commit, I grep'ed for other makefiles
that assign rather than append to LDFLAGS (like I had found in bsnmpd)
and found that these same two makefiles also incorrectly assigned to LDFLAGS,
so then I added the other changes you see in those two commits.

I'm not sure why I thought that including src.opts.mk without changing
the LDFLAGS usage made things work initially.  I tried that again just now
and indeed it doesn't help, and the parts that remove the assignment to LDFLAGS
are enough.  maybe I had something stale in my obj dir before?

anyway, I'd be happy to remove the include of src.opts.mk from these again
if you'd like.

I do think we shouldn't keep the extra src.opts.mk includes unless they are 
needed.
The typical use case for including that early is if a Makefile needs to test
some of the variables it sets (e.g. MK_FOO).

--
John Baldwin


Reply via email to