When writing code, there are several approaches.

Besides using make and its little brother watch, occasially I use the middle-tool inotify.

Inotify (inode notify) is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem, and report those changes to applications. It replaces an earlier facility, dnotify, which had similar goals. (Wikipedia)

With the situation, where a process take a couple of seconds but it not that complicate that I need to write a makefile for that, inotify offers another solution.What it does is it basically monitors changes in the file system in a given directory (and its subdirectories). Whenever a change there (of any kind) happens, it triggers a command.

I melted this into a little script (that certainly could be improved) and got the idea from here. It does its job for now:

#!/usr/bin/env bash
# 
# Run Inotify to act on commands when something
# changes in the current directory

FORMAT=$(echo -e "\033[1;33m%w%f\033[0m written %T")
"$@"
while inotifywait -qre modify --format "$FORMAT" --timefmt '%Y-%m-%d %H:%M:%S' --exclude '\.(swp|swx|lock)' .
do 
  sleep 0.5
  "$@"
done

The script takes only one parameter: The command that is supposed to run when a change occures

I am sure you’ll find a fitting scenario.