Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Nov 2015 09:37:08 -0800
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        "current@freebsd.org" <current@freebsd.org>, arch@FreeBSD.org
Subject:   bsd.subdir.mk: Recursing on dependent targets
Message-ID:  <56437CC4.9050103@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56437CC4.9050103>