3 ms·
That's interesting. Author probably wants to use `private` for those target-local variables, though. For example, R: .SHELLFLAGS := -e R: SHELL := Rs
by brandmeyer 6y ago
That's interesting.
Author probably wants to use `private` for those target-local variables, though.
For example,
R: .SHELLFLAGS := -e
R: SHELL := Rscript
R:
greeting = "bonjour"
message(paste0(greeting, ", R!"))
Everything that target `R` depends on will also have SHELL and .SHELLFLAGS over-ridden. If `R` depends on some data generated by another program, it probably wants to be built and executed with the default SHELL (or another shell, perhaps).
R: private .SHELLFLAGS := -e
R: private SHELL := Rscript
R:
greeting = "bonjour"
message(paste0(greeting, ", R!"))
Now, `R`'s dependencies will be generated with the makefile's defaults.
Usually I prefer to build up richer stages like this using the system shell anyway, though. Build a target which in turn is executed by the shell normally to traverse the next edge in the graph. But I can see how this mechanism has its uses.
See also https://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html https://www.gnu.org/software/make/manual/html_node/Target_00...
- sciencerobot 6y agoI didn't know about private. Thanks for the tip.