May 31, 2017

watch-make is a script that rebuilds your project only when make detects it needs a rebuild, for example when source files change.


  • Works with any existing Makefile based project.
  • No dependencies apart from make.
  • Passes any arguments to make (such as -C mydir).
  • Silent if there is nothing to build and does not swallow output when there is.

I wrote it in response to this Stack Overflow question.

The source code is hosted on GitHub.

Install it

curl -s > ~/bin/watch-make
chmod 755 ~/bin/watch-make

Full source code


while true;
  if ! make -q "$@";
    echo "#-> Starting build: `date`"
    make "$@";
    echo "#-> Build complete."
  sleep 0.5;

twitter github instagram