bug-make
[Top][All Lists]
Advanced

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

Re: Section 3.8 of the info manual not respected


From: Paul Smith
Subject: Re: Section 3.8 of the info manual not respected
Date: Wed, 27 May 2009 13:14:12 -0400

On Thu, 2009-05-28 at 03:03 +1000, Anthony Shipman wrote:
> On Wed, 27 May 2009 11:26:14 am Philip Guenther wrote:
> > On Tue, May 26, 2009 at 9:45 AM, Anthony Shipman <address@hidden> wrote:
> > > I've tried the example in section 3.8 Overriding Part of Another
> > > Makefile. i.e.
> > >
> > > foo:
> > >        frobnicate > foo
> > > %: force
> > >        @$(MAKE) -f Makefile $@
> > > force: ;
> > >
> > The paragraph just above the example says this:
> > ----
> >    For example, if you have a makefile called `Makefile' that says how
> > to make the target `foo' (and other targets), you can write a makefile
> > called `GNUmakefile' that contains:
> > ----
> >
> > I.e., you *first* must have a file "Makefile" in the current
> > directory.  The error message you got says that you don't have that,
> > so of course the example doesn't work.
> 
> I expected that "make foo" would cause "frobnicate > foo" to be run and not 
> require a file called Makefile to exist. I thought that the Makefile would 
> only be used when a "make bar" is attempted. 

Match-anything rules are VERY tricky to get right.  They match anything,
which means that anything make wants to create it, will use the match
anything rule.  That, in turn, means that your match anything rule
better work!  In general I urge you to avoid them if possible.

In your case your match-anything rule will fail, which means if you try
to build ANYTHING other than "foo", it will fail.

Make always tries to rebuild its makefiles.  See the "How makefiles are
remade" section in the GNU make manual.  BTW, this section will also
give you the answer to your problem:

> If you know that one or more of your makefiles cannot be remade and
> you want to keep `make' from performing an implicit rule search on
> them, perhaps for efficiency reasons, you can use any normal method of
> preventing implicit rule lookup to do so.  For example, you can write an
> explicit rule with the makefile as the target, and an empty command
> string (*note Using Empty Commands: Empty Commands.).

Cheers!





reply via email to

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