aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.github/workflows/makefile-escaping.yml32
-rw-r--r--makefile_escaping/escaping_env_vars.mk7
-rw-r--r--makefile_escaping/escaping_quotes.mk7
-rw-r--r--makefile_escaping/escaping_shell.mk7
-rw-r--r--makefile_escaping/prologue.mk6
-rw-r--r--makefile_escaping/quoting_args.mk7
6 files changed, 34 insertions, 32 deletions
diff --git a/.github/workflows/makefile-escaping.yml b/.github/workflows/makefile-escaping.yml
index ffce441..0a3c120 100644
--- a/.github/workflows/makefile-escaping.yml
+++ b/.github/workflows/makefile-escaping.yml
@@ -9,15 +9,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- - name: Make Makefile
- run: |
- cd makefile_escaping
- cp prologue.mk Makefile
- cat quoting_args.mk >> Makefile
- name: make test
run: |
cd makefile_escaping
- diff <( echo "$expected" ) <( make test )
+ diff <( echo "$expected" ) <( make -f quoting_args.mk test )
env:
expected: |-
printf '%s\n' Same line?
@@ -36,15 +31,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- - name: Make Makefile
- run: |
- cd makefile_escaping
- cp prologue.mk Makefile
- cat escaping_quotes.mk >> Makefile
- name: make test
run: |
cd makefile_escaping
- diff <( echo "$expected" ) <( make test )
+ diff <( echo "$expected" ) <( make -f escaping_quotes.mk test )
env:
expected: |-
printf '%s\n' 'Includes '\'' quote'
@@ -59,17 +49,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- - name: Make Makefile
- run: |
- cd makefile_escaping
- cp prologue.mk Makefile
- cat escaping_shell.mk >> Makefile
- name: make test
run: |
cd makefile_escaping
- diff <( echo "$expected_includes_quote" ) <( mkdir -p -- "Includes ' quote" && cd -- "Includes ' quote" && make -f ../Makefile test )
- diff <( echo "$expected_maybe_comment" ) <( mkdir -p -- 'Maybe a comment #' && cd -- 'Maybe a comment #' && make -f ../Makefile test )
- diff <( echo "$expected_variable_reference" ) <( mkdir -p -- 'Variable ${reference}' && cd -- 'Variable ${reference}' && make -f ../Makefile test )
+ diff <( echo "$expected_includes_quote" ) <( mkdir -p -- "Includes ' quote" && cd -- "Includes ' quote" && make -f ../escaping_shell.mk test )
+ diff <( echo "$expected_maybe_comment" ) <( mkdir -p -- 'Maybe a comment #' && cd -- 'Maybe a comment #' && make -f ../escaping_shell.mk test )
+ diff <( echo "$expected_variable_reference" ) <( mkdir -p -- 'Variable ${reference}' && cd -- 'Variable ${reference}' && make -f ../escaping_shell.mk test )
env:
expected_includes_quote: |-
Includes ' quote
@@ -98,15 +83,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- - name: Make Makefile
- run: |
- cd makefile_escaping
- cp prologue.mk Makefile
- cat escaping_env_vars.mk >> Makefile
- name: make test
run: |
cd makefile_escaping
- diff <( echo "$expected" ) <( test_var="Quote ' "'and variable ${reference}' make test )
+ diff <( echo "$expected" ) <( test_var="Quote ' "'and variable ${reference}' make -f escaping_env_vars.mk test )
env:
expected: |-
Quote ' and variable ${reference}
diff --git a/makefile_escaping/escaping_env_vars.mk b/makefile_escaping/escaping_env_vars.mk
index 7fdc087..35ea35d 100644
--- a/makefile_escaping/escaping_env_vars.mk
+++ b/makefile_escaping/escaping_env_vars.mk
@@ -1,3 +1,10 @@
+MAKEFLAGS += --warn-undefined-variables
+.DEFAULT_GOAL := all
+.DELETE_ON_ERROR:
+.SUFFIXES:
+SHELL := bash
+.SHELLFLAGS := -e -o pipefail -c
+
escape = $(subst ','\'',$(1))
test_var ?= This is safe.
diff --git a/makefile_escaping/escaping_quotes.mk b/makefile_escaping/escaping_quotes.mk
index 2d953f8..2a43f69 100644
--- a/makefile_escaping/escaping_quotes.mk
+++ b/makefile_escaping/escaping_quotes.mk
@@ -1,3 +1,10 @@
+MAKEFLAGS += --warn-undefined-variables
+.DEFAULT_GOAL := all
+.DELETE_ON_ERROR:
+.SUFFIXES:
+SHELL := bash
+.SHELLFLAGS := -e -o pipefail -c
+
escape = $(subst ','\'',$(1))
test_var := Includes ' quote
diff --git a/makefile_escaping/escaping_shell.mk b/makefile_escaping/escaping_shell.mk
index 23f8f30..c81eb98 100644
--- a/makefile_escaping/escaping_shell.mk
+++ b/makefile_escaping/escaping_shell.mk
@@ -1,3 +1,10 @@
+MAKEFLAGS += --warn-undefined-variables
+.DEFAULT_GOAL := all
+.DELETE_ON_ERROR:
+.SUFFIXES:
+SHELL := bash
+.SHELLFLAGS := -e -o pipefail -c
+
escape = $(subst ','\'',$(1))
cwd := $(shell basename -- "$$( pwd )")
diff --git a/makefile_escaping/prologue.mk b/makefile_escaping/prologue.mk
deleted file mode 100644
index 1c12914..0000000
--- a/makefile_escaping/prologue.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-MAKEFLAGS += --warn-undefined-variables
-.DEFAULT_GOAL := all
-.DELETE_ON_ERROR:
-.SUFFIXES:
-SHELL := bash
-.SHELLFLAGS := -e -o pipefail -c
diff --git a/makefile_escaping/quoting_args.mk b/makefile_escaping/quoting_args.mk
index d27c81d..ff55f51 100644
--- a/makefile_escaping/quoting_args.mk
+++ b/makefile_escaping/quoting_args.mk
@@ -1,3 +1,10 @@
+MAKEFLAGS += --warn-undefined-variables
+.DEFAULT_GOAL := all
+.DELETE_ON_ERROR:
+.SUFFIXES:
+SHELL := bash
+.SHELLFLAGS := -e -o pipefail -c
+
test_var := Same line?
export test_var