mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-20 15:26:43 +01:00
6cc777bf8b
This has the side effect of ensuring that realpath is also run for the nominal case of PORTSDIR=/usr/ports (assuming .CURDIR is a ports directory that relies on /usr/ports but is not rooted in it). This ensures that any generated PORTSDIR used is always the actual location. Submitted by: jkim (different implementation)
19 lines
507 B
Makefile
19 lines
507 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.
|
|
.for RELPATH in . .. ../.. ../../..
|
|
.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
|
|
_PORTSDIR= ${.CURDIR}/${RELPATH}
|
|
.endif
|
|
.endfor
|
|
_PORTSDIR?= /usr/ports
|
|
PORTSDIR!= realpath ${_PORTSDIR}
|
|
.endif
|
|
|
|
BSDPORTSUBDIRMK?= ${PORTSDIR}/Mk/bsd.port.subdir.mk
|
|
|
|
.include "${BSDPORTSUBDIRMK}"
|