This question grew out of my earlier question (and discussion in comments to it) on my use of make
-based build environment for R
-based scientific research software project (for my Ph.D. dissertation): make always rebuilds Makefile targets.
Following recommendation of @MadScentist, I created this question to clarify the following aspect of the my build environment. Since I use Makefile
files in almost all sub-directories of my project, I've experienced the problem of correct specification for my research workflow dependencies. While the workflow itself is pretty standard (data collection => data preparation (transform, cleanup, merge, sample) => data analysis => results presentation), the issue IMHO stems from the need to specify build dependencies between artifacts, located in different directories (and of different types, i.e. single intermediate file depends on a set of data files, etc.). I haven't found anywhere any documentation or clear explanation of a solution to this problem.
Your help is greatly appreciated!
UPDATE: Re-phrased the title of the question to clarify the problem.
There isn't a solution to this problem as far as I'm aware. This is why the reason the 'Recursive Make Considered Harmful' paper was written in the first place.
If you need inter-directory dependency relationships on an object level then you can't use per-directory Makefile:s this way. With per-directory makefile:s you only have manually synchronized ordering of running of make commands. (You could probably fake at least some amount of as-needed building by using stamp files per-target per-directory and forwarding rules in each makefile but it will likely get ugly and unwieldy rather quickly, and might not work with multiple directories at any given level.)