#    Copyright (C) 2000,2001 Anton Kirilov Zinoviev

#    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

#    My e-mail is zinoviev@debian.org


SHELL = /bin/sh -e

FontsDir = teams/Teams

all:
	echo "Make what?"
	exit 1

unpack:
	-rm -rf teams
	tar zxf teams-1.1.tar.gz
	touch unpack

afm: unpack
	set -e; \
	for i in $(FontsDir)/*.afm; do \
		sed	-e 's/\(^ *FontName  *NimbusRom\)No9/\1/' \
			-e 's/\(^ *FontName  *Nimbus[^-]*\)L-/\1WINC-/' \
		$$i >../afm/`basename $$i|tr '[:upper:]' '[:lower:]'`; \
	done
	touch afm

raw1: unpack
	mkdir tmp
	set -e; \
	for i in $(FontsDir)/*.pfa; do \
		t1disasm $$i >tmp/`basename $$i .pfa|tr '[:upper:]' '[:lower:]'`.raw1; \
	done
	touch raw1

raw2: raw1
	set -e; \
	for i in tmp/*.raw1; do \
		sed 	-e 's/^\(%!PS-AdobeFont.*Nimbus[^-]*\)L-/\1WINC-/' \
			-e 's/^\( *FontDirectory.*Nimbus[^-]*\)L-/\1WINC-/' \
			-e 's/^\( *FontDirectory.*Nimbus[^-]*\)L-/\1WINC-/' \
			-e 's/^\( *\/FontName.*Nimbus[^-]*\)L-/\1WINC-/' \
			-e 's/\(NimbusRom\)No9/\1/' \
		$$i >tmp/`basename $$i .raw1`.raw2; \
	done
	touch raw2

pfa: raw2
	set -e; \
	for i in tmp/*.raw2; do \
		t1asm -a $$i >../pfa/`basename $$i .raw2`.pfa; \
	done
	touch pfa

pfb: raw2
	set -e; \
	for i in tmp/*.raw2; do \
		t1asm $$i >../pfb/`basename $$i .raw2`.pfb; \
	done
	touch pfb

doc:
	mkdir ../doc/TopTeam
	cp teams/doc/* ../doc/TopTeam
	touch doc

clean:
	-rm -f unpack afm raw1 raw2 pfa pfb doc
	-rm *~
	-rm -rf teams tmp

.PHONY:	clean
