I started uisng strace, and you are right, it does what I want. But
it is just too slow for my purpose: I want to record all
dependencies, intermediates and results of an arbitrary build
process to automatically record the build's dependencies. On
subsequent runs of the build, these depencencies could then be used
to decide which compoments must be rebuilt due to changed
dependencies.