aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/makefile_escaping/escaping_shell.mk
blob: 365e6ffba61a32460df8660c17a8b90bb09afa14 (plain) (tree)
1
2
3
4
5
6
7
8
                                                                                 
                  



                    
                                 
 


                                       
 
                          
                                                         
 


                                              
                                                        
MAKEFLAGS += --no-builtin-rules --no-builtin-variables --warn-undefined-variables
unexport MAKEFLAGS
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c

escape = $(subst ','\'',$(1))

cwd := $(shell basename -- "$$( pwd )")

simple_var := Simple value
composite_var := Composite value - $(simple_var) - $(cwd)

.PHONY: test
test:
	@printf '%s\n' '$(call escape,$(cwd))'
	@printf '%s\n' '$(call escape,$(composite_var))'