• Home
  • Raw
  • Download

Lines Matching +full:- +full:single +full:- +full:end

8 # nl-escape
10 # Usage: escape = $(call nl-escape[,escape])
16 nl-escape = $(if $(1),$(1),m822df3020w6a44id34bt574ctac44eb9f4n)
18 # escape-nl
20 # Usage: escaped-text = $(call escape-nl,text[,escape])
23 # single space each newline character in the output
30 # $(call unescape-nl...)
32 escape-nl = $(subst $(newline),$(call nl-escape,$(2)),$(1))
34 # unescape-nl
36 # Usage: text = $(call unescape-nl,escaped-text[,escape])
38 # See escape-nl.
40 unescape-nl = $(subst $(call nl-escape,$(2)),$(newline),$(1))
42 # shell-escape-nl
44 # Usage: $(shell some-command | $(call shell-escape-nl[,escape]))
51 # single-quotes, so be wary of the characters
54 define shell-escape-nl
55 awk 'NR==1 {t=$$0} NR>1 {t=t "$(nl-escape)" $$0} END {printf t}'
58 # shell-unescape-nl
60 # Usage: $(shell some-command | $(call shell-unescape-nl[,escape]))
67 # delimited by shell single-quotes, so be wary
74 define shell-unescape-nl
75 awk 'NR==1 {t=$$0} NR>1 {t=t "\n" $$0} END { gsub(/$(nl-escape)/,"\n",t); printf t }'
78 # escape-for-shell-sq
80 # Usage: embeddable-text = $(call escape-for-shell-sq,text)
84 # single-quotes.
86 escape-for-shell-sq = $(subst ','\'',$(1))
88 # shell-sq
90 # Usage: single-quoted-and-escaped-text = $(call shell-sq,text)
92 shell-sq = '$(escape-for-shell-sq)'
94 # shell-wordify
96 # Usage: wordified-text = $(call shell-wordify,text)
106 # | echo $(call shell-wordify,$(text))
119 # to render the text as a single line; when the shell
124 # produces the same results as the `$(shell-sq)' function.
126 shell-wordify = $(if $(findstring $(newline),$(1)),$(_sw-esc-nl),$(shell-sq))
127 define _sw-esc-nl
128 "$$(echo $(call escape-nl,$(shell-sq),$(2)) | $(call shell-unescape-nl,$(2)))"
131 # is-absolute
133 # Usage: bool-value = $(call is-absolute,path)
135 is-absolute = $(shell echo $(shell-sq) | grep -q ^/ && echo y)
139 # Usage: absolute-executable-path-or-empty = $(call lookup,path)
141 # (It's necessary to use `sh -c' because GNU make messes up by
144 lookup = $(call unescape-nl,$(shell sh -c $(_l-sh)))
145 _l-sh = $(call shell-sq,command -v $(shell-sq) | $(call shell-escape-nl,))
147 # is-executable
149 # Usage: bool-value = $(call is-executable,path)
151 # (It's necessary to use `sh -c' because GNU make messes up by
154 is-executable = $(call _is-executable-helper,$(shell-sq))
155 _is-executable-helper = $(shell sh -c $(_is-executable-sh))
156 _is-executable-sh = $(call shell-sq,test -f $(1) -a -x $(1) && echo y)
158 # get-executable
160 # Usage: absolute-executable-path-or-empty = $(call get-executable,path)
163 # the `command -v' is defined by POSIX, but it's not
168 get-executable = $(if $(1),$(if $(is-absolute),$(_ge-abspath),$(lookup)))
169 _ge-abspath = $(if $(is-executable),$(1))
171 # get-supplied-or-default-executable
173 # Usage: absolute-executable-path-or-empty = $(call get-executable-or-default,variable,default)
175 define get-executable-or-default
178 _ge_attempt = $(if $(get-executable),$(get-executable),$(call _gea_err,$(2)))