public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51341] New: make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10
@ 2011-11-28 22:57 dx_zhou at hotmail dot com
  2011-11-28 23:20 ` [Bug preprocessor/51341] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dx_zhou at hotmail dot com @ 2011-11-28 22:57 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51341
           Summary: make cannot detect head file change by dependency file
                    with gcc 4.6.1 on ubuntu 11.10
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dx_zhou@hotmail.com


The issue is that make command cannot detect changes in head file. i.e, if I
touch "test.h", make command will not recompile. 

This works with gcc 4.5.4 on the same OS.

--test.h--
#include <iostream>
void hello()
{
std::cout << "Hello\n";
}

--test.cc--
#include "test.h"
int main()
{
hello();
}

--Makefile--
sources := test.cc    
objects := test.o
depends := test.d
main := test

$(main) : % : %.o 
    g++ $< -o $@

%.o : %.cc
    g++ -c -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" $< -o $@

clean :
    -rm -rf $(objects) $(depends) $(main)

ifneq ($(MAKECMDGOALS),clean)
-include $(depends)
endif


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

* [Bug preprocessor/51341] make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10
  2011-11-28 22:57 [Bug c++/51341] New: make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10 dx_zhou at hotmail dot com
@ 2011-11-28 23:20 ` pinskia at gcc dot gnu.org
  2011-11-28 23:27 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-11-28 23:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |preprocessor

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-28 22:54:33 UTC ---
-MT changes the target to the .d rather than adding it to the .o one.


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

* [Bug preprocessor/51341] make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10
  2011-11-28 22:57 [Bug c++/51341] New: make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10 dx_zhou at hotmail dot com
  2011-11-28 23:20 ` [Bug preprocessor/51341] " pinskia at gcc dot gnu.org
@ 2011-11-28 23:27 ` pinskia at gcc dot gnu.org
  2011-11-29 15:39 ` dx_zhou at hotmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-11-28 23:27 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-28 22:57:30 UTC ---
This was an expected change, see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12448 .  Which says you need
another -MT option to include the .o target.


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

* [Bug preprocessor/51341] make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10
  2011-11-28 22:57 [Bug c++/51341] New: make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10 dx_zhou at hotmail dot com
  2011-11-28 23:20 ` [Bug preprocessor/51341] " pinskia at gcc dot gnu.org
  2011-11-28 23:27 ` pinskia at gcc dot gnu.org
@ 2011-11-29 15:39 ` dx_zhou at hotmail dot com
  2011-11-29 16:17 ` redi at gcc dot gnu.org
  2011-12-09 14:31 ` dx_zhou at hotmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: dx_zhou at hotmail dot com @ 2011-11-29 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from davidz <dx_zhou at hotmail dot com> 2011-11-29 14:56:41 UTC ---
I am a little confused. -MT will create .d file. Then make command will include
.d and re-compile if dependency file changes. The issue is that g++ 4.6.1
doesn't re-compile if I touch .h. Does this mean my test.d format is wrong? If
I need another -MT, what syntax it should be? Thanks a lot!

(In reply to comment #2)
> This was an expected change, see
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12448 .  Which says you need
> another -MT option to include the .o target.


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

* [Bug preprocessor/51341] make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10
  2011-11-28 22:57 [Bug c++/51341] New: make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10 dx_zhou at hotmail dot com
                   ` (2 preceding siblings ...)
  2011-11-29 15:39 ` dx_zhou at hotmail dot com
@ 2011-11-29 16:17 ` redi at gcc dot gnu.org
  2011-12-09 14:31 ` dx_zhou at hotmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2011-11-29 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-29 15:26:29 UTC ---
(In reply to comment #3)
> I am a little confused. -MT will create .d file. Then make command will include
> .d and re-compile if dependency file changes. The issue is that g++ 4.6.1
> doesn't re-compile if I touch .h. Does this mean my test.d format is wrong? If

Did you read the linked bug report?  Did you look at the content of test.d?

> I need another -MT, what syntax it should be? Thanks a lot!

g++ -c -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" "-MT$@" $< -o $@


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

* [Bug preprocessor/51341] make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10
  2011-11-28 22:57 [Bug c++/51341] New: make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10 dx_zhou at hotmail dot com
                   ` (3 preceding siblings ...)
  2011-11-29 16:17 ` redi at gcc dot gnu.org
@ 2011-12-09 14:31 ` dx_zhou at hotmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: dx_zhou at hotmail dot com @ 2011-12-09 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from davidz <dx_zhou at hotmail dot com> 2011-12-09 14:06:22 UTC ---
This did solve the issue. Thanks a lot for the explain and syntax!

(In reply to comment #4)
> (In reply to comment #3)
> > I am a little confused. -MT will create .d file. Then make command will include
> > .d and re-compile if dependency file changes. The issue is that g++ 4.6.1
> > doesn't re-compile if I touch .h. Does this mean my test.d format is wrong? If
> 
> Did you read the linked bug report?  Did you look at the content of test.d?
> 
> > I need another -MT, what syntax it should be? Thanks a lot!
> 
> g++ -c -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" "-MT$@" $< -o $@


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

end of thread, other threads:[~2011-12-09 14:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-28 22:57 [Bug c++/51341] New: make cannot detect head file change by dependency file with gcc 4.6.1 on ubuntu 11.10 dx_zhou at hotmail dot com
2011-11-28 23:20 ` [Bug preprocessor/51341] " pinskia at gcc dot gnu.org
2011-11-28 23:27 ` pinskia at gcc dot gnu.org
2011-11-29 15:39 ` dx_zhou at hotmail dot com
2011-11-29 16:17 ` redi at gcc dot gnu.org
2011-12-09 14:31 ` dx_zhou at hotmail dot com

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).