help-make
[Top][All Lists]
Advanced

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

Re: .PHONY non-rules


From: Dave Hylands
Subject: Re: .PHONY non-rules
Date: Thu, 21 Mar 2013 18:10:53 -0700

Hi Magnus,

On Thu, Mar 21, 2013 at 5:37 PM, Magnus Fromreide <address@hidden>
wrote:
>
> On Thu, Mar 21, 2013 at 03:33:43PM -0700, Dave Hylands wrote:
> > Hi Magnus,
> >
> > On Thu, Mar 21, 2013 at 2:25 PM, Magnus Fromreide <address@hidden>
> > wrote:
> >
> > It compiles and builds the executable. This is because make has a bunch
of
> > builtin rules. Running "make -p" will print the builtin rules.
>
> Yes, but normally the builtin rules require some predecessor. In your case
> the file hello-world.c the thing that enables the pattern rule '%: %.c'.
>
> In my case we have
>
> $ > Makefile
> $ make target
> make: *** No rule to make target `target'.  Stop.

So that makes sense. Make will have looked for taget.c, and target.cpp, and
all of the other builtin rules and not found any file/rule combination that
will create target.

> $ echo '.PHONY: target' > Makefile
> $ make target
> make: Nothing to be done for `target'.
>
> and my question is why there is a difference and wether there should be a
> difference. I couldn't find anything about .PHONY making it's dependants
into
> targets in the manual.

So for the phony target, I think that you'll find:

.PHONY: a

and

.PHONY: a
a:

are really the same thing. And, in fact, if I run "make -d a" for each of
those 2 cases, then I get the exact same debug output.

--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com


reply via email to

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