Loading .env
variables in Makefile
If you’re using a Makefile and need to make use of variables from a .env
file, you can add
ifneq (,$(wildcard ./.env))
include .env
export
endif
to the top of the Makefile. Then you can use those like in any shell script. (e.g. @echo "${HOST}"
)