Is there a way to do such thing in a makefile for gmake:
GOALS := g1
define fun_one
@echo "blabla" #this causes an error - maybe can't be recognized as a recipe
endef
define fun_two
$(1):
$(eval $(call fun_one,$(1)))
endef
$(forech goal, $(GOALS), $(eval $(call fun_two,$(goal))))
all: ${GOALS}
As far as I understand, I can’t define a part of a recipe outside a function that defines a rule, am I write?
There’s no need for the first
eval; it just tells Make to enact that line while it’s still parsing the definition of fun_one. Eliminate the eval and the makefile will work: