preprocessor/7358: Changes to Sun's make Dependencies

PickinA@logica.com PickinA@logica.com
Fri Jul 19 09:26:00 GMT 2002


>Number:         7358
>Category:       preprocessor
>Synopsis:       Changes to Sun's make Dependencies
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 19 07:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Pickin
>Release:        3.0.4+
>Organization:
>Environment:
Solaris
>Description:
Sun Dependencies make object files dependent on C source
even thought this may be a temporary file.

This can make builds fail when using Sun's make.
>How-To-Repeat:
If we consider the make file dependency

.c.o:
    @cp $(@:.o=.c) /tmp/tmp.c
    gcc -c /tmp/tmp.c -o $@
    @rm /tmp/tmp.c

[ Don't ask why I'm doing this, I'm not, but it demonstrates the point ]

and we have a single source file main.c

Version 2.9.5 produced dependency

main.o: ...
    <system headers>
    ..... 
    cp main.c /tmp/tmp.c
    gcc -g -O2 -c /tmp/tmp.c -o main.o
    rm /tmp/tmp.c

Whereas 3.0.4 produces:

main.o: /tmp/tmp.c 
    ...
    <system headers>
    ..... 
    cp main.c /tmp/tmp.c 
    gcc -c /tmp/tmp.c -o main.o
    rm /tmp/tmp.c 

Whereas 3.1.0 produces:

main.o: /tmp/tmp.c 
    cp main.c /tmp/tmp.c 
    gcc -g -O2 -c /tmp/tmp.c -o main.o
    rm /tmp/tmp.c

I have raised the problem with the System Headers previously
[7357] but GCC 3 has introduced a new dependency of object file on the source.

This means that in the best case everything will be compiles twice the first time around, as Sun's make re-reads the dependency list again and identifies a new dependency. In the worst case builds fail as temporary files may nolonger be present.

This is indeed what happens if one uses ccache 
(see ccache.samba.org).


>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list