#!/usr/bin/make -rRf
# Makefile for MagicPoint presentations
# Copyright (C) 2004 Mark Suter <mark.suter@miju.com.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.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

SOURCES = fdl.txt gpl.txt unwanted-email.mgp images/email-overview.eps images/sturgeon-logo.eps images/feb04_spam_percentages_char.eps

live: $(SOURCES)
	exec mgp -x freetype -q -F 0 -R -G -t 45 unwanted-email.mgp

cache: $(SOURCES)
	mgp -x freetype -q -d unwanted-email.mgp

preview: $(SOURCES)
	exec mgp -x freetype -q -g 320x240-0+0 unwanted-email.mgp

html: $(SOURCES)
	mkdir -p html
	mgp -x freetype -D html -q -g 800x600 unwanted-email.mgp

fdl.txt:
	wget http://www.gnu.org/licenses/fdl.txt

gpl.txt:
	wget http://www.gnu.org/licenses/gpl.txt

images/feb04_spam_percentages_char.gif:
	cd images && wget http://www.brightmail.com/images/q3/feb04_spam_percentages_char.gif

%.eps: %.fig
	fig2dev -L eps -b 5 $< $@

%.eps: %.gif
	convert $< $@

%.ps: %.mgp
	mgp2ps -c $< > $@

%.pdf: %.ps
	ps2pdf $< > $@

web: html unwanted-email.ps unwanted-email.pdf

spell:
	exec aspell --dont-backup --check unwanted-email.mgp 

clean:
	rm -f .gscache* *.bak *~ images/*.eps images/.gscache*

veryclean: clean
	rm -f unwanted-email.tar.gz unwanted-email.ps unwanted-email.pdf
	rm -rf html

dist: clean
	fakeroot tar cvzf unwanted-email.tar.gz -C .. --exclude unwanted-email.tar.gz $$(basename $$(pwd))

.PHONY: live cache preview web spell clean veryclean dist

