
# To use this makefile, after building the database in the parent directory do a
# "make capture" here. This will get a copy of the database and save it as
# auto_autographtest.xml. It will then build all the diagrams.
# 
# 'make' will re-run graphviz on any diagrams that are possibly out of date.
# Just remember to "make capture" if you change the database, as this is the
# only time the XML schema file is updated.
#
# To build a new diagram, it's probably simplest to just copy one of the
# existing diagram files and modify it to include the tables or schemas you're
# interested in.

# The diagram list should be one file per line, so that if someone adds or
# changes a file, we don't end up with collisions with other
# developers (since the diff process is line based).

MAINFILE = auto_autographtest.xml
DBNAME = autograph_test
FINALS = all.ps \
    all_detail.ps \
    financial.ps

%.ps: %.xml $(MAINFILE)
	@echo Processing $<
	@tools/process.py tools/autograph.xsl $<
	@convert $@ $(subst .ps,.png,$@)

.PHONY: all
all: $(FINALS)


.PHONY: clean
clean:
	@rm -f *.ps *.svg $(FINALS) *.eps *.dot *.jpg *.png *.pdf

.PHONY: capture
capture:
	@echo Capturing Data
	@tools/downloadXml.py -d $(DBNAME) >$(MAINFILE)
	@-make all

