Restore cleaning of auto-generated kobj files after the recent MFILES

changes.  Use the list of MFILES found by find to identify the set of
possible auto-generated files and add the intersection of this set and
SRCS to CLEANFILES.

Submitted by:	imp (previous version), sbruno
Differential Revision:	https://reviews.freebsd.org/D4336
This commit is contained in:
jhb 2015-12-01 21:19:16 +00:00
parent 39ac22cb40
commit 5398e8ab98
2 changed files with 10 additions and 7 deletions

View File

@ -206,9 +206,8 @@ SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
SYSTEM_DEP+= ${LDSCRIPT}
# Calculate path for .m files early, if needed.
.if !defined(_MPATH)
.if !defined(__MPATH)
__MPATH!=find ${S:tA}/ -name \*_if.m
_MPATH=${__MPATH:H:O:u}
.endif
# MKMODULESENV is set here so that port makefiles can augment
@ -227,7 +226,7 @@ MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
.if defined(DEBUG)
MKMODULESENV+= DEBUG_FLAGS="${DEBUG}"
.endif
MKMODULESENV+= _MPATH="${_MPATH}"
MKMODULESENV+= __MPATH="${__MPATH}"
# Architecture and output format arguments for objdump to convert image to
# object file

View File

@ -370,14 +370,18 @@ vnode_if_typedef.h:
.endif
# Build _if.[ch] from _if.m, and clean them when we're done.
.if !defined(_MPATH)
.if !defined(__MPATH)
__MPATH!=find ${SYSDIR:tA}/ -name \*_if.m
_MPATH=${__MPATH:H:O:u}
.endif
_MFILES=${__MPATH:T:O}
_MPATH=${__MPATH:H:O:u}
.PATH.m: ${_MPATH}
.for _i in ${SRCS:M*_if.[ch]}
#removes too much, comment out until it's more constrained.
#CLEANFILES+= ${_i}
_MATCH=M${_i:R:S/$/.m/}
_MATCHES=${_MFILES:${_MATCH}}
.if !empty(_MATCHES)
CLEANFILES+= ${_i}
.endif
.endfor # _i
.m.c: ${SYSDIR}/tools/makeobjops.awk
${AWK} -f ${SYSDIR}/tools/makeobjops.awk ${.IMPSRC} -c