Makefile inference rule

Kasey S. Osborn osbornk at mist.cs.orst.edu
Thu Jun 7 13:43:51 AEST 1990


I am trying to establish an inference rule to build executables from
objects.  Here is a highlight of my makefile:

  OBJS = gc.o mem.o

  .c.o:
          cc -ansi -g -c -w0,-Wall $<           # This works fine.

  .o:
          cc -g $(OBJS) $< -o $@                # This is ignored!!!

  box:    $(OBJS) box.o

  box.o:  box.c gc.h

The key here is the .o: inference rule.  It is completely ignored, yet
documentation I read tells me this is how it is done.  I get no diagnostic
message, just a new prompt.  Ironically, if I remove the line:

  box:    $(OBJS) box.o

and invoke "make box", the .o: inference rule takes effect.  However,
the additional dependencies (OBJS) are ignored.

Does anyone have a clue?

Kasey S. Osborn
"There's a lot to be said for brevity."



More information about the Comp.unix.questions mailing list