bug-make
[Top][All Lists]
Advanced

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

[bug #26887] intermediate files declared INTERMEDIATE are made PRECIOUS


From: Tim Brown
Subject: [bug #26887] intermediate files declared INTERMEDIATE are made PRECIOUS
Date: Thu, 25 Jun 2009 15:53:46 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16

URL:
  <http://savannah.gnu.org/bugs/?26887>

                 Summary: intermediate files declared INTERMEDIATE are made
PRECIOUS
                 Project: make
            Submitted by: timbrown
            Submitted on: Thu 25 Jun 2009 15:53:45 GMT
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.81
        Operating System: Any
           Fixed Release: None

    _______________________________________________________

Details:

According to the 3.81 documentation (Sec 10.4):

> Ordinarily, a file cannot be intermediate if it is mentioned
> in the makefile as a target or prerequisite. However, you can
> explicitly mark a file as intermediate by listing it as
> a prerequisite of the special target .INTERMEDIATE. This takes
> effect even if the file is mentioned explicitly in some other
> way.

Intermediate files are deleted when they are "mentioned in the makefile as a
target or prerequisite".
(eg from attached Makefile)

$ make
making intermediate file foo.rr from foo.xx
cat foo.xx > foo.rr
making target file foo.qq from intermediate foo.rr
cat foo.rr > foo.qq
rm foo.rr

They are not deleted when they are "mentioned...".

$ WITH_bar=1 make
making intermediate file foo.rr from foo.xx
cat foo.xx > foo.rr
making target file foo.qq from intermediate foo.rr
cat foo.rr > foo.qq

However, if they are explicitly mentioned as .INTERMEDIATE
(and not even "mentioned..." elsewhere, as above) - it is
kept:

$ WITH_INTERMEDIATE=1 make
making intermediate file foo.rr from foo.xx
cat foo.xx > foo.rr
making target file foo.qq from intermediate foo.rr
cat foo.rr > foo.qq

The following stacks all the cards against me, but if it is
"mentioned..." and INTERMEDIATE is used, the intermediate file
is left:

$ WITH_bar=1 WITH_INTERMEDIATE=1 make
making intermediate file foo.rr from foo.xx
cat foo.xx > foo.rr
making target file foo.qq from intermediate foo.rr
cat foo.rr > foo.qq


If a target is explicitly mentioned as .INTERMEDIATE it is,
in fact, forced to be PRECIOUS also.

This is done by the code in: implicit.c:902 (pattern_search).
>From there on, it is never made un-PRECIOUS. The test for
removal (in file.c:1051 (remove_intermediates)):
(f->dontcare || !f->precious)
clause fails, and the file isn't removed.


Is there a need in pattern_search to check to see if the target is a
dependency of .INTERMEDIATE before calling it precious, as
in file.c:1051 (snap_deps)?

I would never expect a file to be .INTERMEDIATE and .PRECIOUS
(it may be intermediate and precious - that is, after all the
reason for preciousness).

After all, I would not expect to see it built (and left
un-removed) unless I actually call "make foo.rr":

$ make foo.rr
making intermediate file foo.rr from foo.xx
cat foo.xx > foo.rr


Line numbers from 3.81 source.

Possibly related to fix for Savannah bug #12267

Tested on Solaris 5.10 x86,  Linux x86 2.6.18



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 25 Jun 2009 15:53:45 GMT  Name: Makefile  Size: 801B   By: timbrown

<http://savannah.gnu.org/bugs/download.php?file_id=18318>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?26887>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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