I have a Makefile that looks as follows:
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS = -e
clean:
rm -f foo
.PHONY: clean
foo doesn't exist. When I run this on Debian, GNU Make 4.1 I get this error:
rm -f foo
/bin/bash: rm -f foo: No such file or directory
Makefile:6: recipe for target 'clean' failed
make: *** [clean] Error 1
When I run it on macOS, GNU Make 3.81 it works as expected. It makes no difference if I write -rm -f instead of rm -f.
Why do I get the error? Running bash -e -c "rm -f foo" ; echo $? in a shell prints 0 on both systems.
Am I missing something?