[linux-elitists] Fun* with inotify and make

Teh Entar-Nick nick at teh.entar.net
Mon Jul 29 04:04:52 PDT 2013


Don Marti:
> Arr, if only we had a program that would parse
> Makefiles...
> 
> _make_prereqs() {
>     make -dnr $* | tr ' ' '\n' | \
>         grep ".*'.$" | grep -o '\w.*\b'
> }

Good one!  You'll want an inotify to refresh this when the Makefile
itself changes, of course.

Only problem I see is that you're pulling out all files, including
*target* files.  That could get annoying when e.g. I pull up a .html
file in vim to try something out, and when I save it my hack gets
reverted automatically.

Also, it seems to ignore explicit prerequisites!  If I put a
metadata.xml to CC-license my epub files, it never shows up in that
output:

    %.epub: %.md %_cover.jpeg metadata.xml
            pandoc -S --epub-metadata=metadata.xml --epub-cover-image=$*_cover.jpeg -o $@ $<

Alas:

    $ make -dnr all | grep -c xml
    0
    $ make -dnr foo.epub | grep -c xml
    7

Poking around in -p and -B don't seem to help much here.

-- 
Content-type: lies/all-lies
Content-disposition: blatant


More information about the linux-elitists mailing list