Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!amdahl!dlb!dana!worley From: worley@dana.UUCP (John Worley) Newsgroups: comp.bugs.sys5 Subject: Re: make bug? Message-ID: <292@dana.UUCP> Date: 19 Jan 88 19:17:55 GMT References: <2979@ncrcae.Columbia.NCR.COM> Organization: Dana Computer, Inc., Sunnyvale, CA Lines: 69 > > When make is executed with the following description file, > > ------------------------------------------- > x : x.o > > x.o : x.c > > x.c : > echo "main(){}" >x.c > ------------------------------------------- > > Why does no-command mean use default rule in one case, yet it means do > nothing in another case? > > I added the explicit rule ".o: cc $< -o $@" to the beginning of > the description file; no change. Just for fun I added the explicit > rule ".c.o: cc -c $<". Then only the the .c file was made. > > This seems like a bug to me. I think no-command should mean if rule exists, > use it, otherwise print diagnostic. What do you think? When you type an empty action line, it means exactly that - do nothing. In make, it is possible to specify multiple dependency lines: OBJ = x.o y.o z.o $(OBJ): all.h global.h cc -DBLAH -c $< x.o: x.h y.o: y.h z.o: z.h Exactly zero or one of these can have an action - otherwise the order of execution is ambiguous. For some common dependencies, however, make has a default action which it checks IFF there is no action specified on any line containing the target. Making the NULL rule and error would break the following common, and prefectly valid, makefile organization all: a b c a: a.o cc -o a a.o b: b.o cc -o b b.o c: c.o cc -o c c.o a.o b.o c.o: global.h Therefore, the NULL action is and should be perfectly acceptable. If, after performing the actions, the dependencies are not satisfied, make will print the "Don't know how to make ...". Your problem would best be solved by adding the line all: x Regards, John S. Worley Ardent Computer, Inc. hplabs!dana!worley till 1/31/88 hplabs!ardent!worley after