在我的Makefile中,我需要测试当前目录是否是SVN repo,如果不是,我想在Makefile中使用$(error)指令指出错误.
所以我打算使用$(shell svn info.)的返回值,但我不确定如何从Makefile中获取此值.
注意:我不是试图在配方中获取返回值,而是在Makefile的中间.
现在我正在做这样的事情,这只是因为stdout在出错时是空白的:
- SVN_INFO := $(shell svn info . 2> /dev/null)
- ifeq ($(SVN_INFO),)
- $(error "Not an SVN repo...")
- endif
我仍然想知道是否有可能在Makefile中获取返回值.
用$怎么样?回显最后一个命令的退出状态?
- SVN_INFO := $(shell svn info . 2> /dev/null; echo $$?)
- ifeq ($(SVN_INFO),1)
- $(error "Not an SVN repo...")
- endif