Hello GNU Makers,
I stumbled on a simple feature which I thought should be very doable in GNU
Make (I use 3.82)
but found it stubbornly resisting a make-bulitins based solution. 😞
Wanted to do a lowercase => uppercase conversion so wrote this (picked from
stackoverflow)
lc = $(subst a,A,$(subst b,B,$(subst c,C,.....,$(subst z,Z,$1))....)
As is, the above works. But I wanted to bring in "eval" here to avoid typing
this whole thing.😎
But to my utter surprise & then dismay, I found it impossible to write the RHS
in any manner amenable to be eval-ed.
I am sure someone would have been thru this & would have resolved this. I would
like to know how gnu-make can do such an expression.
my attempt looked like: ( assuming just 5 characters)
L1 := a b c d e
L2 := A B C D E
lp := (
rp := )
uc = $(strip \
$(foreach i,$(join $(addsuffix /,$(L1)),$(L2)),\
\$$$(lp)subst $(word 1,$(subst /,,$i)),$(word 2,$(subst /,,$i)),)\
$1\
$(patsubst %,$(rp),$(L1))\
)
# usage: $(call uc, input_string)
Thanks,
Rakesh
_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make