]> Git Repo - qemu.git/commitdiff
rules.mak: New string testing functions
authorPeter Maydell <[email protected]>
Fri, 13 Sep 2013 17:25:52 +0000 (18:25 +0100)
committerPaolo Bonzini <[email protected]>
Wed, 16 Oct 2013 16:21:00 +0000 (18:21 +0200)
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 <[email protected]>.

Signed-off-by: Peter Maydell <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
rules.mak

index 65a1b9695b6d5e44a886c3d25c06b84e3ef1dd20..49edb9bf07eca605858f5070b9db2340346b7ffd 100644 (file)
--- 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
 
This page took 0.0252 seconds and 4 git commands to generate.