---------- Forwarded message ----------
From: Tim Murphy
Subject: Re: Help : how to use $(or condition ) & $(and condition ) in makefile
# do "equal" by seeing if a subst returns the empty string:
A_is_2:=$(if $(subst 2,,$(A)),,T)
B_is_4:=$(if $(subst 4,,$(B)),,T)
# then you could do something based on this:
# do something . . . .
One could make it look nicer by making an equals macro:
$(if $(1:$(2)=),,$(if $(2:$(1)=),,T))
which you could use as follows:
ifneq ($(and $(call eq,$(A),2),$(call eq,$(B),4)),)
# do what you want to do when A=2 and B=4
# . . . .. . .
2008/6/6 rakesh aggarwal <address@hidden
Very very thanks for your valuable suggestion.
I have one debut that I am explaining through this example.
I have 2 variable (let assume A and B) which contain some value.
I want to test A==2 and B==4 using $(and condition) function.
How can I put this condition in function??
I want only different output for the situation when any of the condition is
wrong (either A != 2 or B != 4) and both are right (A ==2 and B==4 ).
result := $(and condition )
--- On Thu, 6/5/08, Sam Ravnborg <address@hidden> wrote:
From: Sam Ravnborg <address@hidden>
Subject: Re: Help : how to use $(or condition ) & $(and condition ) in makefiles
To: "rakesh aggarwal" <address@hidden>
Date: Thursday, June 5, 2008, 11:28 PM
Notice that this is condition and not
havefile := $(if $(wildcard myfile.c), YES, NO)
This will print
if no myfile.c exist (because the $(wildcard myfile.c) expands to an empty
Bug-make mailing list
You could help some brave and decent people to have access to uncensored news by making a donation at: