PROGS: Build common sources before recursed PROGS_TARGETS as well when building.

MFC after:	2 weeks
Sponsored by:	DellEMC
This commit is contained in:
Bryan Drewery 2019-09-04 18:32:11 +00:00
parent e55366be83
commit 5d0866bcea

@ -92,6 +92,7 @@ $v =
# handle being called [bsd.]progs.mk
.include <bsd.prog.mk>
.if !defined(_SKIP_BUILD)
# Find common sources among the PROGS to depend on them before building
# anything. This allows parallelization without them each fighting over
# the same objects.
@ -118,6 +119,7 @@ _PROGS_COMMON_OBJS+= ${_PROGS_COMMON_SRCS:N*.[dhly]:${OBJS_SRCS_FILTER:ts:}:S/$/
!empty(.MAKE.MODE:Mmeta)
${_PROGS_COMMON_OBJS}: .NOMETA
.endif
.endif
.if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
# tell progs.mk we might want to install things
@ -132,11 +134,6 @@ _PROG_MK.cleanobj= CLEANDEPENDFILES= CLEANDEPENDDIRS=
PROGS_TARGETS+= cleandir cleanobj
.endif
# Ensure common objects are built before recursing.
.if !empty(_PROGS_COMMON_OBJS)
${PROGS}: ${_PROGS_COMMON_OBJS}
.endif
.for p in ${PROGS}
.if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
# bsd.prog.mk may need to know this
@ -144,7 +141,7 @@ x.$p= PROG_CXX=$p
.endif
# Main PROG target
$p ${p}_p: .PHONY .MAKE
$p ${p}_p: .PHONY .MAKE ${_PROGS_COMMON_OBJS}
(cd ${.CURDIR} && \
DEPENDFILE=.depend.$p \
NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \
@ -152,7 +149,7 @@ $p ${p}_p: .PHONY .MAKE
# Pseudo targets for PROG, such as 'install'.
.for t in ${PROGS_TARGETS:O:u}
$p.$t: .PHONY .MAKE
$p.$t: .PHONY .MAKE ${_PROGS_COMMON_OBJS}
(cd ${.CURDIR} && \
DEPENDFILE=.depend.$p \
NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \