Can I verify in a makefile that a directory exists ?
For example if the dir already exists and I do mkdir <dir> it gives me an error. and the scripts execution ends. I don't want that. Can I do the verification in the makefile?
Can I verify in a makefile that a directory exists ?
For example if the dir already exists and I do mkdir <dir> it gives me an error. and the scripts execution ends. I don't want that. Can I do the verification in the makefile?
Two ways...
Attempt to make the directory, but do not exit the makefile on error.Code:default: - mkdir bin - mkdir bin - mkdir bin
Test for the directory before attempting to make it.Code:default: if [ ! -d bin ]; then mkdir bin; fi; if [ ! -d bin ]; then mkdir bin; fi; if [ ! -d bin ]; then mkdir bin; fi;
Callou collei we'll code the way
Of prime numbers and pings!
Another way of doing it (which should be more portable than QuestionC's second method) is to set each directory as a target:
Code:default: dirA dirB dirA: mkdir dirA dirB: mkdir dirB
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie