foo := who are you # For each "word" in foo, output that same word with an exclamation after bar := $(foreach wrd,$(foo),$(wrd)!) all: # Output is "who! are! you!" @echo $(bar)