Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jul 2011 15:05:12 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        "Mikhail T." <mi+thun@aldan.algebra.com>
Cc:        hackers@freebsd.org
Subject:   Re: A style proposal for referring to upper-level directories in Makefiles
Message-ID:  <CAGH67wR--SBJ2Y4-NG-iJQWZBfbKC__7h-tQOXvmR1WApa-t-A@mail.gmail.com>
In-Reply-To: <4E31AED9.4000105@aldan.algebra.com>
References:  <4E31AED9.4000105@aldan.algebra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 28, 2011 at 11:47 AM, Mikhail T. <mi+thun@aldan.algebra.com> wr=
ote:
> The most common method to refer to the upper directory in Makefile is as
> ${.CURDIR}/..
>
> I'd like to propose we begin using ${.CURDIR:H} instead. For one this spe=
eds
> up the filesystem-traversal for the invoked tool. And, perhaps more
> importantly, it makes the various build-logs look nicer (and be smaller).
> The lines in Makefiles will also be shorter (two characters per level
> instead of three). For example:
>
> =A0 --- secure/Makefile.inc 3 Aug 2009 08:13:06 -0000 =A0 =A0 =A0 1.25.10=
.1
> =A0 +++ secure/Makefile.inc 28 Jul 2011 18:45:52 -0000
> =A0 @@ -3,8 +3,8 @@
> =A0 =A0 .include <bsd.own.mk>
>
> =A0 -.if exists(${.CURDIR}/../../lib/libcrypt/obj)
> =A0 -CRYPTOBJDIR=3D =A0 ${.CURDIR}/../../lib/libcrypt/obj
> =A0 +.if exists(${.CURDIR:H:H}/lib/libcrypt/obj)
> =A0 +CRYPTOBJDIR=3D =A0 ${.CURDIR:H:H}/lib/libcrypt/obj
> =A0 =A0 .else
> =A0 -CRYPTOBJDIR=3D =A0 ${.CURDIR}/../../lib/libcrypt
> =A0 +CRYPTOBJDIR=3D =A0 ${.CURDIR:H:H}/lib/libcrypt
> =A0 =A0 .endif
>
> =A0 @@ -14,4 +14,4 @@
>
> =A0 =A0 .if ${MK_OPENSSH} !=3D "no"
> =A0 -SSHDIR=3D =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0${.CURDIR}/../../../crypto/=
openssh
> =A0 +SSHDIR=3D =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0${.CURDIR:H:H:H}/crypto/ope=
nssh
> =A0 =A0 .endif
>
> The new method is functionally equivalent to the old and I see no drawbac=
ks
> to it, do you?

    This might cause issues with symlink traversal (it's the one thing
that came to mind). It wouldn't be a standard way to do things, but it
could cause problems if this change was made.
Thanks,
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wR--SBJ2Y4-NG-iJQWZBfbKC__7h-tQOXvmR1WApa-t-A>