--- /dev/null
+##############################################################################
+# Variables
+##############################################################################
+
+MAINSRC=main.tex
+SRC=$(wildcard *.tex)
+
+#tools:
+# latex, pdflatex
+# xfig
+# emacs, auctex, ediff
+# darcs
+# latexdiff
+
+##############################################################################
+# Top rules
+##############################################################################
+.PHONY: all clean distclean
+.SUFFIXES: .pdf .tex
+
+all: manual.pdf cocci_syntax.pdf options.pdf
+
+manual.pdf: $(SRC)
+ pdflatex main.tex
+ pdflatex main.tex
+ mv main.pdf manual.pdf
+
+
+
+
+cocci_syntax.pdf: main_grammar.tex cocci_syntax.tex macros_listing_cocci.tex macros_grammar.tex macros_common.tex examples.tex tips.tex
+ pdflatex main_grammar.tex
+ pdflatex main_grammar.tex
+ mv main_grammar.pdf cocci_syntax.pdf
+
+options.pdf: main_options.tex spatch_options.tex macros_options.tex
+ pdflatex main_options.tex
+ pdflatex main_options.tex
+ mv main_options.pdf options.pdf
+
+
+
+
+distclean:: clean
+ rm -f manual.pdf cocci_syntax.pdf options.pdf
+
+
+# lindig trick
+#RERUN = Rerun (LaTeX|to get cross-references right)
+#
+#pdf: $(PDF)
+#
+#%.pdf: %.tex
+# $(PDFLATEX) $<
+# if egrep -s '$(RERUN)' $*.log ;then $(PDFLATEX) $<; fi
+# if egrep -s '$(RERUN)' $*.log ;then $(PDFLATEX) $<; fi
+
+##############################################################################
+# Html version
+##############################################################################
+.PHONY: html check
+
+.SUFFIXES: .html .tex
+
+TEX=cocci_syntax.tex
+WEB=/var/www/localhost/htdocs/coccinelle/
+EMNWEB=~/website/docs/
+
+PDF=$(TEX:.tex=.pdf)
+HTML=$(TEX:.tex=.html)
+
+html: $(HTML)
+
+clean::
+ rm -f *.aux *.dvi *.haux *.htoc *.log *.out *~
+
+distclean:: clean
+ rm -f *.pdf *.html *.gif *.css
+
+check: $(HTML)
+ checklink $<
+
+world: all html
+
+universe: world install
+
+install:
+ cp *.css *.gif *.html $(WEB)
+ cp $(PDF) $(WEB)
+ chown apache:apache -R $(WEB)
+ chmod a-w -R $(WEB)
+
+emn_install: world
+ cp *.css *.gif *.html $(EMNWEB)
+ cp $(PDF) $(EMNWEB)
+
+
+
+
+.tex.html:
+# For Gentoo: /usr/lib64/hevea
+# For Ubuntu family: /usr/share/hevea
+# For default installation
+ @if [ -f /usr/lib64/hevea/xxdate.exe ]; then \
+ hevea -exec /usr/lib64/hevea/xxdate.exe $< ; \
+ hevea -exec /usr/lib64/hevea/xxdate.exe $< ; \
+ elif [ -f /usr/share/hevea/xxdate.exe ]; then \
+ hevea -exec /usr/share/hevea/xxdate.exe $< ; \
+ hevea -exec /usr/share/hevea/xxdate.exe $< ; \
+ elif [ -f /usr/local/lib/hevea/xxdate.exe ]; then \
+ hevea -exec /usr/local/lib/hevea/xxdate.exe $< ; \
+ hevea -exec /usr/local/lib/hevea/xxdate.exe $< ; \
+ else \
+ echo -e "\n\n *** Hevea: Unable to find xxdate.exe ***\n\n"; \
+ fi
+ hacha -o index.html cocci_syntax.html
+
+
+##############################################################################
+# Install
+##############################################################################
+
+
+##############################################################################
+# Developer rules
+##############################################################################
+
+LATEXDIFFOPT=--type=CTRADITIONAL
+
+#if multi files ? sed sur les \input{} ? ou create in another dir ?
+latexdiff:
+ latexdiff $(LATEXDIFFOPT) main-old.tex main.tex > main-diff.tex
+ make MAINSRC=main-diff
+ rm -f main-diff.aux
+
+replacediff:
+ cp main-old.tex main-older.tex
+ cp main.tex main-old.tex
+
+clean::
+ rm -f main-diff.*
+
+update:
+
+commit:
+
+
+##############################################################################
+# Generic rules
+##############################################################################
+FORMAT=letter
+
+%.ps: %.dvi
+ dvips -P cmz $< -o $@ -t $(FORMAT)
+
+clean::
+ rm -f *.aux \
+ *.bbl \
+ *.blg \
+ *.dvi \
+ *.log \
+ *.out \
+ *.toc
+