Skip to content

Commit

Permalink
rules.mak: New string testing functions
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pm215 authored and bonzini committed Oct 16, 2013
1 parent 837a2e2 commit 9ef622e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rules.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9ef622e

Please sign in to comment.