I just discovered GNU make's $(foreach) function, and I'm following the foreach-eval-call pattern used in the documentation; for instance,
graphviz_progs := dot neato circo fdp
define LAYOUT_template
%-$(1).dot: %.dot
$(1) -Tdot $$? > $$@
endef
$(foreach p, $(graphviz_progs), \
$(eval $(call LAYOUT_template,$(p))) \
)
This works pretty well: $(foreach) function treats $(graphviz_progs) as a space-separated list of items and iterates over each of them.
Now my problem is that I frequently want to iterate over a list of items one of which is the empty string.
Is this possible in GNU make? (I can think of a workaround, but having the empty item in my list would be cleaner.)