gnu make tutorial
Kurt Wall
kwall
Mon May 17 11:59:26 PDT 2004
In a 0.6K blaze of typing glory, M.W. Chang wrote:
> >> rlib.o : rlib.prg
> >> # %.o : %.prg
> >> .prg.o :
> >> gharbour $<
> > I believe that's exactly what happened. The implicit rules are used
> > first. I think you must use an explicit rule in this case because you
> > are not using a compiler that GCC has been taught to use and you are
> > using a non-standard file extension.
>
> So there is no way to specify a non-standard rule in the ".prg.o" way?
> I could use "%.o : %.prg", but I am curious about the possibility.
GNU make (or at least its maintainers) prefer pattern rules (the "new"
way) to suffix rules (the "old" way) "because pattern rules are more
general and cleaner." Personally, I like pattern rules because they
are easier to understand and to sight read.
.o.c:
$(CC) -c $(CFLAGS) $@ $<
doesn't tell me as much as quickly as
%.o : %.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
because I (still) have to make the mental translation that ".o.c"
means "make a .o from a .c". The pattern rule lets me avoid that
mental translation.
Kurt
--
What I want is all of the power and none of the responsibility.
More information about the Linux-users
mailing list