Generate new rules dynamically.
Section: Shell, call, eval, and generated rules
eval generated rules
makefile
makefile
define make-test-target
.PHONY: test-$(1)
test-$(1):
pytest -q tests/$(1)
endef
$(foreach p,unit integration e2e,$(eval $(call make-test-target,$(p))))Explanation
`eval` lets make parse generated text as makefile syntax.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Shell, call, eval, and generated rules