# Makefile for C*Base documentation
# Copyright © 2005-2007 David Weinehall <tao@triad.se>

DVIOBJS := $(patsubst %.tex, %.dvi, $(wildcard *.tex))
PDFOBJS := $(patsubst %.tex, %.pdf, $(wildcard *.tex))

.PHONY: all
all: $(DVIOBJS) $(PDFOBJS)

%.pdf: %.dvi %.tex
	@dvipdfm -p a4 -o $@ $<

%.dvi: %.tex
	@latex $<
	@latex $<	# Run a second time to get the toc correct

.PHONY: clean
clean:
	@rm -f *.log *.aux *.dvi *.pdf

.PHONY: distclean
distclean: clean
	@rm -f *.lof *.lot *.toc
