bug-make
[Top][All Lists]
Advanced

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

Re: Make does not throw an error for target without a recipe?


From: Patrick Donnelly
Subject: Re: Make does not throw an error for target without a recipe?
Date: Thu, 26 Jun 2014 16:42:39 -0400

Hi Martin,

On Thu, Jun 26, 2014 at 4:33 PM, Martin Dorey <address@hidden> wrote:
>> Why is it trying to build target test.mk...???
>
> That's explained by 
> https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles.

Thanks, that makes sense.

>> Then it decides it was successful?
>
> For some value of "successful".  With your makefile:
>
> address@hidden:~/tmp/batrick-2014-06-26$ make -f test.mk foo
> make: Nothing to be done for `foo'.
> address@hidden:~/tmp/batrick-2014-06-26$
>
> If we add a semicolon, telling make that the recipe to update foo is empty:
>
> address@hidden:~/tmp/batrick-2014-06-26$ sed -i -e 's/passwd/passwd;/' test.mk
> address@hidden:~/tmp/batrick-2014-06-26$
>
> Then the message changes:
>
> address@hidden:~/tmp/batrick-2014-06-26$ make -f test.mk foo
> make: `foo' is up to date.
> address@hidden:~/tmp/batrick-2014-06-26$
>
> If we give it a recipe that actually works:
>
> address@hidden:~/tmp/batrick-2014-06-26$ sed -i -e 's/passwd;/passwd; @touch 
> $@/' test.mk
> address@hidden:~/tmp/batrick-2014-06-26$
>
> Then we get silent success, following the Unix Bushido:
>
> address@hidden:~/tmp/batrick-2014-06-26$ make -f test.mk foo
> address@hidden:~/tmp/batrick-2014-06-26$
>
> Though a second invocation has nothing to do, and says so:
>
> address@hidden:~/tmp/batrick-2014-06-26$ make -f test.mk foo
> make: `foo' is up to date.
> address@hidden:~/tmp/batrick-2014-06-26$

I'm afraid none of this exercise is helpful for solving the problem
though. To put it concisely: how do I get Make to *fail* if it cannot
create one of the targets?

-- 
Patrick Donnelly



reply via email to

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