(rss)
May 31, 2017
A Smart Alternative to `watch make`

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

Features:

I wrote it in response to this Stack Overflow question.

The source code is hosted on GitHub.

Install it

curl -s https://raw.githubusercontent.com/chr15m/watch-make/master/watch-make > ~/bin/watch-make
chmod 755 ~/bin/watch-make

Full source code

#!/bin/sh

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

Leave a comment

(use markdown syntax if you like)