diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-05-30 22:29:37 +0000 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-05-30 22:39:58 +0000 |
commit | 57f3fc6408539a2fa53199e78195c6f1494873fe (patch) | |
tree | 0b7b69f59de92b9d9bf51dfe9c013c29928e6ac4 | |
parent | makefile_escaping: more concise test cases (diff) | |
download | blog-57f3fc6408539a2fa53199e78195c6f1494873fe.tar.gz blog-57f3fc6408539a2fa53199e78195c6f1494873fe.zip |
makefile_escaping: formatting
-rw-r--r-- | .github/workflows/makefile-escaping.yml | 4 | ||||
-rw-r--r-- | makefile_escaping/escaping_env_vars.mk | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/.github/workflows/makefile-escaping.yml b/.github/workflows/makefile-escaping.yml index e2dbf6c..9c8df3b 100644 --- a/.github/workflows/makefile-escaping.yml +++ b/.github/workflows/makefile-escaping.yml @@ -87,8 +87,8 @@ jobs: diff <( echo "$expected_overridden" ) <( make -f escaping_env_vars.mk test test_var="Quote ' "'and variable ${reference}' ) env: expected_default: |- - New simple value (in test_var) - Composite value - New simple value - New simple value (in test_var) + New simple value in test_var + Composite value - New simple value - New simple value in test_var expected_tricky: |- Quote ' and variable ${reference} Composite value - New simple value - Quote ' and variable ${reference} diff --git a/makefile_escaping/escaping_env_vars.mk b/makefile_escaping/escaping_env_vars.mk index f2e7a2d..5ec61ee 100644 --- a/makefile_escaping/escaping_env_vars.mk +++ b/makefile_escaping/escaping_env_vars.mk @@ -7,22 +7,22 @@ SHELL := bash escape = $(subst ','\'',$(1)) -define escape_env +define escape_arg ifeq ($$(origin $(1)),environment) -$(1) := $$(value $(1)) + $(1) := $$(value $(1)) endif ifeq ($$(origin $(1)),environment override) -$(1) := $$(value $(1)) + $(1) := $$(value $(1)) endif ifeq ($$(origin $(1)),command line) -override $(1) := $$(value $(1)) + override $(1) := $$(value $(1)) endif endef simple_var := Simple value -test_var ?= $(simple_var) (in test_var) -$(eval $(call escape_env,test_var)) +test_var ?= $(simple_var) in test_var +$(eval $(call escape_arg,test_var)) simple_var := New simple value composite_var := Composite value - $(simple_var) - $(test_var) |