Skip to content

Instantly share code, notes, and snippets.

@aprell
Created August 22, 2017 12:56
Show Gist options
  • Save aprell/6886fef4e0c79a92cec0f3fabe1e8604 to your computer and use it in GitHub Desktop.
Save aprell/6886fef4e0c79a92cec0f3fabe1e8604 to your computer and use it in GitHub Desktop.
GNU make special target: .ONESHELL
.ONESHELL:
foo:
@foo=defined
echo $${foo:-undefined}
.PHONY: foo
@aprell
Copy link
Author

aprell commented Aug 22, 2017

From https://www.gnu.org/software/make/manual/html_node/Special-Targets.html:

If .ONESHELL is mentioned as a target, then when a target is built all lines of the recipe will be given to a single invocation of the shell rather than each line being invoked separately.

See also: https://www.gnu.org/software/make/manual/html_node/One-Shell.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment