Вы можете сделать это с помощью gmtt полностью внутри GNUmake. Это не так просто, как в полноценном языке программирования, но, по крайней мере, оно переносимо и не зависит от внешних оболочек и инструментов.
include gmtt/gmtt.mk
VAR_LIST = "item1" "item2" "item 3 that has spaces" "item4"
# make a prefix-list by splitting at ". This will yield superfluous space
# characters between the items, but we can eliminate them later
prefix-list := $(call chop-str-spc,$(VAR_LIST),A $(-alnum-as-str))
$(info $(prefix-list))
# Now we select the data payload from the prefix-list. Spaces inside items
# are still encoded as $(-spacereplace) characters, which is good as we have
# a normal make list this way
string-list := $(call get-sufx-val,$(prefix-list),A,,100)
$(info $(string-list))
# Using get-sufx-val() is fine, but we can have it even simpler, by dropping
# the prefix, as we have only one in the list anyway:
string-list := $(call drop-prfx,$(prefix-list))
# Now step through the list with a normal for loop, converting $(-spacereplace)
# back to real spaces
$(foreach item,$(string-list),$(if $(strip $(call spc-unmask,$(item))),\
$(info [$(call spc-unmask,$(item))])))
Выход:
$ make
A¤item1 A¤§ A¤item2 A¤§ A¤item§3§that§has§spaces A¤§ A¤item4
item1 § item2 § item§3§that§has§spaces § item4
[item1]
[item2]
[item 3 that has spaces]
[item4]