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: Paul D. Smith
Subject: Re: Using error and warning functions inside a user defined function
Date: Fri, 28 Oct 2005 14:40:03 -0400

%% Edson Seabra <address@hidden> writes:

  es> I'm trying  to write a custom function that will abort the make if  there
  es> are variables not defined in the list passed as parameter 1.

  es> $(call check_undefined_vars,<var_list1>)

  es> But I have to write this:

  es> VARS_NOT_DEFINED :=
  es> $(call check_undefined_vars, <var_list>)
  es> ifneq ($(words $(VARS_NOT_DEFINED)),0)
  es> $(error Variable(s): '$(VARS_NOT_DEFINED)' must be defined.)
  es> endif

  es> Because if I move the if with the call to error inside the
  es> function "check_undefined_vars" the make aborts always it does not
  es> matter if the variables in <var_list> are defined or not.

You can't use ifdef inside the call: those are preprocessor
conditionals, like #ifdef etc. in C.

You can use the $(if ...) function there, though.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]