Include file if exists on a Makefile
I found out that I can add the -
symbol in front of the include
call in a Makefile
, and that will check if the file exists before including, so it won't show any error if the file is not there. Here's an example:
-include .env
.PHONY: console
.env:
cp .env.example .env
console: ## Opens the App console.
iex -S mix
Tweet