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 15:33:43 -0700

Hi Magnus,

On Thu, Mar 21, 2013 at 2:25 PM, Magnus Fromreide <address@hidden>
wrote:
>
> I have a makefile that contains nothing but a .PHONY target as follows:
>
> .PHONY: a
>
> If I try to build a target named 'b' then make tells me there are no rules
> for that.
>
> If I try to build a target named 'a' then make tells me that there is no
> need to remake that target.
>
> Is this implicit rule creation an intentional feature of make or just a
bug?

Well, if you created your typical hell-world.c file:

#include <stdio.h>
int main( int argc, char **argv )
{
    printf( "Hello World\n" );
    return 0;
}

and then create an empty Makefile, (perhaps using touch Makefile), then

820 >make hello-world
cc     hello-world.c   -o hello-world

It compiles and builds the executable. This is because make has a bunch of
builtin rules. Running "make -p" will print the builtin rules.

So, in that context, your example makefile seems perfectly sane.

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


reply via email to

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