Test whether a directory exists inside a makefile

前端 未结 7 1419
-上瘾入骨i
-上瘾入骨i 2020-12-23 09:11

In his answer @Grundlefleck explains how to check whether a directory exists or not. I tried some to use this inside a makefile as follow:

foo.b         


        
7条回答
  •  独厮守ぢ
    2020-12-23 09:25

    There is a very different answer that allows you to use your if statements as you envisioned them in one shell:

    .ONESHELL:
    foo.bak: foo.bar
        echo "foo"
        if [ -d "~/Dropbox" ]; then
            echo "Dir exists"
        fi
    

    Note that the only difference is the ONESHELL special target.

提交回复
热议问题