I want to check if source file exist, so I assign TO_DIR=/dev/null in my gnu makefile.
APPS=a b c d
install:
cp $(APPS) $(TO_DIR)
- for normal case, I’ll run ‘TO_DIR=~/bin make install’
- for test case(just make sure file exist for copy), I’ll run ‘TO_DIR=/dev/null make install’
But it will failed, because /dev/null is not a pseudo directory.
Is there better solution?
You could do another make target, like this:
fileutility will check the existence of all the files and fail when any of these does not exist. Its output is excessive for this task, so we pipe it to/dev/nullYou will run check like this: