On Wed, 2011-05-11 at 18:19 +0530, Ajay Jain wrote:
> >> ifeq ("X","A) && ifeq("X","B) .. && ifeq ("X","Z")
> >
> > That makes no sense: it's always false.
> 
> Sorry .. I want to accomplish the following two operations using Make -
> 
> (1) ifneq (X, A) && ifneq (X, B)
> do something.
> 
> (2) ifeq (X, C) || ifeq (X, D)
> do something.

These kinds of things are typically done with filter functions.  For
example:

ifeq ($(filter X,A B),)
  do something
endif

ifneq ($(filter X,C D),)
  do something
endif

The filter will return a non-empty value if X matches any item in the
list.

In the first case the condition is true only if no items match (the
empty value is returned).  In the second case we use ifneq, so that if
ANY item matches we return true.

You can also use $(filter-out ...) which is handy in some situations.

> I just want to understand, can we really do and, or, not operations?

Yes, definitely (assuming you have a new-enough version of GNU make that
supports them).  But maybe not exactly as you're used to using them.


_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to