[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Logical AND, OR, XOR operators inside ifeq ... endif construct condi
From: |
Boucher, Jean |
Subject: |
RE: Logical AND, OR, XOR operators inside ifeq ... endif construct condition. |
Date: |
Fri, 28 Oct 2005 09:38:41 -0700 |
Thanks, Paul.
Might I suggest that this logical OR functionality be stated in the next
version of the Make manual as an example use of the filter function.
Also, one of the situation I'm trying to test for is the empty string
(in my previous example, say Y=`'), which I believe I can't test in this
manner:
ifeq ($(var),$(filter $(var),X `'))
...
endif
For that, I think I'll have to make a separate 'ifeq .. endif' test for
`' or use the origin function to determine if it was `undefined'. BTW,
if var=`' by previously saying "var=" on a line all by itself in the
same makefile, will $(origin var) produce `undefined' or `file'? I guess
I can test that with a couple of warning functions in an ifeq .. else ..
endif construct.
In any case, that leaves me with having to find a similar method to
perform the logical AND.
Jean.
-----Original Message-----
From: Paul Smith [mailto:address@hidden On Behalf Of Paul D. Smith
Sent: Thursday, October 27, 2005 6:24 PM
To: Boucher, Jean
Cc: address@hidden
Subject: Re: Logical AND, OR,XOR operators inside ifeq ... endif
construct condition.
%% "Boucher, Jean" <address@hidden> writes:
bj> Hello again. Quick question, if I may: Is there a logical OR
bj> operator for the 'ifeq ... endif' statement? That is, I'd like to
bj> execute some statements if variable 'var' is either defined as
bj> string 'X' or 'Y', something like this:
bj> ifeq ((var,X) OR (var,Y))
bj> ...
bj> endif
bj> From reading the manual, I don't see a way to do that, except by
bj> creating two 'ifeq ... endif' constructs sequencially, one to
bj> handle each value for 'var', and repeating the exact same
bj> conditional statements inside each. Yuk!
I do it like this:
ifeq ($(var),$(filter $(var),X Y))
...
endif
Most others can be handled using these types of methods as well.
There are no specific operators for AND, OR, etc.
--
------------------------------------------------------------------------
-------
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
========================================================================
CONFIDENTIALITY NOTICE
----------------------
This message, together with any attachments, may be legally privileged
and is confidential information intended only for the use of the
individual or entity to which it is addressed. It is exempt from
disclosure under applicable law including court orders. If you are not
the intended recipient, you are hereby notified that any use,
dissemination, distribution or copy of this message, or any attachment,
is strictly prohibited. If you have received this message in error,
please notify the original sender and delete this message, along with
any attachments, from your computer.