In rare cases, the PROG target is intentionally redefined before
including bsd.prog.mk, but when that happens a target redefinition
warning is emitting. This adds a check for a pre-existing $PROG
target before attempting to define it.
It stops warnings from being emitted when loader and loader_tftp
are built.
OBJS+= ${SRCS:N*.h:N*.patch:R:S/$/.o/g}
+.if !target(${PROG})
${PROG}: ${OBJS}
.if defined(PROG_CXX)
${CXX_LINK} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.else
${CC_LINK} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.endif
+.endif
.else # !defined(SRCS)