170459Speter# $FreeBSD$
270459Speter
3272282Swill.if !defined(PORTSDIR)
4272282Swill# Autodetect if the command is being run in a ports tree that's not rooted
5272282Swill# in the default /usr/ports.  The ../../.. case is in case ports ever grows
6272282Swill# a third level.
7272383Swill.for RELPATH in . .. ../.. ../../..
8272383Swill.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
9272383Swill_PORTSDIR=	${.CURDIR}/${RELPATH}
10272282Swill.endif
11272383Swill.endfor
12272383Swill_PORTSDIR?=	/usr/ports
13287436Sbdrewery.if defined(.PARSEDIR)
14287436SbdreweryPORTSDIR=	${_PORTSDIR:tA}
15287436Sbdrewery.else # fmake doesn't have :tA
16272383SwillPORTSDIR!=	realpath ${_PORTSDIR}
17272282Swill.endif
18287436Sbdrewery.endif
19272282Swill
20131482SeikBSDPORTMK?=	${PORTSDIR}/Mk/bsd.port.mk
2195027Sru
22164411Sru# Needed to keep bsd.own.mk from reading in /etc/src.conf
23164411Sru# and setting MK_* variables when building ports.
24164411Sru_WITHOUT_SRCCONF=
25161583Sobrien
26206082Snetchild# Enable CTF conversion on request.
27206082Snetchild.if defined(WITH_CTF)
28206082Snetchild.undef NO_CTF
29206082Snetchild.endif
30206082Snetchild
3195027Sru.include <bsd.own.mk>
32131482Seik.include "${BSDPORTMK}"
33