[Ada] Support for building Ada utilities to autogenerate files

Zack Weinberg zack@codesourcery.com
Wed Oct 10 10:59:00 GMT 2001


On Wed, Oct 10, 2001 at 07:38:45PM +0200, Florian Weimer wrote:
> Zack Weinberg <zack@codesourcery.com> writes:
> 
> > Come to think of it, since Ada already requires GNU make, you ought to
> > be able to write
> >
> > nmake.adb% nmake.ads%: sinfo.ads nmake.adt xnmake.adb
> 
> No need for the '%'s, most makes support multiple targets, I think.
> At least there's prior art in the makefile snippet of the Fortran
> front end.

The sole purpose of the '%'s is to prevent make from executing the
command twice.  With a generic multiple-target rule

a b : deps...
	command

command will be run twice, once with $@ set to a, once with $@ set to b.
This is because internally it means exactly the same thing as

a : deps...
	command

b : deps...
	command

The trailing percent signs make this into a pattern rule.  That means
make will try it if you do something strange like "make nmake.adbzork",
which is harmless.  It also means that the commands will be run just
once and make will expect them to generate both targets.  (I believe
this was done so that you could write

%.tab.c %.tab.h: %.y
	$(BISON) -d $<

and have it do the Right Thing.  Or anyway that's the example in the
GNU make manual.)

zw




More information about the Gcc-patches mailing list