[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Intermediate files are not being rebuilt
From: |
Paul D. Smith |
Subject: |
Re: Intermediate files are not being rebuilt |
Date: |
Thu, 27 Jan 2005 09:55:01 -0500 |
%% "Simon De Groot" <address@hidden> writes:
sdg> Now, if I delete sub1, it will not be rebuilt the next time I run make:
csh> rm sub1
csh> make
sdg> make: Nothing to be done for `all'.
sdg> Without the .SECONDARY target, sub1 and sub2 are deleted
sdg> altogether after each run.
sdg> I'm not used to this behavior when I was using Solaris' make. Is
sdg> there a way to enforce that prerequisites are forced to be
sdg> rebuilt?
Read up on intermediate files in the GNU make manual. Since you never
reference those files directly, make considers them to be intermediate
files which are not themselves required, but only used as a stepping
stone to a different target. So, if A -> B -> C, and if B is not
required as a final target, and if A is older than C, then make won't
create B even if it doesn't exist, since C doesn't need to be updated.
If make DID create B, then it would have to recreate C (since B is
newer) and since A has not been changed (and B is not required) there's
no reason to do that.
Anyway, any explicit reference to the file in the makefile causes a
target to be considered not precious.
So, you can just add in:
all: sub1 sub2
or even "foo: sub1 sub2".
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist