help-make
[Top][All Lists]
Advanced

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

Re: Problem regenerating file removed by rule


From: Boris Kolpackov
Subject: Re: Problem regenerating file removed by rule
Date: Thu, 7 Apr 2005 15:28:17 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

"Darren Hiebert (Contractor)" <address@hidden> writes:

> To demonstrate the problem, issue the following commands using the
> makefile below:
>
> $ make -j
> $ touch source
> $ make -j
>
> The problem is that the the config.sh created by the first
> invocation of make is removed by the third-party compiler during the
> second invocation of make, and make does not rebuild it from the
> existing rules, even though I have a dependency to create it again
> after the third-party compiler runs

First thing, in your script that emulates your compiler there is nothing
that deletes config.sh. Let's assume that it does delete it however.

The general rule is that if you do something behind make's back all
sorts of bad things happen. In your case, the rule deletes the file
that make is keeping track of; make has no idea this happened and
there is no way to tell make about this.

I think your best bet is to try and make the situation as close
to the fact that config.sh hasn't been deleted as possible. First
thing to do is backup the config.sh before executing the compiler
and then restore it, something like this.


epr: source
        cp config.sh config.sh.backup
        $(third_party_compiler)
        mv config.sh.backup config.sh

The second thing you need to do is to make sure none of the rules
that depend on config.sh run during the execution of your compiler
(happens when make -j ); they can run before or after. You can use
order-only prerequisites for that. Undoubtfully, the whole thing
will be very messy.


-boris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]