help-make
[Top][All Lists]
Advanced

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

Re: Using error and warning functions inside a user defined function


From: Ken Smith
Subject: Re: Using error and warning functions inside a user defined function
Date: Fri, 28 Oct 2005 15:47:57 -0400
User-agent: mutt-ng/devel-r445 (Linux)

On Fri, Oct 28, 2005 at 11:35:54AM -0700, Edson Seabra wrote:
> 
> 
> 
> 
> Hi,
> 
> I'm trying  to write a custom function that will abort the make if  there
> are variables not defined in the list passed as parameter 1.

How about something like this.

function = \
$(foreach .i,$(1), \
  $(if $(strip $($(.i))),$(warning cool),$(error blargh!)) \
 )

a := 1
b := 2 
c :=

$(warning 1)
$(call function,a b)
$(warning 2)
$(call function,a b c)
$(warning 3)


Outputs,

GNUmakefile:12: 1
GNUmakefile:13: cool
GNUmakefile:13: cool
GNUmakefile:14: 2
GNUmakefile:15: cool
GNUmakefile:15: cool
GNUmakefile:15: *** blargh!.  Stop.

  Ken




reply via email to

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