Don't add -lstdc++ to LDADD, just let c++(1) link C++ programs.
Record the dependency on ${LIBSTDCPLUSPLUS} similar to ${LIBC}. Suggested by: imp, obrien, peter
This commit is contained in:
parent
722ff934ee
commit
f8ba15551d
@ -22,8 +22,6 @@ LDFLAGS+= -static
|
||||
|
||||
.if defined(PROG_CXX)
|
||||
PROG= ${PROG_CXX}
|
||||
DPADD+= ${LIBSTDCPLUSPLUS}
|
||||
LDADD+= -lstdc++
|
||||
.endif
|
||||
|
||||
.if defined(PROG)
|
||||
@ -37,9 +35,6 @@ LDADD+= ${OBJCLIBS}
|
||||
|
||||
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
||||
|
||||
${PROG}: ${OBJS}
|
||||
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
||||
|
||||
.else !defined(SRCS)
|
||||
|
||||
.if !target(${PROG})
|
||||
@ -55,8 +50,12 @@ SRCS= ${PROG}.c
|
||||
# the name of a variable temporary object.
|
||||
# - it's useful to keep objects around for crunching.
|
||||
OBJS= ${PROG}.o
|
||||
.endif
|
||||
|
||||
${PROG}: ${OBJS}
|
||||
.if defined(PROG_CXX)
|
||||
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
||||
.else
|
||||
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
|
||||
.endif
|
||||
|
||||
@ -88,6 +87,9 @@ _EXTRADEPEND:
|
||||
${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE}
|
||||
.else
|
||||
echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
|
||||
.if defined(PROG_CXX)
|
||||
echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user