這一個 是動作不多的時候,利用 "一行" 的特性..
foo.bak: foo.bar
echo "foo"
if [ -d "~/Dropbox" ]; then echo "Dir exists"; fi
或
oo.bak: foo.bar
echo "foo"
if [ -d "~/Dropbox" ]; then \
echo "Dir exists"; \
fi
另外這一篇 前同事的 blog,是一般的,用 wildcard檢查好 create...
OUTPUT_PATH := test
all:
ifeq "$(wildcard $(OUTPUT_PATH))" ""
mkdir $(OUTPUT_PATH)
echo "directory not existed"
else
echo "directory existed"
endif
還有一個,看起來好像比較笨..在Makefile 中 call shell command 來做...
ifeq ($(shell [ -d $(OUTPUT_PATH) ] && echo y), y)
echo "directory existed"
else
echo "directory not existed"
endif
沒有留言:
張貼留言