#!/usr/bin/make -f
#
# Copyright (c) 2004 Mark Suter <suter@humbug.org.au>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# [MJS 16 Jan 2004] Maintain a keyring in this directory

# For the "publish" and "refresh" targets
# KEYSERVER = wwwkeys.pgp.net
KEYSERVER = pgpkeys.mit.edu

all:
	@echo Useful targets: table.ps table.pdf graph.png print preview sign refresh publish dist clean

pubring.gpg: *.asc
	for key in $? ; do gpg --homedir . --import $$key ; done

graph.png: pubring.gpg
	gpg --homedir . --list-sigs | sig2dot | springgraph -s 2.5 > $@.$$$$ && mv $@.$$$$ $@

table.tex: pubring.gpg
	gpg --homedir . --fingerprint | ./key-party-table-latex > $@.$$$$ && mv $@.$$$$ $@

table.dvi: table.tex
	echo Double run to get table widths correct
	latex $< && latex $<

table.ps: table.dvi
	dvips -D 1200 -t landscape -R $<

table.pdf: table.ps
	ps2pdf $< $@

print: table.ps
	lpr $^

preview: table.ps
	gv -antialias -spartan -resize -seascape -scale 1 -scalebase 2 $<

sign: pubring.gpg
	./key-party-signing

refresh: pubring.gpg
	gpg --homedir . --keyserver $(KEYSERVER) --refresh-keys

publish:
	gpg --homedir . --keyserver $(KEYSERVER) --send-keys

clean:
	rm -f *~ random_seed *.gpg table.* graph.png keysigning.tar.gz

dist: clean
	fakeroot tar chvzf keysigning.tar.gz -C .. --exclude keysigning.tar.gz $$(basename $$(pwd))

.PHONY: print preview sign refresh publish clean dist

