8c10d39139
are generated for a target and output them all at once at the conclusion of the target's invocation. The implementation is in bsd.pkg.error.mk, which defines a macro target "error-check" that will print out any non-empty warning and error files in ${WARNING_DIR} and ${ERROR_DIR} and exit appropriately if there were errors. Convert some targets that were just long sequences of ${ERROR_MSG} or ${WARNING_MSG} within a single shell statement to use the new delayed error output via error-check. Modify the compiler "fail" wrappers for C++ and Fortran to be less verbose during invocation. Instead collect the warnings and only print them at the end of the completed phase, e.g. after "configure" and/or "build" completes.
70 lines
2.4 KiB
Makefile
70 lines
2.4 KiB
Makefile
# $NetBSD: check-wrkref.mk,v 1.4 2006/06/09 13:59:08 jlam Exp $
|
|
|
|
.if defined(PKG_DEVELOPER)
|
|
CHECK_WRKREF?= tools
|
|
.endif
|
|
CHECK_WRKREF?= no
|
|
|
|
###########################################################################
|
|
# CHECK_WRKREF_SKIP is a list of shell globs. Installed files that
|
|
# match these globs are skipped when running the check-wrkref target.
|
|
#
|
|
.if !defined(_CHECK_WRKREF_SKIP_FILTER)
|
|
_CHECK_WRKREF_SKIP_FILTER= ${TRUE}
|
|
. if defined(CHECK_WRKREF_SKIP) && !empty(CHECK_WRKREF_SKIP)
|
|
_CHECK_WRKREF_SKIP_FILTER= case "$$file" in
|
|
_CHECK_WRKREF_SKIP_FILTER+= ${_CHECK_WRKREF_SKIP_FILTER_BODY}
|
|
_CHECK_WRKREF_SKIP_FILTER+= *) ;;
|
|
_CHECK_WRKREF_SKIP_FILTER+= esac
|
|
. endif
|
|
.endif
|
|
.if !defined(_CHECK_WRKREF_SKIP_FILTER_BODY)
|
|
. for _pattern_ in ${CHECK_WRKREF_SKIP}
|
|
_CHECK_WRKREF_SKIP_FILTER_BODY+= ${_pattern_}) continue ;;
|
|
. endfor
|
|
.endif
|
|
MAKEVARS+= _CHECK_WRKREF_SKIP_FILTER_BODY
|
|
|
|
_CHECK_WRKREF:= ${CHECK_WRKREF}
|
|
.if !empty(_CHECK_WRKREF:Mwork)
|
|
_CHECK_WRKREF:= work # "work" is the "max" option
|
|
.endif
|
|
|
|
######################################################################
|
|
### check-wrkref (PRIVATE)
|
|
######################################################################
|
|
### check-wrkref verifies that the installed files are free of
|
|
### hard-coded references to the work directory.
|
|
###
|
|
.PHONY: check-wrkref
|
|
check-wrkref: error-check
|
|
@${STEP_MSG} "Checking for work-directory references in ${PKGNAME}"
|
|
.if !defined(NO_PKG_REGISTER)
|
|
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${ERROR_DIR}/${.TARGET}
|
|
${_PKG_SILENT}${_PKG_DEBUG} \
|
|
exec 1>${ERROR_DIR}/${.TARGET}; \
|
|
${PKG_FILELIST_CMD} | ${SORT} | \
|
|
while read file; do \
|
|
${_CHECK_WRKREF_SKIP_FILTER}; \
|
|
${SHCOMMENT} [$$file]; \
|
|
case ${_CHECK_WRKREF:Mwork:Q}"" in \
|
|
work) \
|
|
${GREP} ${WRKDIR} "$$file" 2>/dev/null | \
|
|
${SED} -e "s|^|$$file: |"; \
|
|
;; \
|
|
esac; \
|
|
case ${_CHECK_WRKREF:Mtools:Q}"" in \
|
|
tools) \
|
|
${GREP} ${TOOLS_DIR} "$$file" 2>/dev/null | \
|
|
${SED} -e "s|^|$$file: |"; \
|
|
;; \
|
|
esac; \
|
|
done
|
|
${_PKG_SILENT}${_PKG_DEBUG} \
|
|
exec 1>${ERROR_DIR}/${.TARGET}; \
|
|
if ${_NONZERO_FILESIZE_P} ${ERROR_DIR}/${.TARGET}; then \
|
|
${ECHO} "*** The above files still have references to the build directory."; \
|
|
${ECHO} " This is possibly an error that should be fixed by unwrapping"; \
|
|
${ECHO} " the files or adding missing tools to the package makefile!"; \
|
|
fi
|
|
.endif
|