Is there a smarter alternative to “watch make”?

前端 未结 11 625
渐次进展
渐次进展 2021-02-01 15:28

I ran into this useful tip that if you\'re working on files a lot and you want them to build automatically you run:

watch make

And it re-runs make every couple s

11条回答
  •  猫巷女王i
    2021-02-01 16:08

    I do it this way in my Makefile:

    watch:
        (while true; do make build.log; sleep 1; done) | grep -v 'make\[1\]'
    
    build.log: ./src/*
        thecompiler | tee build.log
    

    So, it will only build when my source code is newer than my build.log, and the "grep -v" stuff removes some unnecessary make output.

提交回复
热议问题