prevent some errors I've run into recently

- add ERRORS framework to bsd.port.subdir.mk
- trying to add a FLAVOR or a SUBPACKAGE to an intermediate SUBDIR is an
error (see editors/vim-spell,af recently)
- re-including bsd.port.mk/bsd.port.subdir.mk after either of them is an
error (can happen when one moves stuff to Makefile.inc without really thinking
about it, ends up with PKG_ARGS holding some contents twice and make package
erroring out with duplicate contents)
This commit is contained in:
espie 2012-01-21 14:44:40 +00:00
parent b4c9840ca6
commit 9971f34ba5
2 changed files with 34 additions and 2 deletions

View File

@ -1,6 +1,6 @@
#-*- mode: Makefile; tab-width: 4; -*-
# ex:ts=4 sw=4 filetype=make:
# $OpenBSD: bsd.port.mk,v 1.1155 2012/01/14 12:22:07 espie Exp $
# $OpenBSD: bsd.port.mk,v 1.1156 2012/01/21 14:44:40 espie Exp $
# $FreeBSD: bsd.port.mk,v 1.264 1996/12/25 02:27:44 imp Exp $
# $NetBSD: bsd.port.mk,v 1.62 1998/04/09 12:47:02 hubertf Exp $
#
@ -38,6 +38,13 @@ ERRORS += "Fatal: you're not allowed to override $t"
. endif
.endfor
.for f v in bsd.port.mk _BSD_PORT_MK bsd.port.subdir.mk _BSD_PORT_SUBDIR_MK
. if defined($v)
ERRORS += "Fatal: inclusion of bsd.port.mk from $f"
. endif
.endfor
_BSD_PORT_MK = Done
# The definitive source of documentation to this file's user-visible parts
# is bsd.port.mk(5).

View File

@ -1,7 +1,7 @@
#-*- mode: Makefile; tab-width: 4; -*-
# ex:ts=4 sw=4 filetype=make:
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
# $OpenBSD: bsd.port.subdir.mk,v 1.103 2011/12/12 14:52:02 espie Exp $
# $OpenBSD: bsd.port.subdir.mk,v 1.104 2012/01/21 14:44:40 espie Exp $
# FreeBSD Id: bsd.port.subdir.mk,v 1.20 1997/08/22 11:16:15 asami Exp
#
# The include file <bsd.port.subdir.mk> contains the default targets
@ -34,6 +34,21 @@
# tags
#
.if defined(FLAVOR)
ERRORS += "Fatal: can't flavor a SUBDIR"
.endif
.if defined(SUBPACKAGE)
ERRORS += "Fatal: can't subpackage a SUBDIR"
.endif
.for f v in bsd.port.mk _BSD_PORT_MK bsd.port.subdir.mk _BSD_PORT_SUBDIR_MK
. if defined($v)
ERRORS += "Fatal: inclusion of bsd.port.subdir.mk from $f"
. endif
.endfor
_BSD_PORT_SUBDIR_MK = Done
.if defined(verbose-show)
.MAIN: verbose-show
.elif defined(show)
@ -202,5 +217,15 @@ ${READMES_TOP}/${PKGPATH}/README.html:
${README} > $@
@rm ${TMPDIR}/subdirs
.if defined(ERRORS)
.BEGIN:
. for _m in ${ERRORS}
@echo 1>&2 ${_m} "(in ${PKGPATH})"
. endfor
. if !empty(ERRORS:M"Fatal\:*") || !empty(ERRORS:M'Fatal\:*')
@exit 1
. endif
.endif
.PHONY: ${_recursive_targets} \
${_recursive_depends_targets} clean readmes