xref: /freebsd/share/mk/bsd.port.subdir.mk (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1# $FreeBSD$
2
3.if !defined(PORTSDIR)
4# Autodetect if the command is being run in a ports tree that's not rooted
5# in the default /usr/ports.  The ../../.. case is in case ports ever grows
6# a third level.
7.for RELPATH in . .. ../.. ../../..
8.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
9_PORTSDIR=	${.CURDIR}/${RELPATH}
10.endif
11.endfor
12_PORTSDIR?=	/usr/ports
13.if defined(.PARSEDIR)
14PORTSDIR=	${_PORTSDIR:tA}
15.else # fmake doesn't have :tA
16PORTSDIR!=	realpath ${_PORTSDIR}
17.endif
18.endif
19
20BSDPORTSUBDIRMK?=	${PORTSDIR}/Mk/bsd.port.subdir.mk
21
22.include "${BSDPORTSUBDIRMK}"
23