Skip to content

Instantly share code, notes, and snippets.

@guoqiao
Last active October 27, 2022 21:58
Show Gist options
  • Save guoqiao/cdd68b50ad10b4fd02d3d2d94897217f to your computer and use it in GitHub Desktop.
Save guoqiao/cdd68b50ad10b4fd02d3d2d94897217f to your computer and use it in GitHub Desktop.
Makefile cheatsheet example

include .env and use envvar:

in your .env:

foo=bar

in your Makefile:

include .env

echo:
    @echo ${foo}
    @echo ${USER}

NOTE: you have to ref var with ${VAR}, not $VAR

Makefile can read envvars from both .env and your current shell:

make echo
bar
guoqiao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment