freebsd-skq/share/mk/bsd.port.subdir.mk
will 2a6acc2651 Always resolve PORTSDIR to absolute paths using realpath(1).
Reported by:	madpilot
Reviewed by:	bapt
X-MFC-With:	272282
2014-10-01 15:02:37 +00:00

23 lines
647 B
Makefile

# $FreeBSD$
.if !defined(PORTSDIR)
# Autodetect if the command is being run in a ports tree that's not rooted
# in the default /usr/ports. The ../../.. case is in case ports ever grows
# a third level.
.if exists(${.CURDIR}/Mk/bsd.port.mk)
PORTSDIR!= realpath ${.CURDIR}
.elif exists(${.CURDIR}/../Mk/bsd.port.mk)
PORTSDIR!= realpath ${.CURDIR}/..
.elif exists(${.CURDIR}/../../Mk/bsd.port.mk)
PORTSDIR!= realpath ${.CURDIR}/../..
.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk)
PORTSDIR!= realpath ${.CURDIR}/../../..
.else
PORTSDIR= /usr/ports
.endif
.endif
BSDPORTSUBDIRMK?= ${PORTSDIR}/Mk/bsd.port.subdir.mk
.include "${BSDPORTSUBDIRMK}"