1290650Shselasky
2322151Shselasky.if !defined(PORTSDIR)
3290650Shselasky# Autodetect if the command is being run in a ports tree that's not rooted
4290650Shselasky# in the default /usr/ports.  The ../../.. case is in case ports ever grows
5290650Shselasky# a third level.
6290650Shselasky.for RELPATH in . .. ../.. ../../..
7290650Shselasky.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
8290650Shselasky_PORTSDIR=	${.CURDIR}/${RELPATH}
9290650Shselasky.endif
10290650Shselasky.endfor
11290650Shselasky_PORTSDIR?=	/usr/ports
12290650ShselaskyPORTSDIR=	${_PORTSDIR:tA}
13290650Shselasky.endif
14290650Shselasky
15290650ShselaskyBSDPORTSUBDIRMK?=	${PORTSDIR}/Mk/bsd.port.subdir.mk
16290650Shselasky
17290650Shselasky.include "${BSDPORTSUBDIRMK}"
18290650Shselasky