summaryrefslogtreecommitdiff
path: root/mk/bsd.pkg.error.mk
diff options
context:
space:
mode:
authorjlam <jlam>2006-06-09 13:59:06 +0000
committerjlam <jlam>2006-06-09 13:59:06 +0000
commit7e84eca891de4df59bcecc961eb93715d7eadbdb (patch)
treebc3ee1d8414671473ac53f6468293fea0563cf1d /mk/bsd.pkg.error.mk
parent5e70459214d534d0a4a83a6745444816d8156296 (diff)
downloadpkgsrc-7e84eca891de4df59bcecc961eb93715d7eadbdb.tar.gz
Introduce the capability to gather all the warnings and errors that
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.
Diffstat (limited to 'mk/bsd.pkg.error.mk')
-rw-r--r--mk/bsd.pkg.error.mk53
1 files changed, 53 insertions, 0 deletions
diff --git a/mk/bsd.pkg.error.mk b/mk/bsd.pkg.error.mk
new file mode 100644
index 00000000000..4c744e5a1a1
--- /dev/null
+++ b/mk/bsd.pkg.error.mk
@@ -0,0 +1,53 @@
+# $NetBSD: bsd.pkg.error.mk,v 1.1 2006/06/09 13:59:06 jlam Exp $
+
+ERROR_DIR= ${WRKDIR}/.error
+WARNING_DIR= ${WRKDIR}/.warning
+
+makedirs: ${ERROR_DIR} ${WARNING_DIR}
+${ERROR_DIR} ${WARNING_DIR}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET}
+
+.PHONY: error-check
+
+######################################################################
+### error-check (PRIVATE)
+######################################################################
+### error-check is a macro target that will peek in the warning and
+### error directories to check for the presence of any files. If they
+### exist and are non-empty, then they are assumed to be message files
+### and will be outputted then removed. If they are from the error
+### directory, then the target will fail.
+###
+error-check: .USE
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${RM} -f ${WARNING_DIR}/*.tmp; \
+ ${TEST} -d ${WARNING_DIR} || exit 0; \
+ cd ${WARNING_DIR}; \
+ for file in ./*; do \
+ ${TEST} "$$file" != "./*" || exit 0; \
+ break; \
+ done; \
+ ${CAT} ./* | ${WARNING_CAT}; \
+ ${RM} -f ./*
+
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${RM} -f ${ERROR_DIR}/*.tmp; \
+ ${TEST} -d ${ERROR_DIR} || exit 0; \
+ cd ${ERROR_DIR}; \
+ for file in ./*; do \
+ ${TEST} "$$file" != "./*" || exit 0; \
+ break; \
+ done; \
+ ${CAT} * | ${ERROR_CAT}; \
+ if ${_NONZERO_FILESIZE_P} ./*; then \
+ ${RM} -f ./*; \
+ exit 1; \
+ fi
+
+######################################################################
+### error-clean (PRIVATE)
+######################################################################
+### error-clean removes the error and warning directory and files.
+###
+error-clean:
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -fr ${ERROR_DIR} ${WARNING_DIR}