git: 076116b88474 - stable/12 - libpmc: Use LIB_CXX instead of explicit LDADD to link a C++ library.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 02 May 2023 17:14:50 UTC
The branch stable/12 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=076116b884744947ca33e6a8ff1007bf260614af

commit 076116b884744947ca33e6a8ff1007bf260614af
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-03-23 16:31:29 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-05-02 16:52:38 +0000

    libpmc: Use LIB_CXX instead of explicit LDADD to link a C++ library.
    
    This uses the C++ compiler as the linker instead of the C compiler
    letting the compiler driver pick the right libraries.  This is a no-op
    on main and stable/13 but matters for stable/12 where the current
    logic breaks for external GCC since it tries to use a non-existent
    libstdc++.
    
    Reviewed by:    emaste
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D39197
    
    (cherry picked from commit c6b3f47fedd3f94f74cc4f7c40761b1d0e777f17)
---
 lib/libpmc/Makefile | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile
index 1e204e13fdb2..973ce5a28687 100644
--- a/lib/libpmc/Makefile
+++ b/lib/libpmc/Makefile
@@ -1,19 +1,12 @@
 # $FreeBSD$
 
-PACKAGE=lib${LIB}
-LIB=	pmc
+LIB_CXX= pmc
 
 SRCS=	libpmc.c pmclog.c libpmc_pmu_util.c libpmc_json.cc
 INCS=	pmc.h pmclog.h pmcformat.h
 
 CFLAGS+= -I${.CURDIR}
 CWARNFLAGS.gcc+= -Wno-shadow -Wno-cast-align
-.include <bsd.compiler.mk>
-.if ${COMPILER_TYPE} == "gcc"
-LDADD+=	-lstdc++
-.else
-LDADD+=	-lc++
-.endif
 
 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"