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: unassig...@gcc.gnu.org
        ReportedBy: dx_z...@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

Reply via email to