Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are on a platform that supports <a href="http://linux.die.net/man/1/inotifywait" rel="nofollow noreferrer"><code>inotifywait</code></a> (to my knowledge, only Linux; but since you asked about Make, it seems there's a good chance you're on Linux; for OS X, see <a href="https://stackoverflow.com/q/1515730/834176">this question</a>), you can do something like this:</p> <pre><code>inotifywait --exclude '.*\.swp|.*\.o|.*~' --event MODIFY -q -m -r . | while read do make done </code></pre> <p>Breaking that down:</p> <pre><code>inotifywait </code></pre> <p>Listen for file system events.</p> <pre><code>--exclude '.*\.swp|.*\.o|.*~' </code></pre> <p>Exclude files that end in <code>.swp</code>, <code>.o</code> or <code>~</code> (you'll probably want to add to this list).</p> <pre><code>--event MODIFY </code></pre> <p>When you find one print out the filepath of the file for which the event occurred.</p> <pre><code>-q </code></pre> <p>Do not print startup messages (so make is not prematurely invoked).</p> <pre><code>-m </code></pre> <p>Listen continuously.</p> <pre><code>-r . </code></pre> <p>Listen recursively on the current directory. Then it is piped into a simple loop which invokes make for every line read.</p> <p>Tailor it to your needs. You may find <code>inotifywait --help</code> and the manpage helpful.</p> <hr> <p>Here is a more detailed script. I haven't tested it much, so use with discernment. It is meant to keep the build from happening again and again needlessly, such as when switching branches in Git.</p> <pre><code>#!/bin/sh datestampFormat="%Y%m%d%H%M%S" lastrun=$(date +$datestampFormat) inotifywait --exclude '.*\.swp|.*\.o|.*~' \ --event MODIFY \ --timefmt $datestampFormat \ --format %T \ -q -m -r . | while read modified; do if [ $modified -gt $lastrun ]; then make lastrun=$(date +$datestampFormat) fi done </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload