help-make
[Top][All Lists]
Advanced

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

INTERMEDIATE and include files


From: Saurabh T
Subject: INTERMEDIATE and include files
Date: Wed, 13 Oct 2010 17:39:10 +0000

The following is a simple Makefile that demonstrates the problem I'm facing:

a.out: tmp hw.o
        cc hw.o

include tmp
.INTERMEDIATE: tmp

tmp:
        echo -e "hw.o: hw.c\n\tcc -o hw.o -c hw.c" >$@


hw.c exists and compiles (it's a hello world).

What I want to happen is tmp is built, hw.o is built, a.out is built, tmp is 
removed.
What happens is make goes into an infinite loop doing just the tmp target.

The behaviour is the same if a.out does not depend on tmp. I added that 
dependency because I thought it would make the rm happen after a.out is made 
but that's not the case.

(Removing the INTERMEDIATE works successfully but of course tmp remains which 
is what I dont want).

What am I doing wrong and how to fix it? Thanks,
saurabh

PS: As mentioned this Makefile is deliberately simple for demo purposes,
 so responders whose sole insight would be to ask why do you need an include 
file, please avoid the temptation.
                                          


reply via email to

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