help-make
[Top][All Lists]
Advanced

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

Re: How does $(error) work?


From: Paul Smith
Subject: Re: How does $(error) work?
Date: Thu, 09 Dec 2010 09:05:02 -0500

On Wed, 2010-12-08 at 14:20 -0500, Chris Cross wrote:
> 
> Trying to understand how $(error) works. The manual says "error is
> generated whenever this function is evaluated."  With the makefile below I
> would expect to see output from line1 of the recipe but only see output
> from $(error).
> # error.mk
> .PHONY: target
> 
> target:
>       @echo recipe line 1
>       $(error debug exit recipe line 2)
> 
> $ make -f error.mk
> error.mk:5: *** debug exit recipe line 2.  Stop.

That's because make evaluates the entire recipe just before it starts
the first line of the recipe; it doesn't evaluate the lines one at a
time as it's about to execute that line.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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