tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make: who included me?

Just addressing a couple of comments.

1/ it goes without saying that such a feature if added would be

2/ the intended usage was for more than debugging

The use case ( is admittedly a very complex requirement.
However this one rather complex makefile allows for a very elegant
solution to the building of complex trees, where directory and machine
dependencies need to be blended.

I believe I've found a solution without altering make.

Background for those interested:

I have several thousand Makefile.depend* files which uses to
allow parallel build in a clean tree, starting from pretty much
anywhere to build everything needed (and only that which is needed) by
that starting point - which could be the entire tree or just bin/cat
depending on the start point.

Except for a few (<100) those files are all autogenerated and
updated - which is good - reduces build breaks by at least 60%.    
The autogenerated files are all named
Makefile.depend.${MACHINE} and can know what
machine something needs to be built because these files set

The corner cases are manually maintained and typically
define pseudo targets. In such cases the exact same info is needed regardless
of the machine the target is to be built for.
To reduce manual maintenance, and to help make the distinction obvious 
we name these files without the .${MACHINE} extension. Ie. Makefile.depend

But that introduced a potential problem - if one of these manually
maintained files failed to set DEP_MACHINE = ${.PARSEFILE:E} (or
something more useful), could take the seemingly useless
value of "depend" as a clue.

Anyway the following, addresses the issue:

_last_dependfile := ${.MAKE.MAKEFILES:M*/${.MAKE.DEPENDFILE:T:R}*:[-1]}
.if ${_last_dependfile:E} == "depend"
# don't rely on manually maintained files to be correct

It is not a general solution - but then neither is the problem ;-)


Home | Main Index | Thread Index | Old Index