bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #51269] Reusing data from targets for prerequisites


From: Paul Smith
Subject: Re: [bug #51269] Reusing data from targets for prerequisites
Date: Tue, 20 Jun 2017 19:25:25 -0400

On Tue, 2017-06-20 at 17:18 +0200, SF Markus Elfring wrote:
> I guess that it will be noticed once more that implicit rules will work
> in an other way than static pattern rules.

It's important to realize that even though the unfortunate choice of
naming implies otherwise, static pattern rules are in all ways
_explicit_ rules.  They are not and should never be considered implicit
rules.

A static pattern rule is merely a shorthand for writing a bunch of
explicit rules.  So this:

  OBJS = foo.o bar.o biz.o baz.o

  $(OBJS): %.o : %.c
          $(CC) $(CFLAGS) -c -o $@ $<

is in every way equivalent (to make) to writing this:

  foo.o : foo.c
          $(CC) $(CFLAGS) -c -o $@ $<
  bar.o : bar.c
          $(CC) $(CFLAGS) -c -o $@ $<
  biz.o : biz.c
          $(CC) $(CFLAGS) -c -o $@ $<
  baz.o : baz.c
          $(CC) $(CFLAGS) -c -o $@ $<


In fact once make has finished parsing the static pattern rule, there is
no difference between them in its internal structures.  You can,
actually, run "make -p" and you will see all the rules broken out rather
than displayed as a static pattern rule.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]