Hi,
I came up with a solution to this long-lasting, largely-talked problem of recursive make invocation.
I also have a patched GNU make build that can be a live proof that it actually works.
First I thought of a smart "include" directive, that would isolate the included makefile's variable
space, I called it "import". The isolation is acomplished with the use of global stack of
variable_sets. I had to modify variable.c a little bit in order to facilitate global variable stack.
The second issue I had to bare with was working directory. If one imports another makefile that is
in another directory, the directory is pushed to a stack and all filenames defined in the imported
makefile are prefixed with the directory name, in order to make the DAG coherent. Some tweaks in
read.c made it possible.
This solution enables definition of full DAG across multiple makefiles and
directories.
When recipes are executed, actions are taken to ensure that they start in the right working
directory and automatic file variables are defined as they should (relative to the right dir).
After a few more tweaks here and there I made it work.
The imported makefiles don't have to be designed specially to work with this solution. If you have a
running project with recursive make invocations, just replace them with import directives and the
DAG will get stitched altogether.
I think this solution is worth to incorporate into GNU make main codeline. I'm sure it needs some
fixes around the edges, but it works as a proof of concept.
Paul, if you are interested I would be happy to share the code.
Kamil
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make