How to resolve implicit dependencies

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

How to resolve implicit dependencies

Adrian Muresan
I have a makefile(s) that runs fine with --jobs=1 but when I run with --jobs=X (X>1) it fails.

I know exactly why; it's because I have entries like this:


t1:

    mkdir d1

    create_makefile.bat > ./d1/makefile


t2:

    cd d1

    make -f makefile


Target t2 depends on t1 but that's not stated in the makefile.

With -j1, this runs fine (because of the order of the targets in the makefile).

However with -jX X>1, I eventually get an error due to race conditions.


I have dozens of makefiles so I need an automated solution to detect these implicit dependencies.


The `--print-data-base` doesn't help me because make doesn't detect filesystem-level actions i.e.

the `--print-data-base` entry for `t1` won't tell me that `t1` created a directory `d1` and a makefile `./d1/makefile` and yes,

I understand that this functionality is outside the scope of `make` but hoping that someone has an idea how to solve this.


What I need is an OS utility that will detect every read/write action my build performs AND the ability to attribute

those filesystem-level operations to the makefile target that performs them.


I'm in Windows so I found Sysinternals Process Monitor


https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx


but I still need to figure out how to synchronize the two (make and process monitor).

Process monitor outputs every single event with microsecond accuracy but I have no way of timestamping my targets.


Anyone have a more elegant solution?


There exists a paid solution already - Huddle by Electric-Cloud - but would be nice for a free one also.



_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: How to resolve implicit dependencies

Tony Theodore

> On 15 Jul 2016, at 01:46, Adrian Muresan <[hidden email]> wrote:
>
[…]
>
> What I need is an OS utility that will detect every read/write action my build performs AND the ability to attribute
>
> those filesystem-level operations to the makefile target that performs them.

Not exactly an OS utility, but Git can track filesystem operations, attribute them to a target, and help with re-ordering builds to find undeclared dependencies. The basic idea is to build each target in a branch with it’s declared dependencies as parents. Then run a second pass with undeclared targets `checked out` prior to build and compare the results[1].

A simpler first pass could be to simply build each target with a commit and compare the files changed between commits.

Cheers,

Tony


[1] https://github.com/mxe/mxe/issues/1111


_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make