dongqiao8421
dongqiao8421
2016-07-15 22:52
浏览 31

makefile中的make规则总是成功

Here is my makefile for my golang project:

.PHONY: killall

run: install
   ./bin/chunkserver&; ./bin/master&

install: clean
    go install godfs/chunkserver godfs/master

clean: killall
    rm -f bin/master bin/chunkserver

killall:
    kill -9 $$(lsof -t bin/* 2>/dev/null) 2>/dev/null

When I run make install it shows this error:

make: *** [killall] Error 2

I need return some code to make to indicate that killall rule is always succeed, but I don`t know how.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doubi3996
    doubi3996 2016-07-15 23:02
    已采纳

    You can tell make to ignore errors in a recipe by prepending -:

    -kill -9 $$(lsof -t bin/* 2>/dev/null) 2>/dev/null
    
    点赞 评论

相关推荐