public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/28810]  New: gcc -MD -MP doesn't add phony rule for source file
@ 2006-08-22 20:21 carlton at bactrian dot org
  2006-08-22 20:29 ` [Bug preprocessor/28810] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: carlton at bactrian dot org @ 2006-08-22 20:21 UTC (permalink / raw)
  To: gcc-bugs

When I generate depends using gcc -MD -MP, it generates a dependency
for the object file on the source file and all the headers.  It also
generates an empty dependency for each header (to handle the case where
the header has gone away - that's the point of -MP).

It doesn't, however, do that for the main source file.  This behavior,
admittedly, is documentented in the manual; the manual doesn't give a reason
for this choice.

And it's causing problems for me: if I move the main source file (without
moving the corresponding object file, an admittedly rare occurrence), then
make refuses to rebuild my object file, because the dependency generated
by GCC on the old source file still exists.

If there's a reason for GCC's current behavior, then I can live with it -
I don't move a source file (without also moving the corresponding
object file!) nearly as often as I move headers.  But if there's
no particular reason, then I think the current behavior is suboptimal.

I've seen this over a range of GCC releases, including 3.2.3 and 4.1.1.


-- 
           Summary: gcc -MD -MP doesn't add phony rule for source file
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carlton at bactrian dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28810


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug preprocessor/28810] gcc -MD -MP doesn't add phony rule for source file
  2006-08-22 20:21 [Bug preprocessor/28810] New: gcc -MD -MP doesn't add phony rule for source file carlton at bactrian dot org
@ 2006-08-22 20:29 ` pinskia at gcc dot gnu dot org
  2006-12-26  0:24 ` tromey at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-22 20:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28810


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug preprocessor/28810] gcc -MD -MP doesn't add phony rule for source file
  2006-08-22 20:21 [Bug preprocessor/28810] New: gcc -MD -MP doesn't add phony rule for source file carlton at bactrian dot org
  2006-08-22 20:29 ` [Bug preprocessor/28810] " pinskia at gcc dot gnu dot org
@ 2006-12-26  0:24 ` tromey at gcc dot gnu dot org
  2006-12-26  3:24 ` carlton at bactrian dot org
  2007-01-08  2:22 ` tromey at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at gcc dot gnu dot org @ 2006-12-26  0:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tromey at gcc dot gnu dot org  2006-12-26 00:24 -------
I think the rationale here is just that, if -MP added the main source
file as a phony target, then 'make' would not do anything at all if the
main file was missing.  But, that result seems wrong -- for this to trigger
your Makefile must still have some dependency on the old .o file.  So,
presumably the dependency ought to mean something, and not just be
silently ignored.

How is it that your Makefile has a dependency on the old .o even
when the main file name has changed?  Isn't that a Makefile bug?


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-12-26 00:24:20
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28810


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug preprocessor/28810] gcc -MD -MP doesn't add phony rule for source file
  2006-08-22 20:21 [Bug preprocessor/28810] New: gcc -MD -MP doesn't add phony rule for source file carlton at bactrian dot org
  2006-08-22 20:29 ` [Bug preprocessor/28810] " pinskia at gcc dot gnu dot org
  2006-12-26  0:24 ` tromey at gcc dot gnu dot org
@ 2006-12-26  3:24 ` carlton at bactrian dot org
  2007-01-08  2:22 ` tromey at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: carlton at bactrian dot org @ 2006-12-26  3:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from carlton at bactrian dot org  2006-12-26 03:24 -------
I'm trying to remember the details; I think I must have moved the
file from one directory to the other, and been pulling in directories
with vpath.

And one could certainly argue that any use of vpath is a
Makefile bug. :-)

Anyways, your rationale makes sense to me.  So I'm happy to have
you close the bug.  I won't do it myself though, in case you want to,
say, leave the bug open as a suggestion to improve the
documentation in this regard.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28810


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug preprocessor/28810] gcc -MD -MP doesn't add phony rule for source file
  2006-08-22 20:21 [Bug preprocessor/28810] New: gcc -MD -MP doesn't add phony rule for source file carlton at bactrian dot org
                   ` (2 preceding siblings ...)
  2006-12-26  3:24 ` carlton at bactrian dot org
@ 2007-01-08  2:22 ` tromey at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-01-08  2:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tromey at gcc dot gnu dot org  2007-01-08 02:22 -------
I'm going to close this.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28810


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-01-08  2:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-22 20:21 [Bug preprocessor/28810] New: gcc -MD -MP doesn't add phony rule for source file carlton at bactrian dot org
2006-08-22 20:29 ` [Bug preprocessor/28810] " pinskia at gcc dot gnu dot org
2006-12-26  0:24 ` tromey at gcc dot gnu dot org
2006-12-26  3:24 ` carlton at bactrian dot org
2007-01-08  2:22 ` tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).