1 makefile
我正在尝试这样做..... 这就是我的 Makefile 的样子
.PHONY: run
SHELL := /bin/tcsh
run:
md5sum -c md; \
if ($$?==0) then \
echo "PASS" \
else \
echo "FAIL" \
endif
Run Code Online (Sandbox Code Playgroud)
但我得到了这个错误。
if: Badly formed number.
make: *** [run] Error 1
Run Code Online (Sandbox Code Playgroud)
我在做什么正确吗?或者在 Makefile 中有更好的方法吗?
基本上,您永远不应该使用csh(或tcsh) 来编写 makefile 规则。使用 POSIX shell 编写规则:
.PHONY: run
run:
md5sum -c md; \
if [ $$? -eq 0 ]; then \
echo "PASS"; \
else \
echo "FAIL"; \
fi
Run Code Online (Sandbox Code Playgroud)