On Wed, Mar 22, 2000 at 01:43:56PM +1100, Chris Rankin wrote:
> Hi,
> 
> We are seeing the following problem with GNU make versions 3.77 and 3.78.1 (Makefile 
>below):
> 
> $ make bug.o
> gcc    -c -o bug.o bug.c
> rm bug.o
> 
> In other words, although we are *explicitly* requesting that this file be built, GNU 
>make refuses to lift its "intermediate" status and deletes it again. This feature 
>renders the .INTERMEDIATE option useless to us - and my Project Manager would rather 
>cut his head off (or rather MY head off ;-)) and scoop the innards out rather than 
>develop something that needs a "not-out-of-the-box" version of make. Would you agree 
>that this is a bug in GNU make? If so then I could arguably patch the source on the 
>grounds that future "out-of-the-box" versions of make would not have this version.
> 
> Cheers,
> Chris.
> 
> 
> ##############################
> CC=gcc
> 
> .INTERMEDIATE: bug.o
> 
> bug: bug.o
>     $(CC) $(CFLAGS) -o $@ $^

  I am a little confused.  .INTERMEDIATE explicitly tells make that
its prerequisite in an intermediate and _should_ be deleted.  If you
had not used .INTERMEDIATE 'make bug.o' would have simply built bug.o.

  If the behavior your are trying to achieve is that when making bug,
bug.o _is_ removed even though it is explicitly mentioned, but if
bug.o is a command line target it is left alone, try:

CC :=gcc

bug: bug.o
        $(CC) $(CFLAGS) -o $@ $^
        rm $^


Does this help?


tim

Reply via email to