Date: Thu, 28 Jul 2011 21:55:00 +0100 From: Chris Rees <crees@freebsd.org> 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: <CADLo839nxJPNOUN5Tg3cejK3-MySnNj_%2Bb8PAKWdZVujP=iebQ@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 28 July 2011 19:47, Mikhail T. <mi+thun@aldan.algebra.com> wrote: > 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? > > =A0 -mi Not too convinced I'm afraid-- in the logs I can at least see at a glance where ${CURDIR} is, and how many directories it's traversing etc etc. Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADLo839nxJPNOUN5Tg3cejK3-MySnNj_%2Bb8PAKWdZVujP=iebQ>