I have a Makefile where I want to load environment variables placed in .env file.
I am using the include directive to achieve this.
-include .env
I also have an help target to display the available tasks:
help: ## Displays help menu
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
The problem is that when using together with the include directive, it doesnt work correctly. The help task just shows "Makefile" as name for all the targets.
The $(MAKEFILE_LIST) returns "Makefile, .env" instead of the target names, so I guess it became messed up with the .env somehow.
I don´t know enough about Makefiles to understand what´s wrong.
Any ideas?
Thanks you.