Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using logical oprators in GNU makefile

6,681 views
Skip to first unread message

manju...@gmail.com

unread,
Dec 1, 2008, 2:40:38 AM12/1/08
to
Hi,
I want to use logical operators for checking if conditon.How do i use
this..
I want something like this..
if ((condition) &&(condition))
can i write like above.

Ralf Wildenhues

unread,
Dec 7, 2008, 7:34:42 AM12/7/08
to manju...@gmail.com, help-gn...@gnu.org
Hello,

Using GNU make, maybe this is what you need?

ifeq ($(var1), value1)
ifeq ($(var2), value2)
...
endif
endif

Cheers,
Ralf


Koteswar16

unread,
Apr 29, 2009, 12:37:21 AM4/29/09
to help-gn...@gnu.org

But how to do ORing in make file ?
i.e.
ifeq ($(var1), value1) || ($(var2), value2)
--------
endif
-Koteswar

Ralf Wildenhues wrote:
>
> Hello,
>
> * manju...@gmail.com wrote on Mon, Dec 01, 2008 at 08:40:38AM CET:

> Using GNU make, maybe this is what you need?
>
> ifeq ($(var1), value1)
> ifeq ($(var2), value2)
> ...
> endif
> endif
>
> Cheers,
> Ralf
>
>
>
>

--
View this message in context: http://www.nabble.com/Using-logical-oprators-in-GNU-makefile-tp20774036p23290374.html
Sent from the Gnu - Utils - Help mailing list archive at Nabble.com.

Ralf Wildenhues

unread,
Apr 29, 2009, 5:14:41 PM4/29/09
to Koteswar16, help-gn...@gnu.org
Hello,

please don't top-post, thank you.

* Koteswar16 wrote on Wed, Apr 29, 2009 at 06:37:21AM CEST:
>
> But how to do ORing in make file ?
> i.e.
> ifeq ($(var1), value1) || ($(var2), value2)

You can either repeat the expansion,
ifeq ($(var1), value1)
$(foo)
endif

ifeq ($(var2), value2)
$(foo)
endif

or factor into a new variable, for clarity and to avoid duplicate
expansion,

cond =
ifeq ($(var1), value1)
cond = yes
endif
ifeq ($(var2), value2)
cond = yes
endif

ifdef cond
...
endif

or you can rewrite your makefile to use conditional operators, and then
use $(or ...). See 'info make "Conditional Syntax"' and 'info make
"Conditional Functions"'.

Cheers,
Ralf


0 new messages