Message ID | 20200605073953.19268-5-philmd@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | accel: Allow targets to use Kconfig | expand |
Err extra 'and' in patch subject, should be: "rules.mak: Add strequal() and startwith() rules" I can respin the whole if it is easier for the maintainer. On 6/5/20 9:39 AM, Philippe Mathieu-Daudé wrote: > Add a rule to test if two strings are equal, > and another to test if a string starts with a substring, > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > rules.mak | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/rules.mak b/rules.mak > index 694865b63e..ccc1c49604 100644 > --- a/rules.mak > +++ b/rules.mak > @@ -191,6 +191,20 @@ ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n) > isempty = $(if $1,n,y) > notempty = $(if $1,y,n) > > +# strequal > +# Usage: $(call strequal, str1, str2) > +# > +# This macro returns a string (TRUE) when @str1 and @str2 > +# are equal, else returns the empty string (FALSE) > +strequal = $(if $(subst $2,,$1)$(subst $1,,$2),,$1) > + > +# startwith > +# Usage: $(call startwith, startstr, fullstr) > +# > +# This macro returns a string (TRUE) when @fullstr starts with > +# @startstr, else returns the empty string (FALSE) > +startwith = $(findstring :$1,:$2) > + > # Generate files with tracetool > TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py > >
Philippe Mathieu-Daudé <philmd@redhat.com> writes: > Add a rule to test if two strings are equal, > and another to test if a string starts with a substring, > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > rules.mak | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/rules.mak b/rules.mak > index 694865b63e..ccc1c49604 100644 > --- a/rules.mak > +++ b/rules.mak > @@ -191,6 +191,20 @@ ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n) > isempty = $(if $1,n,y) > notempty = $(if $1,y,n) > > +# strequal > +# Usage: $(call strequal, str1, str2) > +# > +# This macro returns a string (TRUE) when @str1 and @str2 > +# are equal, else returns the empty string (FALSE) > +strequal = $(if $(subst $2,,$1)$(subst $1,,$2),,$1) > + > +# startwith > +# Usage: $(call startwith, startstr, fullstr) > +# > +# This macro returns a string (TRUE) when @fullstr starts with > +# @startstr, else returns the empty string (FALSE) > +startwith = $(findstring :$1,:$2) > + > # Generate files with tracetool > TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py Should this be spelled startswith?
On 6/5/20 2:48 PM, Markus Armbruster wrote: > Philippe Mathieu-Daudé <philmd@redhat.com> writes: > >> Add a rule to test if two strings are equal, >> and another to test if a string starts with a substring, >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> --- >> rules.mak | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) >> >> diff --git a/rules.mak b/rules.mak >> index 694865b63e..ccc1c49604 100644 >> --- a/rules.mak >> +++ b/rules.mak >> @@ -191,6 +191,20 @@ ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n) >> isempty = $(if $1,n,y) >> notempty = $(if $1,y,n) >> >> +# strequal >> +# Usage: $(call strequal, str1, str2) >> +# >> +# This macro returns a string (TRUE) when @str1 and @str2 >> +# are equal, else returns the empty string (FALSE) >> +strequal = $(if $(subst $2,,$1)$(subst $1,,$2),,$1) >> + >> +# startwith >> +# Usage: $(call startwith, startstr, fullstr) >> +# >> +# This macro returns a string (TRUE) when @fullstr starts with >> +# @startstr, else returns the empty string (FALSE) >> +startwith = $(findstring :$1,:$2) >> + >> # Generate files with tracetool >> TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py > > Should this be spelled startswith? Indeed... Does that mean I can respin with your R-b here and in the next patch? :P
diff --git a/rules.mak b/rules.mak index 694865b63e..ccc1c49604 100644 --- a/rules.mak +++ b/rules.mak @@ -191,6 +191,20 @@ ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n) isempty = $(if $1,n,y) notempty = $(if $1,y,n) +# strequal +# Usage: $(call strequal, str1, str2) +# +# This macro returns a string (TRUE) when @str1 and @str2 +# are equal, else returns the empty string (FALSE) +strequal = $(if $(subst $2,,$1)$(subst $1,,$2),,$1) + +# startwith +# Usage: $(call startwith, startstr, fullstr) +# +# This macro returns a string (TRUE) when @fullstr starts with +# @startstr, else returns the empty string (FALSE) +startwith = $(findstring :$1,:$2) + # Generate files with tracetool TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py
Add a rule to test if two strings are equal, and another to test if a string starts with a substring, Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- rules.mak | 14 ++++++++++++++ 1 file changed, 14 insertions(+)