#
#    Makefile for the -misc-fixed-iso10646-1 outline font project.
#    Copyright (C) 2000  Ulf Jordan
#
#    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
#


SHELL = /bin/sh

.SUFFIXES:
.SUFFIXES: .c .o

srcdir = .
# Below you can control where the helper programmes are installed:
prefix = /usr/local
bindir = $(prefix)/bin

# Flags for linking the helper programs (they need mathematical functions)
LDFLAGS = -lm
# On SunOS 5.4 use next line instead (or use gcc!):
#LDFLAGS = -L/usr/lib -lm

GS = gs -q -dNODISPLAY
# Do we really need to define RM?
RM = rm -f
INSTALL = /usr/bin/install -c

PACKAGE = misc-fixed
VERSION = 0.3.2

PROGS = bezier circle-circle circle-t-circle line-circle line-line \
       tangent-circle diagonal
CSRC = bezier.c circle-circle.c circle-t-circle.c line-circle.c line-line.c \
       tangent-circle.c diagonal.c
FONTS = Misc-Fixed.pfa Misc-Fixed.afm
FONTSRC = Misc-Fixed.h Misc-Fixed.macros Misc-Fixed.notdef.outlines \
          Misc-Fixed.page00.outlines Misc-Fixed.page03.outlines \
          Misc-Fixed.page03b.outlines Misc-Fixed.page04.outlines \
          Misc-Fixed.page20.outlines
PSPROGS = encodecs.ps asspcs.ps genpfa.ps measvm.ps development.ps genafm.ps \
          encodefm.ps
AUX = Makefile README INSTALL COPYING COPYING.LIB TODO BUGS DEVELOPMENT

# Change so that distdir is the complete distribution and some other name 
# for only the precompiled fonts.
#
distdir = $(PACKAGE)-$(VERSION)
distdir-precompiled = $(PACKAGE)-precompiled-$(VERSION)


# The general targets.
# First the default target which is made if 'make' is given.
all: $(FONTS) $(PROGS)

clean:
	$(RM) Misc-Fixed.pfa Misc-Fixed.afm Misc-Fixed.pcs \
           Misc-Fixed.notdef.charstrings Misc-Fixed.page00.charstrings \
           Misc-Fixed.page03.charstrings Misc-Fixed.page03b.charstrings \
           Misc-Fixed.page04.charstrings Misc-Fixed.page20.charstrings
	$(RM) $(PROGS)
	$(RM) $(distdir).tar.gz
	$(RM) -r $(distdir)
	$(RM) $(distdir-precompiled).tar.gz
	$(RM) -r $(distdir-precompiled)

dist-precompiled: $(FONTS) README INSTALL COPYING.LIB TODO
	$(RM) -r $(distdir-precompiled)
	mkdir $(distdir-precompiled)
	cp Misc-Fixed.pfa $(distdir-precompiled)
	cp Misc-Fixed.afm $(distdir-precompiled)
	cp README $(distdir-precompiled)
	cp INSTALL $(distdir-precompiled)
	cp COPYING.LIB $(distdir-precompiled)
	cp TODO $(distdir-precompiled)
	tar cvf $(distdir-precompiled).tar $(distdir-precompiled)
	gzip $(distdir-precompiled).tar

dist: $(AUX) $(CSRC) $(FONTSRC) $(PSPROGS)
	$(RM) -r $(distdir)
	mkdir $(distdir)
	cp $(AUX) $(distdir)
	cp $(CSRC) $(distdir)
	cp $(FONTSRC) $(distdir)
	cp $(PSPROGS) $(distdir)
	tar cvf $(distdir).tar $(distdir)
	gzip $(distdir).tar

install:
	@echo For instructions how to install the font files see the file INSTALL.
	@echo To install the helper programs do \'make install-helper\'.

install-helper: $(PROGS)
	$(INSTALL) bezier $(bindir)/bezier
	$(INSTALL) circle-circle $(bindir)/circle-circle
	$(INSTALL) circle-t-circle $(bindir)/circle-t-circle
	$(INSTALL) line-circle $(bindir)/line-circle
	$(INSTALL) line-line $(bindir)/line-line
	$(INSTALL) tangent-circle $(bindir)/tangent-circle

# The specific targets for making the different files.

Misc-Fixed.pfa: Misc-Fixed.h Misc-Fixed.pcs
	$(GS) -- genpfa.ps Misc-Fixed.h Misc-Fixed.pcs Misc-Fixed.pfa.1 "`date`"
	sed "s/%%VMusage:/`gs -q -dNODISPLAY -- measvm.ps Misc-Fixed.pfa.1`/g" Misc-Fixed.pfa.1 > Misc-Fixed.pfa
	$(RM) Misc-Fixed.pfa.1

Misc-Fixed.pcs: Misc-Fixed.h Misc-Fixed.notdef.charstrings Misc-Fixed.page00.charstrings Misc-Fixed.page03.charstrings Misc-Fixed.page03b.charstrings Misc-Fixed.page04.charstrings Misc-Fixed.page20.charstrings
	$(GS) -- asspcs.ps Misc-Fixed.pcs Misc-Fixed.h Misc-Fixed.notdef.charstrings Misc-Fixed.page00.charstrings Misc-Fixed.page03.charstrings Misc-Fixed.page03b.charstrings Misc-Fixed.page04.charstrings Misc-Fixed.page20.charstrings

Misc-Fixed.notdef.charstrings: Misc-Fixed.h Misc-Fixed.notdef.outlines
	$(GS) -- encodecs.ps Misc-Fixed.notdef.outlines Misc-Fixed.notdef.charstrings

Misc-Fixed.page00.charstrings: Misc-Fixed.h Misc-Fixed.macros Misc-Fixed.page00.outlines
	$(GS) -- encodecs.ps Misc-Fixed.page00.outlines Misc-Fixed.page00.charstrings

Misc-Fixed.page03.charstrings: Misc-Fixed.h Misc-Fixed.macros Misc-Fixed.page00.outlines Misc-Fixed.page03.outlines
	$(GS) -- encodecs.ps Misc-Fixed.page03.outlines Misc-Fixed.page03.charstrings

Misc-Fixed.page03b.charstrings: Misc-Fixed.h Misc-Fixed.macros Misc-Fixed.page00.outlines Misc-Fixed.page03.outlines Misc-Fixed.page03b.outlines
	$(GS) -- encodecs.ps Misc-Fixed.page03b.outlines Misc-Fixed.page03b.charstrings

Misc-Fixed.page04.charstrings: Misc-Fixed.h Misc-Fixed.macros Misc-Fixed.page00.outlines Misc-Fixed.page03.outlines Misc-Fixed.page04.outlines
	$(GS) -- encodecs.ps Misc-Fixed.page04.outlines Misc-Fixed.page04.charstrings

Misc-Fixed.page20.charstrings: Misc-Fixed.h Misc-Fixed.macros Misc-Fixed.page20.outlines
	$(GS) -- encodecs.ps Misc-Fixed.page20.outlines Misc-Fixed.page20.charstrings

Misc-Fixed.fm Misc-Fixed.bbox: $(FONTSRC)
	$(GS) -- encodefm.ps Misc-Fixed.fm Misc-Fixed.bbox Misc-Fixed.h Misc-Fixed.page00.outlines Misc-Fixed.page03.outlines Misc-Fixed.page03b.outlines Misc-Fixed.page04.outlines Misc-Fixed.page20.outlines

Misc-Fixed.afm: Misc-Fixed.h Misc-Fixed.fm Misc-Fixed.bbox
	$(GS) -- genafm.ps Misc-Fixed.h Misc-Fixed.fm Misc-Fixed.bbox Misc-Fixed.afm

