help-make
[Top][All Lists]
Advanced

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

Re: ifneq inside a function


From: Paul D. Smith
Subject: Re: ifneq inside a function
Date: Thu, 26 Aug 2004 16:14:23 -0400

%% Ken Smith <address@hidden> writes:

  ks> I can't justify to myself why this makefile
  ks> define something
  ks>   ifneq (,)
  ks>     $(warning weird)
  ks>   endif
  ks> endef

  ks> $(call something)

  ks> generates the following output

  ks> testcase.mk:6: weird
  ks> testcase.mk:6: *** missing separator.  Stop.

The expansion of every variable and function must result in a single
line.  You cannot expand into multiple lines.

There are two exceptions to this rule: first, you can expand into
multiple lines within a command script, so something like this works:

    define FOO
        @echo hello
        @echo world
    endef

    foo:
            $(FOO)

And second, the argument to the special $(eval ...) function can contain
multiple lines.


No other expansion can result in multiple lines being produced.

-- 
-------------------------------------------------------------------------------
 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]