From: Peter Maydell Date: Fri, 13 Sep 2013 17:25:52 +0000 (+0100) Subject: rules.mak: New string testing functions X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~1285^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ef622e31e7168a9a2c80f95d245c2ad156e3fa7;p=sdk%2Femulator%2Fqemu.git rules.mak: New string testing functions Add new string testing functions which return a y/n result: eq : are two strings equal (ignoring leading/trailing space)? ne : are two strings unequal? isempty : is a string empty? notempty : is a string non-empty? Based on an idea by Ákos Kovács . Signed-off-by: Peter Maydell Signed-off-by: Paolo Bonzini --- diff --git a/rules.mak b/rules.mak index 65a1b96..49edb9b 100644 --- a/rules.mak +++ b/rules.mak @@ -106,6 +106,17 @@ leqv = $(if $(filter $(call lnot,$1),$(call lnot,$2)),y,n) # Logical if: like make's $(if) but with an leqv-like test lif = $(if $(subst n,,$1),$2,$3) +# String testing functions: inputs to these can be any string; +# the output is always either "y" or "n". Leading and trailing whitespace +# is ignored when comparing strings. +# String equality +eq = $(if $(subst $2,,$1)$(subst $1,,$2),n,y) +# String inequality +ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n) +# Emptiness/non-emptiness tests: +isempty = $(if $1,n,y) +notempty = $(if $1,y,n) + # Generate files with tracetool TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py