bsd.subdir.mk: Recursing on dependent targets

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

bsd.subdir.mk: Recursing on dependent targets

Bryan Drewery-6
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


signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: bsd.subdir.mk: Recursing on dependent targets

Julian H. Stacey-3
Hi Bryan & all,
I'm in a rush so will read yours again later, but will quickly mention
I've long ago added a load of *-recursive macros to my Mk/
but never submitted them, they are under
http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/ports/gen/Mk/

(but it seems something in apache httpd.conf is truncing file names,
which should appear as eg
bsd.port.subdir.mk.reinstall-recursive.REL=8.2-RELEASE.diff
etc )

Cheers,
Julian
--
Julian Stacey,  BSD Linux Unix Sys. Eng. Consultant Munich http://berklix.com
 Reply After previous text to preserve context, as in a play script.
 Indent previous text with > Insert new lines before 80 chars.
 Use plain text, Not quoted-printable, Not HTML, Not base64, Not MS.doc.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: bsd.subdir.mk: Recursing on dependent targets

Bryan Drewery-6
On 11/11/2015 9:50 AM, Julian H. Stacey wrote:

> Hi Bryan & all,
> I'm in a rush so will read yours again later, but will quickly mention
> I've long ago added a load of *-recursive macros to my Mk/
> but never submitted them, they are under
> http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/ports/gen/Mk/
>
> (but it seems something in apache httpd.conf is truncing file names,
> which should appear as eg
> bsd.port.subdir.mk.reinstall-recursive.REL=8.2-RELEASE.diff
> etc )
>
This should not be impacted since it does not use bsd.subdir.mk. I'm not
planning to modify bsd.port.subdir.mk at all.


--
Regards,
Bryan Drewery


signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: bsd.subdir.mk: Recursing on dependent targets

Bryan Drewery-6
In reply to this post by Bryan Drewery-6
On 11/11/2015 9:37 AM, Bryan Drewery wrote:
>
> With the change I would like to make, to only recurse on *called*
> targets

This also has the benefit of no longer having 'realinstall' be a thing
that bsd.subdir.mk needs to care about. Just recursing 'install' would
handle all of the ordering and targets in each subdir.

--
Regards,
Bryan Drewery


signature.asc (484 bytes) Download Attachment