From 47bf8a5c3b6225a2f3d587d97db0214a85a91104 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Thu, 11 Apr 2002 10:44:30 +0000 Subject: [PATCH] Implement PROG_CXX for . Obtained from: NetBSD (with some mods) Reviewed by: peter --- share/mk/bsd.README | 8 +++++++- share/mk/bsd.prog.mk | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.README b/share/mk/bsd.README index 9a7140e8adc..3c292aa90a8 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -226,11 +226,17 @@ MAN Manual pages (should end in .1 - .9). If no MAN variable PROG The name of the program to build. If not supplied, nothing is built. +PROG_CXX If defined, the name of the program to build. Also + causes to link the program with the + standard C++ library. PROG_CXX overrides the value + of PROG if PROG is also set. + PROGNAME The name that the above program will be installed as, if different from ${PROG}. SRCS List of source files to build the program. If SRCS is not - defined, it's assumed to be ${PROG}.c. + defined, it's assumed to be ${PROG}.c or, if PROG_CXX is + defined, ${PROG_CXX}.cc. DPADD Additional dependencies for the program. Usually used for libraries. For example, to depend on the compatibility and diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 7daaad9b427..aaafd2559dc 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -20,6 +20,12 @@ STRIP?= -s LDFLAGS+= -static .endif +.if defined(PROG_CXX) +PROG= ${PROG_CXX} +DPADD+= ${LIBSTDCPLUSPLUS} +LDADD+= -lstdc++ +.endif + .if defined(PROG) .if defined(SRCS) @@ -37,7 +43,11 @@ ${PROG}: ${OBJS} .else !defined(SRCS) .if !target(${PROG}) +.if defined(PROG_CXX) +SRCS= ${PROG}.cc +.else SRCS= ${PROG}.c +.endif # Always make an intermediate object file because: # - it saves time rebuilding when only the library has changed