make_notes
This is an old revision of the document!
check if a file exists
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:-
- Documentation of the wildcard function - https://www.gnu.org/software/make/manual/html_node/Wildcard-Function.html
- Syntax of the conditional directives such as ifeq, ifneq etc., - https://www.gnu.org/software/make/manual/html_node/Conditional-Syntax.html
- Per https://stackoverflow.com/a/47828799/6305733 , the indentation level of ifneq should be same as that of the target name.
make_notes.1695599301.txt.gz · Last modified: 2023/09/24 23:48 by raju