Skip to content

Instantly share code, notes, and snippets.

@mstrehler
Created March 22, 2016 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mstrehler/32bbadb7483cbe6574d7 to your computer and use it in GitHub Desktop.
Save mstrehler/32bbadb7483cbe6574d7 to your computer and use it in GitHub Desktop.
the snippet checks for the existence of a file from within a Makefile.
# from make documentation.
# $(wildcard pattern): 'pattern' is a file name pattern [...].
# The result of wildcard is a space-separated
# list of the names of existing files that match the pattern.
path2file = test.txt
ifneq ("$(wildcard $(path2file))","")
fileexists = 1
else
fileexists = 0
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment