On Wed, 2010-10-13 at 17:39 +0000, Saurabh T wrote: > 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.
You cannot do this: included files cannot be intermediate. When make decides to rebuild an included file it runs all the normal rules and cleans up just as it normally would, which removes intermediate files, then it re-execs itself. On re-exec, the included file does not exist (because the previous invocation cleaned up intermediate files) and so make builds it again, cleans it up again, re-execs itself... etc. It would be good if make could detect this and either fail or ignore the intermediate setting on included files, rather than going into an infinite loop. However, in order to work the way you'd like (which is, I assume, that intermediate files are somehow only removed in the final re-exec of make but in the intermediate ones) make would somehow have to communicate to the re-exec'd version of make that these files were created as intermediates. Currently there's no way for make to do that, so such a thing would have to be invented first. _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
