1 # $NetBSD: bsd.pkg.error.mk,v 1.3 2006/10/06 19:05:43 rillig Exp $
3 ERROR_DIR
= ${WRKDIR}/.error
4 WARNING_DIR
= ${WRKDIR}/.warning
5 _ERROR_DONE_DIR
= ${WRKDIR}/.error-done
6 _WARNING_DONE_DIR
= ${WRKDIR}/.warning-done
8 # Macros for outputting delayed error and warning messages that are
9 # picked up by the error-check target and can be used in place of
10 # ${ECHO}. We output to files that are named without leading dots.
12 DELAYED_ERROR_MSG?
= ${ECHO} >> ${ERROR_DIR}/${.TARGET
:T
:C
/^
[.
]*//:Q
}
13 DELAYED_WARNING_MSG?
= ${ECHO} >> ${WARNING_DIR}/${.TARGET
:T
:C
/^
[.
]*//:Q
}
15 makedirs
: ${ERROR_DIR} ${WARNING_DIR} ${_ERROR_DONE_DIR} ${_WARNING_DONE_DIR}
16 ${ERROR_DIR} ${WARNING_DIR} ${_ERROR_DONE_DIR} ${_WARNING_DONE_DIR}:
17 ${RUN}${MKDIR} ${.TARGET
}
21 ######################################################################
22 ### error-check (PRIVATE)
23 ######################################################################
24 ### error-check is a macro target that will peek in the warning and
25 ### error directories to check for the presence of any files. If they
26 ### exist and are non-empty, then they are assumed to be message files
27 ### and will be outputted then removed. If they are from the error
28 ### directory, then the target will fail.
32 ${RM} -f
${WARNING_DIR}/*.tmp
; \
33 ${TEST} -d
${WARNING_DIR} || exit
0; \
36 ${TEST} "$$file" != "./*" || exit
0; \
39 ${CAT} .
/* |
${WARNING_CAT}; \
40 ${MV} -f .
/* ${_WARNING_DONE_DIR}
43 ${RM} -f
${ERROR_DIR}/*.tmp
; \
44 ${TEST} -d
${ERROR_DIR} || exit
0; \
47 ${TEST} "$$file" != "./*" || exit
0; \
50 ${CAT} * |
${ERROR_CAT}; \
51 if
${_NONZERO_FILESIZE_P} .
/*; then \
52 ${MV} -f .
/* ${_ERROR_DONE_DIR}; \
56 ######################################################################
57 ### error-clean (PRIVATE)
58 ######################################################################
59 ### error-clean removes the error and warning directory and files.
62 ${RUN}${RM} -fr
${ERROR_DIR} ${WARNING_DIR}