bug-make
[Top][All Lists]
Advanced

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

[bug #16145] .SECONDARY: prevents non-existent dependency from forcing r


From: Jay Berkenbilt
Subject: [bug #16145] .SECONDARY: prevents non-existent dependency from forcing rebuild
Date: Tue, 21 Mar 2006 20:29:14 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc3 Firefox/1.0.7

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=16145>

                 Summary: .SECONDARY: prevents non-existent dependency from
forcing rebuild
                 Project: make
            Submitted by: jayberkenbilt
            Submitted on: Tue 03/21/06 at 20:29
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
       Component Version: CVS
        Platform Version: None
           Fixed Release: None

    _______________________________________________________

Details:

This is with 3.81rc2 as checked out of CVS on March 21, 2006.

With the following makefile:

# ----------
ifdef BREAK_MAKE
.SECONDARY:
endif

all: a.2

a.1:
        touch a.1

a.2: a.1 a.h

a.h:

%.2: %.1
        touch $@

clean:
        rm a.1 a.2
# ----------

running make once causes a.1 and a.2 to be updated, and running make
subsequently causes a.2 to be updated as expected because a.2 depends upon
the non-existent a.h, and a.h has a target with no dependencies and no rules.
 (This is normal for automatically generated dependency files.)  make -d -rR
on a subsequent run shows the following output with 3.81rc2 (without
BREAK_MAKE defined):

GNU Make 3.81rc2
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-redhat-linux-gnu
Reading makefiles...
Reading makefile `/tmp/m'...
Updating makefiles....
 Considering target file `/tmp/m'.
  Looking for an implicit rule for `/tmp/m'.
  No implicit rule found for `/tmp/m'.
  Finished prerequisites of target file `/tmp/m'.
 No need to remake target `/tmp/m'.
Updating goal targets....
Considering target file `all'.
 File `all' does not exist.
 Looking for an implicit rule for `all'.
 No implicit rule found for `all'.
  Considering target file `a.2'.
   Looking for an implicit rule for `a.2'.
   Trying pattern rule with stem `a'.
   Trying implicit prerequisite `a.1'.
   Found an implicit rule for `a.2'.
    Considering target file `a.1'.
     Finished prerequisites of target file `a.1'.
    No need to remake target `a.1'.
    Pruning file `a.1'.
    Considering target file `a.h'.
     File `a.h' does not exist.
     Looking for an implicit rule for `a.h'.
     No implicit rule found for `a.h'.
     Finished prerequisites of target file `a.h'.
    Must remake target `a.h'.
    Successfully remade target file `a.h'.
   Finished prerequisites of target file `a.2'.
   Prerequisite `a.1' is older than target `a.2'.
   Prerequisite `a.1' is older than target `a.2'.
   Prerequisite `a.h' of target `a.2' does not exist.
  Must remake target `a.2'.
touch a.2
Putting child 0x096823f8 (a.2) PID 14360 on the chain.
Live child 0x096823f8 (a.2) PID 14360 
Reaping winning child 0x096823f8 PID 14360 
Removing child 0x096823f8 PID 14360 from chain.
  Successfully remade target file `a.2'.
 Finished prerequisites of target file `all'.
Must remake target `all'.
Successfully remade target file `all'.

The output is identical with 3.80 except for cosmetic differences.

With BREAK_MAKE defined (i.e., an empty .SECONDARY: rule), the results are
the same with 3.80, but 3.81rc2 (and 3.81rc1 as well) generate this with make
-d -rR BREAK_MAKE=1:

GNU Make 3.81rc2
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-redhat-linux-gnu
Reading makefiles...
Reading makefile `/tmp/m'...
Updating makefiles....
 Considering target file `/tmp/m'.
  Looking for an implicit rule for `/tmp/m'.
  No implicit rule found for `/tmp/m'.
  Finished prerequisites of target file `/tmp/m'.
 No need to remake target `/tmp/m'.
Updating goal targets....
Considering target file `all'.
 File `all' does not exist.
 Looking for an implicit rule for `all'.
 No implicit rule found for `all'.
  Considering target file `a.2'.
   Looking for an implicit rule for `a.2'.
   Trying pattern rule with stem `a'.
   Trying implicit prerequisite `a.1'.
   Found an implicit rule for `a.2'.
    Considering target file `a.1'.
     Finished prerequisites of target file `a.1'.
    No need to remake target `a.1'.
    Pruning file `a.1'.
    Looking for an implicit rule for `a.h'.
    No implicit rule found for `a.h'.
   Finished prerequisites of target file `a.2'.
   Prerequisite `a.1' is older than target `a.2'.
   Prerequisite `a.1' is older than target `a.2'.
   Prerequisite `a.h' of target `a.2' does not exist.
  No need to remake target `a.2'.
 Finished prerequisites of target file `all'.
Must remake target `all'.
Successfully remade target file `all'.
make: Nothing to be done for `all'.

Observe that make recognizes that a.h does not exist, but then still decides
that a.2 does not need to be remade.  I believe this is not the intended
behavior of .SECONDARY:, which is only supposed to affect intermediate
targets.  This bug causes files that have automaticly generated dependencies
using this common technique to not get rebuilt when one of their dependencies
disappears.  I would therefore consider it a serious bug.

Please let me know if you need additional information to reproduce this, if
my explanation is not clear, or if this is actually behaving as intended
(which seems unlikely since there are no intermediate targets involved
here).

Hopefully my makefile will be a good starting point for a test case for the
test suite.  I can attempt to generate a patch for the test suite so that
this bug causes a test failure if you would like, and I will probably do that
if I hear nothing within a few days.

Thanks!  I'm looking forward to 3.81 -- it fixes some problems that prevent
3.80 from working at all with my build system.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=16145>

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





reply via email to

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