+.PHONY: syncweb chbar
+
+# Build a changebar document from the files in doc.old and this directory.
+chbar: lustre-chbar.pdf
+
+# FIXME: Temporary rules until pdftex displays changebars correctly.
+lustre-chbar.pdf: lustre-chbar-nopdf.ps
+ $(PS2PDF) $< $@
+lustre-chbar-nopdf.ps: lustre-chbar-nopdf.dvi
+ $(DVIPS) $< -o $@
+lustre-chbar-nopdf.dvi: lustre-chbar-nopdf.tex
+ $(LATEX) $<
+ $(LATEX) $<
+lustre-chbar-nopdf.tex: lustre-chbar.tex
+ sed -e 's/^\(.*usepackage.*pdftex\)/%\1/' $< > $@
+
+%-chbar.tex: chbar.sh postbar doc.old/%-full.tex %-full.tex
+ $(SHELL) $(srcdir)/chbar.sh doc.old/$*-full.tex $*-full.tex | $(srcdir)/postbar > $@
+
+doc.old/%-full.tex: doc.old/%.tex
+ cd doc.old && $(TEXEXPAND) -texinputs=. -output=$*-full.tex $*.tex
+
+# This rule needs to come after the more specific doc.old rule.
+%-full.tex: %.tex
+ $(TEXEXPAND) -texinputs=. -texinputs=$(srcdir) -output=$@ $<
+
+# Check out the old directory if it doesn't exist.
+doc.old/lustre.lin:
+ @if test "X$(OLD)" = X; then \
+ echo "You must populate doc.old or specify a CVS tag like OLD=v0_5_1"; \
+ exit 1; \
+ fi
+ rm -rf doc.old
+ mkdir doc.old
+ cvs checkout -r $(OLD) -d doc.old lustre/doc