My Makefile is very simple:
all:
[ -f MyFile ] && echo "MyFile exists"
Of course the recipe line begins with tab. If the file MyFile really exists, everything is ok. But if this file is not in the current directory I get:
Makefile:2: recipe for target 'all' failed make: *** [all] Error 1
I can get rid of this error using the if statement instead:
all:
if [ -f MyFile ]; then echo "MyFile exists"; fi
Both statements work fine in sh and bash outside make. It is unclear for me what is the reason of the make error when the conditional operator is used. An ideas what is going on?
make
implementations exceptgmake
. – schily Mar 17 '20 at 13:11