GCC vs. `make' on Solaris

Andrew Pimlott andrew@pimlott.ne.mediaone.net
Sun May 13 16:16:00 GMT 2001


On Fri, May 11, 2001 at 11:44:36PM -0300, Alexandre Oliva wrote:
> But what we generally have is:
> 
> foo.o: foo.c
>         gcc -c foo.c
> foo.c: s-foo; @true
> s-foo: bar
>         bar > tmp-foo
>         move-if-change tmp-foo foo.c
>         touch s-foo
> 
> Even if foo.c is older than s-foo, GNU make is smart enough to figure
> @true hasn't changed it, so it doesn't proceed to rebuilding foo.o.

(While I'm on this thread ...)

What is the point of the middle rule and s-foo?  Isn't

foo.o: foo.c
        gcc -c foo.c
foo.c: bar
        bar > tmp-foo
        move-if-change tmp-foo foo.c

the same?

(I'm not very familiar with GCC's makefiles; I'm assuming the idea
is that bar is really the source file you want to compile, and that
it may be spuriously written to even when its content is not
changed.)

Andrew



More information about the Gcc mailing list