Path: utzoo!utgpu!watmath!att!ucbvax!agate!shelby!csli!gandalf
From: gandalf@csli.Stanford.EDU (Juergen Wagner)
Newsgroups: comp.unix.questions
Subject: Re: make
Message-ID: <10034@csli.Stanford.EDU>
Date: 9 Aug 89 16:31:43 GMT
References: <3019@chorus.fr>
Sender: gandalf@csli.Stanford.EDU (Juergen Wagner)
Reply-To: gandalf@csli.stanford.edu (Juergen Wagner)
Followup-To: comp.unix.questions
Organization: Center for the Study of Language and Information, Stanford U.
Lines: 32

In article <3019@chorus.fr> mm@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@csli.stanford.edu
						 wagner@arisia.xerox.com