Like the title says, I would like to make a dependency only if a certain file does not exist, NOT every time it updates.
I have a root directory (the one with the makefile) and in it a sub-directory called "example". In my root directory are four .h files (functions.h, parser.h, node.h, and exception.h) which I would like to copy to the "example" sub-directory if those .h files do not already exist in "examples".
Unfortunately I can not just make a standard dependency to check for the header files in "example" because each time I copy the header files from root to "example", the header files in "example" will be considered updated and will trigger that dependency each time I run make. I would like for a way to have my makefile copy the header files from the root directory to "example" only if they do not exist in "example".
$@) are valid only within the recipe. You cannot use them in targets, in prerequisites, or in make conditional statements (because those are expanded while the makefile is read in). In those cases,$@expands to the empty string. - MadScientist