What’s the easiest way to make a target depend on a file to be created, inside its recipe? I could use some shell magic:
target:
[ -e file ] || touch file
But ideally, I’d like to leave the test with make. Is it possible? The target commands should only run if the file doesn’t exist yet.
If you give more information about what you’re trying to accomplish, we may be able to help you better. Based on what you’ve said so far, it sounds like regular old
makeprerequisites should do the trick for you:If
filedoes not exist, it will be created; if it does, the commands forfilewill not be executed.