make

Juergen Wagner gandalf at csli.Stanford.EDU
Thu Aug 10 02:31:43 AEST 1989


In article <3019 at chorus.fr> mm at chorus.fr (Marc Maathuis) writes:
>Can anybody explain me why in the following typescript
>'make -n' and 'make' want to recompile:
....
><5>  cat makefile
>prog:   prog.o
>        cc -o prog prog.o
>
>prog.o: x.h
>        cc -c prog.c
>
>x.h:    y.h
>
><6>  > x.h
><7>  > y.h

The problem here is that no matter how often you call 'make', the target
x.h is *ALWAYS* out of date with respect to y.h. Y.h is not being updated.
If there is no such update necessary, I don't see why you would have that
last rule in the Makefile. I'd prefer something like

	foo:	foo.o
		cc -o foo foo.o

	foo.o:	foo.c x.h y.h
		cc -c prog.c

Unless there is a special update for x.h which is necessary if y.h is newer,
the above lines should be sufficient.

Juergen Wagner		   			gandalf at csli.stanford.edu
						 wagner at arisia.xerox.com



More information about the Comp.unix.questions mailing list