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>
index | next in thread | raw e-mail
[-- Attachment #1 --]
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.
Consider:
SUBDIR_TARGETS= 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
===> bsdiff/subdir (buildconfig)
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff/subdir
===> bsdiff/subdir (buildconfig)
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff/subdir
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff/subdir
Full:
~/svn/base/usr.bin/bsdiff # make all
===> bsdiff (buildconfig)
===> bsdiff/subdir (buildconfig)
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff/subdir
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff
===> bspatch (buildconfig)
buildconfig=/root/svn/base/usr.bin/bsdiff/bspatch
buildconfig=/root/svn/base/usr.bin/bsdiff
===> bsdiff (all)
===> bsdiff/subdir (buildconfig)
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff/subdir
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff
===> bsdiff/subdir (all)
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff/subdir
===> bspatch (all)
buildconfig=/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=/root/svn/base/usr.bin/bsdiff/bsdiff/subdir
~/svn/base/usr.bin/bsdiff # make all
buildconfig=/root/svn/base/usr.bin/bsdiff
===> bsdiff (all)
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff
===> bsdiff/subdir (all)
buildconfig=/root/svn/base/usr.bin/bsdiff/bsdiff/subdir
===> bspatch (all)
buildconfig=/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.
--
Regards,
Bryan Drewery
[-- Attachment #2 --]
-----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-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56437CC4.9050103>
