Running shell causes very poor parse performance. Not a problem in small builds but when you get to bigger ones you'll regret using it. It's worse on windows/cygwin of course.
Nowadays you could write a plugin function (make 4.0 and above). If that's not suitable then are other ways to do it that also aren't brilliant but slightly faster than invoking a shell. # A macro for converting a string to uppercase uppercase_TABLE:=a,A b,B c,C d,D e,E f,F g,G h,H i,I j,J k,K l,L m,M n,N o,O p,P q,Q r,R s,S t,T u,U v,V w,W x,X y,Y z,Z define uppercase_internal $(if $1,$$(subst $(firstword $1),$(call uppercase_internal,$(wordlist 2,$(words $1),$1),$2)),$2) endef define uppercase $(eval uppercase_RESULT:=$(call uppercase_internal,$(uppercase_TABLE),$1))$(uppercase_RESULT) endef from: https://bitbucket.org/tnmurphy/raptor/src/fbb2e624d320e5eabc0689105e2f2b80d131ca03/lib/flm/flmtools.mk?at=default Regards, Tim On 10 September 2013 13:09, Paul Smith <[email protected]> wrote: > On Tue, 2013-09-10 at 10:09 +0100, Matej Kosik wrote: >> I am trying to figure out how to convert words to upper case. >> >> Make itself does not seem to have dedicated function for this >> particular task, unless I am mistaken, so I guess I had to rely on >> bash. > >> In bash, something like this: >> var=foo; echo ${var^} >> works fine. I get: >> Foo >> >> However, if I try to embed this command with my makefile like this: >> $(shell var=foo; echo $${var^}) >> then I get: >> /bin/sh: 1: Bad substitution > > That's because make does not invoke bash. Make invokes /bin/sh, which > is a POSIX compliant shell, so it doesn't understand many of the special > bash extensions (note that even if /bin/sh is actually bash, when > invoked as /bin/sh it disables many of bash's extended features). > > It's best not to rely on this anyway, as it's not portable at all. > >> I am not sure what exactly that string expands to by make before it is >> passed to bash so I am not sure which escape characters are missing >> (if that is the problem). > > It is not the problem. Try this from the command line: > > /bin/sh -c 'var=foo; echo ${var^}' > > To write this portably you can use the tr(1) program: > > $(shell echo foo | tr a-z A-Z) > > Or if you want to do it with make built-ins you can look at the GMSL: > > http://gmsl.sourceforge.net/ > > > > _______________________________________________ > Help-make mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-make -- You could help some brave and decent people to have access to uncensored news by making a donation at: http://www.thezimbabwean.co.uk/friends/ _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
