4 ms·
It is per target, that's how it works when I've used it. For example: # Makefile SHELL := bash .ONESHELL: .RECIPEPREFIX = > thing1: > FOO=bar
by h4l 4y ago
It is per target, that's how it works when I've used it. For example:
# Makefile
SHELL := bash
.ONESHELL:
.RECIPEPREFIX = >
thing1:
> FOO=bar
> echo "$${FOO:?}"
.PHONY: thing1
thing2:
> echo "$${FOO:?}"
.PHONY: thing2
Results in:
$ make thing1 thing2
FOO=bar
echo "${FOO:?}"
bar
echo "${FOO:?}"
bash: line 1: FOO: parameter null or not set
Note how the bash error for unset FOO is line 1 for the second target.
Edit: Maybe I misinterpreted, do you mean you'd want to choose whether a given target is ONESHELL or not?
- zelphirkalt 4y ago> [...] do you mean you'd want to choose whether a given target is ONESHELL or not? Yep, exactly! I would like to have some targets use ONESHELL and others in the same Makefile not use ONESHELL. So that I can choose the most appropriate for each target. So far I have managed by avoiding ONESHELL and doing the typical "backslash, next line continues" thingy. But it puts some people off.