help-gnu-utils
[Top][All Lists]
Advanced

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

Re: Using logical oprators in GNU makefile


From: Ralf Wildenhues
Subject: Re: Using logical oprators in GNU makefile
Date: Wed, 29 Apr 2009 23:14:41 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

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




reply via email to

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