You can use the wildcard function to check if a file exists. For example
uninstall: ifneq ($(wildcard /usr/local/share/anki/uninstall.sh),) sudo /usr/local/share/anki/uninstall.sh endif
will run the uninstall.sh script only if it exists.
Ref:-
make -f foo.mk