New private target sanity-check-depends for checking DEPENDS,

BUILD_DEPENDS, TOOL_DEPENDS and CONFLICTS for correctness
(>x.y.* like patterns). This check is run in the beginning
of "depend" target.
This commit is contained in:
cheusov 2014-01-14 10:52:12 +00:00
parent 5debe19e0c
commit ac03da9d84

View file

@ -1,4 +1,4 @@
# $NetBSD: depends.mk,v 1.16 2011/10/15 00:23:08 reed Exp $
# $NetBSD: depends.mk,v 1.17 2014/01/14 10:52:12 cheusov Exp $
######################################################################
### depends (PUBLIC)
@ -6,6 +6,7 @@
### depends is a public target to install missing dependencies for
### the package.
###
_DEPENDS_TARGETS+= sanity-check-depends
_DEPENDS_TARGETS+= acquire-depends-lock
_DEPENDS_TARGETS+= ${_COOKIE.depends}
_DEPENDS_TARGETS+= release-depends-lock
@ -62,3 +63,26 @@ depends-message:
.PHONY: pre-depends-hook
pre-depends-hook:
@${DO_NADA}
######################################################################
### sanity-check-depends (PRIVATE)
######################################################################
### sanity-check-depends is a private target to check that DEPENDS,
### TOOL_DEPENDS, BUILD_DEPENDS and CONFLICTS contain correct values
###
_SANITY_CHECK_DEPENDS_CMD=${AWK} ' \
match($$1, /[<>][^,{}]*[*?\[\]]/) { \
sub(/:[^{}]*$$/, "", $$1); \
print "Incorrect dependency: " $$1; \
ex=1 \
} \
END { exit ex }'
.PHONY: sanity-check-depends
sanity-check-depends:
@{ ${DEPENDS:@.temp.@echo '${.temp.}';@} \
${BUILD_DEPENDS:@.temp.@echo '${.temp.}';@} \
${TOOL_DEPENDS:@.temp.@echo '${.temp.}';@} \
${CONFLICTS:@.temp.@echo '${.temp.}';@} \
} | ${_SANITY_CHECK_DEPENDS_CMD}