>> I have a problem I want to create a list of characters to pass to a function >> which >>calls subst over that list. I want to do something like this. >> >> my_chars:=1 2 3 4 5 6 7 8 9 >> >> my-subst=$(eval temp_variable := $1)$(foreach iter,$(my_chars),$(eval >> temp_variable:=$(subst $(iter),,$(temp_variable))))$(temp_variable) >> >> where my_chars could be simply $2. >> >> I'm new to 3.80 so I'm not very familiar of the capabilities of eval. Can I >> store >>temporary state within a foreach loop? This way I wouldn't need a lot of >>nested subst >>to implement this in make. (I can also do this with a program easily enough, >>but I >>want to try to implement it within make). >> >> Is there a way to make this kind of loop work in 3.80? > >I think what you are trying to do is remove certain characters from a list. >You can do >this like this: > >remove_these_characters := 1 2 3 4 5 6 7 8 9 > >my_subst=$(strip $(eval temp_variable := $2)$(foreach c,$1,$(eval >temp_variable := >$(subst $c,,$(temp_variable))))$(strip $(temp_variable))) > >bar := $(call my_subst,$(remove_these_characters),a1b a2c a3d drg) > >If you run that Makefile then the list 'a1b a2c a3d drg' has all numbers >removed from it >and bar ends up being 'ab ac ad drg'.
That's what I needed. For some reason, my eval wasn't working because after I installed make 3.80, my make wasn't updated until I closed the shell and reopened it, probably was linked to 3.79.1 somehow. Thanks, John D. _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
