Implement PROG_CXX for <bsd.prog.mk>.

Obtained from:	NetBSD (with some mods)
Reviewed by:	peter
This commit is contained in:
Ruslan Ermilov 2002-04-11 10:44:30 +00:00
parent b2f485ca0d
commit 47bf8a5c3b
2 changed files with 17 additions and 1 deletions

View file

@ -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 <bsd.prog.mk> 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

View file

@ -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