>On 2021-02-19 21:12, Cook, Malcolm wrote: >> Gnu manual reads: >> >> To ignore errors in a recipe line, write a '-' at the beginning of >> the line's text (after the initial tab)... >> >> I think it would be good if the implementation changed to allow instead >> >> To ignore errors in a recipe line, write a '-' as the first character >> of the line's text (immediately after the initial tab with no other >> preceding whitespace)... > >I don't see the difference. There isn't any whitespace allowed between >the >tab and the minus.
Why do you say this? According to what? > >In any case, this is a POSIX feature: > >Makefile command lines can have one or more of the following >prefixes: a <hyphen-minus> ( '-' ), an at-sign ( '@' ), or a ><plus-sign> ( '+' ). These shall modify the way in which make >processes the command. > >- If the command prefix contains a <hyphen-minus>, or the -i >option is present, or the special target .IGNORE has either >the current target as a prerequisite or has no prerequisites, >any error found while executing the command shall be ignored. > >@ If the command prefix contains an at-sign and the make >utility command line -n option is not specified, or the -s >option is present, or the special target .SILENT has either >the current target as a prerequisite or has no prerequisites, >the command shall not be written to standard output before it >is executed. > >+ If the command prefix contains a <plus-sign>, this >indicates a makefile command line that shall be executed even >if -n, -q, or -t is specified. > I guess what is not clearly defined at least to me is what constitutes a "prefix". Apparently whitespace gets ignored in looking for a prefix. To me this is unfortunate and what I am suggesting might be changed. >Experimenting with GNU Make, this succeeds for me, as expected, >with a diagnostic about the error being ignored: > >.PHONY: all > >all: >-false >echo foo > >This, with an added space, fails: > >.PHONY: all > >all: >- false >echo foo > > >> This would allow the use of '--' following an initial space after the >> tab to serve its usual role introducing an SQL comment, allowing >> commenting out selected lines of SQL statement within a HERE string. > >How are you embedding here strings into make recipes? That generally >doesn't work very well, unless perhaps you are using the GNU Make >extension which allows all of he lines of a recipe to be a single >shell script, rather than individual scripts. That is what I am doing, yes. .ONESHELL To me all this stuff about prefixes in the middle of a multiline recipe doesn't even make sense with .ONESHELL. >
