From 6c569b8b68e3bd95e5658fafba7ce49c3cf3d585 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 29 May 2020 22:56:51 +0000 Subject: makefile_escaping: rename *.mk files --- .github/workflows/makefile-escaping.yml | 6 +++--- makefile_escaping/env_vars.mk | 22 ---------------------- makefile_escaping/escaping_env_vars.mk | 22 ++++++++++++++++++++++ makefile_escaping/escaping_quotes.mk | 11 +++++++++++ makefile_escaping/escaping_shell.mk | 21 +++++++++++++++++++++ makefile_escaping/quotes.mk | 11 ----------- makefile_escaping/shell.mk | 21 --------------------- 7 files changed, 57 insertions(+), 57 deletions(-) delete mode 100644 makefile_escaping/env_vars.mk create mode 100644 makefile_escaping/escaping_env_vars.mk create mode 100644 makefile_escaping/escaping_quotes.mk create mode 100644 makefile_escaping/escaping_shell.mk delete mode 100644 makefile_escaping/quotes.mk delete mode 100644 makefile_escaping/shell.mk diff --git a/.github/workflows/makefile-escaping.yml b/.github/workflows/makefile-escaping.yml index ca26e60..ffce441 100644 --- a/.github/workflows/makefile-escaping.yml +++ b/.github/workflows/makefile-escaping.yml @@ -40,7 +40,7 @@ jobs: run: | cd makefile_escaping cp prologue.mk Makefile - cat quotes.mk >> Makefile + cat escaping_quotes.mk >> Makefile - name: make test run: | cd makefile_escaping @@ -63,7 +63,7 @@ jobs: run: | cd makefile_escaping cp prologue.mk Makefile - cat shell.mk >> Makefile + cat escaping_shell.mk >> Makefile - name: make test run: | cd makefile_escaping @@ -102,7 +102,7 @@ jobs: run: | cd makefile_escaping cp prologue.mk Makefile - cat env_vars.mk >> Makefile + cat escaping_env_vars.mk >> Makefile - name: make test run: | cd makefile_escaping diff --git a/makefile_escaping/env_vars.mk b/makefile_escaping/env_vars.mk deleted file mode 100644 index 7fdc087..0000000 --- a/makefile_escaping/env_vars.mk +++ /dev/null @@ -1,22 +0,0 @@ -escape = $(subst ','\'',$(1)) - -test_var ?= This is safe. -test_var := $(value test_var) -export test_var - -inner_var := Inner variable -outer_var := Outer variable - $(inner_var) - $(test_var) - -echo_test_var := printf '%s\n' '$(call escape,$(test_var))' -bash_test_var := bash -c '$(call escape,$(echo_test_var))' - -echo_outer_var := printf '%s\n' '$(call escape,$(outer_var))' - -.PHONY: test -test: - @printf '%s\n' '$(call escape,$(test_var))' - @printf '%s\n' "$$test_var" - @bash -c '$(call escape,$(echo_test_var))' - @bash -c '$(call escape,$(bash_test_var))' - @printf '%s\n' '$(call escape,$(outer_var))' - @bash -c '$(call escape,$(echo_outer_var))' diff --git a/makefile_escaping/escaping_env_vars.mk b/makefile_escaping/escaping_env_vars.mk new file mode 100644 index 0000000..7fdc087 --- /dev/null +++ b/makefile_escaping/escaping_env_vars.mk @@ -0,0 +1,22 @@ +escape = $(subst ','\'',$(1)) + +test_var ?= This is safe. +test_var := $(value test_var) +export test_var + +inner_var := Inner variable +outer_var := Outer variable - $(inner_var) - $(test_var) + +echo_test_var := printf '%s\n' '$(call escape,$(test_var))' +bash_test_var := bash -c '$(call escape,$(echo_test_var))' + +echo_outer_var := printf '%s\n' '$(call escape,$(outer_var))' + +.PHONY: test +test: + @printf '%s\n' '$(call escape,$(test_var))' + @printf '%s\n' "$$test_var" + @bash -c '$(call escape,$(echo_test_var))' + @bash -c '$(call escape,$(bash_test_var))' + @printf '%s\n' '$(call escape,$(outer_var))' + @bash -c '$(call escape,$(echo_outer_var))' diff --git a/makefile_escaping/escaping_quotes.mk b/makefile_escaping/escaping_quotes.mk new file mode 100644 index 0000000..2d953f8 --- /dev/null +++ b/makefile_escaping/escaping_quotes.mk @@ -0,0 +1,11 @@ +escape = $(subst ','\'',$(1)) + +test_var := Includes ' quote + +echo_test_var := printf '%s\n' '$(call escape,$(test_var))' +bash_test_var := bash -c '$(call escape,$(echo_test_var))' + +test: + printf '%s\n' '$(call escape,$(test_var))' + bash -c '$(call escape,$(echo_test_var))' + bash -c '$(call escape,$(bash_test_var))' diff --git a/makefile_escaping/escaping_shell.mk b/makefile_escaping/escaping_shell.mk new file mode 100644 index 0000000..23f8f30 --- /dev/null +++ b/makefile_escaping/escaping_shell.mk @@ -0,0 +1,21 @@ +escape = $(subst ','\'',$(1)) + +cwd := $(shell basename -- "$$( pwd )") +export cwd + +inner_var := Inner variable +outer_var := Outer variable - $(inner_var) - $(cwd) + +echo_cwd := printf '%s\n' '$(call escape,$(cwd))' +bash_cwd := bash -c '$(call escape,$(echo_cwd))' + +echo_outer_var := printf '%s\n' '$(call escape,$(outer_var))' + +.PHONY: test +test: + @printf '%s\n' '$(call escape,$(cwd))' + @printf '%s\n' "$$cwd" + @bash -c '$(call escape,$(echo_cwd))' + @bash -c '$(call escape,$(bash_cwd))' + @printf '%s\n' '$(call escape,$(outer_var))' + @bash -c '$(call escape,$(echo_outer_var))' diff --git a/makefile_escaping/quotes.mk b/makefile_escaping/quotes.mk deleted file mode 100644 index 2d953f8..0000000 --- a/makefile_escaping/quotes.mk +++ /dev/null @@ -1,11 +0,0 @@ -escape = $(subst ','\'',$(1)) - -test_var := Includes ' quote - -echo_test_var := printf '%s\n' '$(call escape,$(test_var))' -bash_test_var := bash -c '$(call escape,$(echo_test_var))' - -test: - printf '%s\n' '$(call escape,$(test_var))' - bash -c '$(call escape,$(echo_test_var))' - bash -c '$(call escape,$(bash_test_var))' diff --git a/makefile_escaping/shell.mk b/makefile_escaping/shell.mk deleted file mode 100644 index 23f8f30..0000000 --- a/makefile_escaping/shell.mk +++ /dev/null @@ -1,21 +0,0 @@ -escape = $(subst ','\'',$(1)) - -cwd := $(shell basename -- "$$( pwd )") -export cwd - -inner_var := Inner variable -outer_var := Outer variable - $(inner_var) - $(cwd) - -echo_cwd := printf '%s\n' '$(call escape,$(cwd))' -bash_cwd := bash -c '$(call escape,$(echo_cwd))' - -echo_outer_var := printf '%s\n' '$(call escape,$(outer_var))' - -.PHONY: test -test: - @printf '%s\n' '$(call escape,$(cwd))' - @printf '%s\n' "$$cwd" - @bash -c '$(call escape,$(echo_cwd))' - @bash -c '$(call escape,$(bash_cwd))' - @printf '%s\n' '$(call escape,$(outer_var))' - @bash -c '$(call escape,$(echo_outer_var))' -- cgit v1.2.3