我的Makefile中有以下内容,
dosomething:
ifeq (, $(shell which python))
$(error "Python not installed, please download and install Python to create database")
else
cd myfolder; python myfile.py
endif
当我运行make dosomething
时,它引发错误,告诉我下载并安装python。但是当我在外壳中执行which python
时,它会显示/usr/bin/python
不确定这是怎么回事
答案 0 :(得分:2)
我猜缩进的行以制表符开头吗?如果是这样,那么ifeq
,else
和endif
伪指令将被视为命令的一部分,并传递给Shell执行。
要确保make
评估这些指令,请删除前导制表符...
dosomething:
ifeq (, $(shell which python))
$(error "Python not installed, please download and install Python to create database")
else
cd myfolder; python myfile.py
endif