Make sure the DTrace header files are built before depend and before

the build starts.

This adds a new variable DHDRS that contains a list of all DTrace
header files.  Then, we use the beforedepend hook to make sure the
heaeder files are built.

Introduce a beforebuild dependency (from projects/bmake) based on
feedback from Simon J. Gerraty.  This lets us generate the header
files without running make depend.

Reviewed by:	sjg, imp
MFC after:	3 days
This commit is contained in:
Rui Paulo 2014-08-13 01:27:51 +00:00
parent 3c6f0322bb
commit 9c851217b6
3 changed files with 7 additions and 2 deletions

View File

@ -129,6 +129,7 @@ CFLAGS+= -D_DTRACE_VERSION=1 -I${.OBJDIR}
.endif
.for _DSRC in ${SRCS:M*.d:N*/*}
.for _D in ${_DSRC:R}
DHDRS+= ${_D}.h
${_D}.h: ${_DSRC}
${DTRACE} -xnolibs -h -s ${.ALLSRC}
SRCS:= ${SRCS:S/${_DSRC}/${_D}.h/}
@ -148,6 +149,8 @@ ${_D}.po: ${_D}.h ${POBJS:S/${_D}.po//}
.endif
.endfor
.endfor
beforedepend: ${DHDRS}
beforebuild: ${DHDRS}
.endif
.if !target(depend)

View File

@ -118,7 +118,8 @@ PO_FLAG=-pg
${CC} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
all: objwarn
all: beforebuild .WAIT
beforebuild: objwarn
.if defined(PRIVATELIB)
_LIBDIR:=${LIBPRIVATEDIR}

View File

@ -159,7 +159,8 @@ MAN1= ${MAN}
.endif
.endif # defined(PROG)
all: objwarn ${PROG} ${SCRIPTS}
all: beforebuild .WAIT ${PROG} ${SCRIPTS}
beforebuild: objwarn
.if ${MK_MAN} != "no"
all: _manpages
.endif