help-make
[Top][All Lists]
Advanced

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

RE: Conditionals in define


From: Dave Korn
Subject: RE: Conditionals in define
Date: Sun, 29 Jul 2007 23:51:31 +0100

On 29 July 2007 23:16, David A. Greene wrote:

> Why does this print:
>    bye
>    hello
> ?
> 
> test.mk: [SNIP]

  Running it under remake[*] is informative:

/tmp $ remake -X -f test.mk
Reading makefiles...
calling test()
 calling test_impl()
bye
hello
 test_impl() returns "
ifeq (hello,bye)

else

endif
"
test() returns ""
Updating makefiles....
Updating goal targets....
 /tmp/test.mk:15        File `all' does not exist.

(/tmp/test.mk:15)
all:
mdb<0> q

  This is showing that the $(info ) function is being called when test()
expands test_impl().  If you change the definition of test_impl to:

define test_impl

ifeq (hello,bye)
  $$(info bye)
else
  $$(info hello)
endif

endef

it will do what you want.


    cheers,
      DaveK
[*] - Remake, the make debugger: http://bashdb.sourceforge.net/remake/
-- 
Can't think of a witty .sigline today....





reply via email to

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