fix code attempting to skip adding "-g" if "-g*" already is used. in bsd.lib.mk there's a check for "MKDEBUG != no" that will add -g to CFLAGS (maybe) and to CSHLIBFLAGS (always), given that it isn't in CFLAGS already.. except the conditional is "||" instead of "&&" and since the MKDEBUG/NODEBUG checks pass, the CFLAGS check isn't even performed. additionally, check CXXFLAGS as well as CFLAGS. this fixes the attempt to use "-g1" in the llvmrt build, which fails because the compile lines end up being "... -g1 .. -g ..", (the "-g" comes from the CSHLIBFLAGS variable in that case.) this reduces the size of llvm-enabled gallium debug by over 1GB. Index: share/mk/bsd.lib.mk =================================================================== RCS file: /cvsroot/src/share/mk/bsd.lib.mk,v retrieving revision 1.389 diff -p -u -r1.389 bsd.lib.mk --- share/mk/bsd.lib.mk 29 Mar 2022 22:48:04 -0000 1.389 +++ share/mk/bsd.lib.mk 5 Feb 2023 21:54:46 -0000 @@ -169,8 +169,10 @@ MKSHLIBOBJS= yes MKSHLIBOBJS= no .endif -.if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) || \ - (defined(CFLAGS) && !empty(CFLAGS:M*-g*)) +# Avoid adding "-g" if we already have a "-g*" option. +.if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) && \ + (!defined(CFLAGS) || empty(CFLAGS:M-g*)) && \ + (!defined(CXXFLAGS) || empty(CXXFLAGS:M-g*)) # We only add -g to the shared library objects # because we don't currently split .a archives. CSHLIBFLAGS+= -g