aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/makefile_escaping/escaping_quotes.mk
blob: 13835e76c2d55d654a0c274f916b49d3146e03de (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11






                                       



                             
                  
                                                           
                            





                                                          
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

# printf $test_var
echo_test_var := printf '%s\n' '$(call escape,$(test_var))'
# bash -c 'printf $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))'