+### Makefile ---
+
+## Author: Fredrik Unger <fred@tree.se>
+
+EXAMPLE_HTML=$(shell find . -type f -name '*.html.xsl')
+HTML_FILES=$(patsubst %.html.xsl, %.html, $(EXAMPLE_HTML))
+HTML_PNG_FILES=$(patsubst %.html.xsl, %.html.png, $(EXAMPLE_HTML))
+
+EXAMPLE_PDF=$(shell find . -type f -name '*.pdf.xsl')
+PDF_FILES=$(patsubst %.pdf.xsl, %.pdf, $(EXAMPLE_PDF))
+PDF_PNG_FILES=$(patsubst %.pdf.xsl, %.pdf.png, $(EXAMPLE_PDF))
+
+DEFAULT_FILES=default.html default.html.png default.pdf default.pdf.png
+
+all: $(HTML_FILES) $(HTML_PNG_FILES) $(PDF_FILES) $(PDF_PNG_FILES) $(DEFAULT_FILES)
+
+%.html.png: %.html
+ python -m SimpleHTTPServer 8000 & echo "$$!" > server.pid
+ sleep 1
+ cutycapt --url=http://localhost:8000/"$<" --out="$@"
+ kill `cat server.pid`
+ rm server.pid
+
+%.pdf.png: %.pdf
+ convert "$<" "$@"
+
+default.html: ../default.html.xsl example.xml
+ xsltproc --xinclude --output "$@" "$<" example.xml
+
+default.pdf: ../default.pdf.xsl example.xml
+ xsltproc --xinclude --output ex.fo "$<" example.xml
+ fop ex.fo "$@"
+ rm ex.fo
+
+%.html: %.html.xsl example.xml
+ xsltproc --xinclude --output "$@" "$<" example.xml
+
+%.pdf: %.pdf.xsl example.xml
+ xsltproc --xinclude --output ex.fo "$<" example.xml
+ fop ex.fo "$@"
+ rm ex.fo
+
+clean:
+ rm -f *~ server.pid ex.fo $(HTML_FILES) $(HTML_PNG_FILES) $(PDF_FILES) $(PDF_PNG_FILES) $(DEFAULT_FILES)
+
+### Makefile ends here