3 # Autodetect if the command is being run in a ports tree that's not rooted
4 # in the default /usr/ports. The ../../.. case is in case ports ever grows
6 .for RELPATH in . .. ../.. ../../..
7 .if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
8 _PORTSDIR= ${.CURDIR}/${RELPATH}
11 _PORTSDIR?= /usr/ports
12 .if defined(.PARSEDIR)
13 PORTSDIR= ${_PORTSDIR:tA}
14 .else # fmake doesn't have :tA
15 PORTSDIR!= realpath ${_PORTSDIR}
19 BSDPORTSUBDIRMK?= ${PORTSDIR}/Mk/bsd.port.subdir.mk
21 .include "${BSDPORTSUBDIRMK}"