# Bug in GNU Make 4.2.1 # # defining a variable that has been undefined in a foreach loop produce a # segfault on X64 machine. # # Disabling export avoid the sefault export # As same as disabling this part define DISCARD_ENV := templates from script format define discard_env $(foreach var,$(DISCARD_ENV),$(eval undefine $(var))) endef ARTIFACTS := build/a build/b # In this situation: defining a variable that has been undefined # in the foreach loop befaure causes the segfault: templates := t1.tpl t2.tpl # <---- format := qcow2 .PHONY: all all: $(ARTIFACTS) $(ARTIFACTS): @echo $@