I tend to do variations on the theme of the attached, nowadays.

I used to have a shell find thing, but got rid of it as it was slow
over a large directory (particularly fuse-ssh mounted), and also I
don't think it's standard Make. For that matter nor is the % syntax
that you use, but I appreciate it's the only way to get it to
respect the dependencies and use the same rule for every file. 

It seems like static sites are coming back into popularity again
now, albeit naturally with massive python / perl / ruby
frameworks...

Nick
src = index.md tools/index.md etc/index.md
tgt = $(src:.md=.html)

all: $(tgt)

.md.html:
        echo "Making $@"
        echo "<!doctype html><html><head><title>" > $@
        sed 's/^#* //;1q' < $< >> $@
        echo "</title></head><body>" >> $@
        smu < $< >> $@
        echo "<hr /><p>Last updated: " >> $@
        stat -c %y $< | awk '{print $$1}' >> $@
        echo "</p></body></html>" >> $@
        chmod a+r $@

clean:
        rm -f $(tgt)

.PHONY: all clean
.SUFFIXES: .md .html
.SILENT:

Reply via email to