diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2020-01-13 14:26:10 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2020-01-13 14:26:10 +0100 |
commit | 49eb5405debb49d19c58f966b4fceac9ea9571ae (patch) | |
tree | 06e1fda08307b0838ea3fdbc5e0278a9f321a448 /GNUmakefile | |
parent | 68fd40e4fce33b19f946f54388a4016ab32998e0 (diff) | |
download | wallabag-49eb5405debb49d19c58f966b4fceac9ea9571ae.tar.gz wallabag-49eb5405debb49d19c58f966b4fceac9ea9571ae.tar.zst wallabag-49eb5405debb49d19c58f966b4fceac9ea9571ae.zip |
Ensure ENV is well defined when using make
This command should fail before calling other commands (which will fail to because the environment is wrong):
```
ENV=toto make install
```
Diffstat (limited to 'GNUmakefile')
-rwxr-xr-x | GNUmakefile | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/GNUmakefile b/GNUmakefile index 865b35e8..db87c5d2 100755 --- a/GNUmakefile +++ b/GNUmakefile | |||
@@ -2,7 +2,17 @@ SHELL=bash | |||
2 | TMP_FOLDER=/tmp | 2 | TMP_FOLDER=/tmp |
3 | RELEASE_FOLDER=wllbg-release | 3 | RELEASE_FOLDER=wllbg-release |
4 | 4 | ||
5 | ENV ?= prod | 5 | # ensure the ENV variable is well defined |
6 | ifeq ($(origin ENV), prod) | ||
7 | # all good ("prod" is a valid env) | ||
8 | else ifeq ($(origin ENV), dev) | ||
9 | # all good ("dev" is a valid env) | ||
10 | else ifeq ($(origin ENV), test) | ||
11 | # all good ("test" is a valid env) | ||
12 | else | ||
13 | # not good, force it to "prod" | ||
14 | override ENV = prod | ||
15 | endif | ||
6 | 16 | ||
7 | help: ## Display this help menu | 17 | help: ## Display this help menu |
8 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | 18 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |