
# This makefile for building the various versions of the paper
# Call it with one of the following toplevel targets:

main:  pdf
pdf:   scribble-pdf
html:  scribble-html
htmls: scribble-htmls

# --------------------

SCRFLAGS = ++xref-in setup/xref load-collections-xref
TEXFLAGS = --prefix prefix.tex ++style style.tex ++extra sigplanconf.cls

DEPS = struct-hierarchy.png compiled/scribble_scrbl.zo \
       prefix.tex style.tex extras.tex
# the .tex deps don't apply to the html output, but it doesn't hurt much

scribble-html: scribble-zo scribble.html
scribble.html: $(DEPS)
	scribble --html $(SCRFLAGS) scribble.scrbl

scribble-htmls: scribble-zo scribble/index.html
scribble/index.html: $(DEPS)
	scribble --htmls $(SCRFLAGS) scribble.scrbl

scribble-pdf: scribble-zo scribble.pdf
scribble.pdf: $(DEPS)
	scribble --pdf $(SCRFLAGS) $(TEXFLAGS) scribble.scrbl

scribble-tex: scribble-zo scribble.tex
scribble.tex: $(DEPS)
	scribble --latex $(SCRFLAGS) $(TEXFLAGS) scribble.scrbl

scribble-zo:
	mzc scribble.scrbl

PLANET_CONTENT = *.scrbl *.ss *.png prefix.tex extras.tex extras.css \
                 Makefile sigplanconf.cls scribble.bib \
                 images/exprs.dat images/img0.pdf images/img0.png \
                 struct-hierarchy.pdf struct-hierarchy.png

planet:
	rm -rf /tmp/scribble-paper
	mkdir /tmp/scribble-paper
	tar cf - $(PLANET_CONTENT) | (cd /tmp/scribble-paper; tar xf -)
	planet create /tmp/scribble-paper

clean:
	rm -f scribble.tex scribble.aux scribble.out scribble.log \
              img0.pdf img0.png

real-clean: clean
	rm -rf compiled scribble.pdf scribble.html scribble \
               scribble.css scribble-common.js
