.if defined(PROG)
.if defined(SRCS)
# If there are Objective C sources, link with Objective C libraries.
# If there are Objective C or C++ sources, link with appropriate libraries.
.if ${SRCS:M*.m} != ""
OBJCLIBS?= -lobjc
LDADD+= ${OBJCLIBS}
.endif
.if ${SRCS:C/\.(cc\$|C\$|cxx\$|cpp\$)//} != ${SRCS}
CXXLIBS?= -lstdc++
LDADD+= ${CXXLIBS}
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}