From owner-freebsd-arch@freebsd.org Wed Nov 11 17:37:12 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F162A2CFF1 for ; Wed, 11 Nov 2015 17:37:12 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id E5E2415E3 for ; Wed, 11 Nov 2015 17:37:11 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: by mailman.ysv.freebsd.org (Postfix) id E20B6A2CFEF; Wed, 11 Nov 2015 17:37:11 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C79BFA2CFED; Wed, 11 Nov 2015 17:37:11 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id A969315E1; Wed, 11 Nov 2015 17:37:11 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 9E9C81D10; Wed, 11 Nov 2015 17:37:11 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 6D0391250E; Wed, 11 Nov 2015 17:37:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 2yTal8NQwY8S; Wed, 11 Nov 2015 17:37:09 +0000 (UTC) To: "current@freebsd.org" , arch@FreeBSD.org DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com EB78712507 From: Bryan Drewery Subject: bsd.subdir.mk: Recursing on dependent targets Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc X-Enigmail-Draft-Status: N1110 Organization: FreeBSD Message-ID: <56437CC4.9050103@FreeBSD.org> Date: Wed, 11 Nov 2015 09:37:08 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3pDErRMH1A8x7NxdsecQfmlnxeOBSodaB" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2015 17:37:12 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3pDErRMH1A8x7NxdsecQfmlnxeOBSodaB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable The current behavior of bsd.subdir.mk has a very surprising behavior that I think is wrong and think that changing it will have no real impact= =2E Consider: SUBDIR_TARGETS=3D all foo all: foo If you call 'make foo' it will recurse 'foo' on all sub-directories as expected. If you call 'make all' it will recurse 'foo' in all sub-directories and then recurse 'all' in all sub-directories which then again calls 'foo' in sub-directories! So technically 'foo' is called 3 times in some directories do to 'all' implicitly calling it as well. Here's a contrived example with 'all' and 'buildconfig' which is prone to this problem now. ~/svn/base/usr.bin/bsdiff # make all|grep buildconfig|grep bsdiff/subdir =3D=3D=3D> bsdiff/subdir (buildconfig) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff/subdir =3D=3D=3D> bsdiff/subdir (buildconfig) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff/subdir buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff/subdir Full: ~/svn/base/usr.bin/bsdiff # make all =3D=3D=3D> bsdiff (buildconfig) =3D=3D=3D> bsdiff/subdir (buildconfig) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff/subdir buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff =3D=3D=3D> bspatch (buildconfig) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bspatch buildconfig=3D/root/svn/base/usr.bin/bsdiff =3D=3D=3D> bsdiff (all) =3D=3D=3D> bsdiff/subdir (buildconfig) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff/subdir buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff =3D=3D=3D> bsdiff/subdir (all) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff/subdir =3D=3D=3D> bspatch (all) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bspatch With the change I would like to make, to only recurse on *called* targets, the result is: ~/svn/base/usr.bin/bsdiff # make all|grep buildconfig|grep bsdiff/subdir buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff/subdir ~/svn/base/usr.bin/bsdiff # make all buildconfig=3D/root/svn/base/usr.bin/bsdiff =3D=3D=3D> bsdiff (all) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff =3D=3D=3D> bsdiff/subdir (all) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bsdiff/subdir =3D=3D=3D> bspatch (all) buildconfig=3D/root/svn/base/usr.bin/bsdiff/bspatch The potential problem I see with this is if someone has some top-level target like 'buildit' that is not in SUBDIR_TARGETS but it depends on targets which are in SUBDIR_TARGETS, such as 'all'. This would now no longer recurse on those. I think this would be worth an UPDATING entry that 'buildit' needs to be added into SUBDIR_TARGETS or called explicitly with ${MAKE}, but I also want to be sure I'm not missing something here about this being 'expected behavior'. From my own experience I don't expect this to be an actual problem. --=20 Regards, Bryan Drewery --3pDErRMH1A8x7NxdsecQfmlnxeOBSodaB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJWQ3zEAAoJEDXXcbtuRpfPMn8H/RZy2gu4yvZoERgF4ys6eiWu 2K8o4SXinpBvekTzsPkGZ7gq+wKJFHanOp0WKUIP0wFdtVDukC/wuDIpS69ksO3d kfh/QfAGP039GKq5qeKtKI894EB6TZL2TZydZbB6D6Mwt8KS1KtzlFeBCu9b2eKL 9mRw2cqRwGksBGwFx6MowGW5hgXwfz2RAwz/TNO9dRR4hvR7SFWTs/JRLNAYfO/C HoabhSScGS+wS1VP3BpuMzPaPKvZU9eayT88xqR1wsQiM8T3Z2z+FbGCVLPplndl wYrF7drLJxWX+W4bLnYxuhCdXijKdYDT53c74UVYXHQpbEispkygAKGEwN8Dxfw= =Btk/ -----END PGP SIGNATURE----- --3pDErRMH1A8x7NxdsecQfmlnxeOBSodaB--