# Generation of texfontdir and texfontdir.1
#
# Customize variables here, not in the files themselves, if you want to keep
# the manual and program in sync.
#
# Yves Arrouye <Yves.Arrouye@imag.fr>, 1995

# Where to install

BINDIR=$(VARTEXMF)/bin
MANDIR=$(TEXMF)/doc/man/man1

# Customization

PERL = /usr/local/bin/perl

# Choose one line depending on whether you use Perl 5 or 4
# Perl 5:
USE_GETOPTS = use Getopt'"'"'Long; \$$Getopt'"'"'Long'"'"'ignorecase = 0;
# Perl 4:
#USE_GETOPTS = require '"'"'lnggetopt.pl'"'"'; \$$lnggetopt'"'"'ignorecase = 0;

# Use TDS names (dpi300/cmr10.pk) by default? (0 or 1.)

TDS_DEFAULT = 0

# Are such names required? If 1, then other options will not be
# allowed. Note that if you distribute this script so that it is
# shared among many systems, you should leave it to 0 and uncomment
# the TEST_LONGNAMES expression below, or assign this variable to an
# expresison depending on the system type (maybe the best solution).

USE_TDSNAMES = 0

# Test if system supports long filenames? The variable $opt_tds_names
# will be set at this moment, we can use it (it is 1 if we use TDS names).

# TEST_LONGNAMES = !\$opt_tds_names;
TEST_LONGNAMES = 0

# Default font dir and destination dir

FONTDIR = \$$TEXMF/fonts
DESTDIR = \$$VARTEXMF/fonts/tmp

# Location of tfm and pk directories under these dirs

LOC_TFMDIR = tfm
LOC_PKDIR = pk

LOC_TFMDIRBASE = `basename $(LOC_TFMDIR)`

# Where to put unknown files

LOC_UNKNOWNDIR = unknown
LOC_UNKNOWNMODE = unknown

# Location of the modes.mf database

LOC_MODESMF = \$$TEXMF/metafont/misc/modes.mf

# Set this variable if you want to use kpsewhich (recommended)

USE_KPSEWHICH = yes

# Do not modify what follows except for the installation target below

%: tmpl/% Makefile
	sed -e 's,@@TEXMF@@,$(TEXMF),' \
	    -e 's,@@PERL@@,$(PERL),' \
	    -e 's,@@TDS_DEFAULT@@,$(TDS_DEFAULT),' \
	    -e 's,@@USE_TDSNAMES@@,$(USE_TDSNAMES),' \
	    -e 's,@@TEST_LONGNAMES@@,$(TEST_LONGNAMES),' \
	    -e 's,@@FONTDIR@@,$(FONTDIR),' \
	    -e 's,@@DESTDIR@@,$(DESTDIR),' \
	    -e 's,@@LOC_TFMDIR@@,$(LOC_TFMDIR),' \
	    -e "s,@@LOC_TFMDIRBASE@@,$(LOC_TFMDIRBASE)," \
	    -e 's,@@LOC_PKDIR@@,$(LOC_PKDIR),' \
	    -e 's,@@LOC_UNKNOWNDIR@@,$(LOC_UNKNOWNDIR),' \
	    -e 's,@@LOC_UNKNOWNMODE@@,$(LOC_UNKNOWNMODE),' \
	    -e 's,@@LOC_MODESMF@@,$(LOC_MODESMF),' \
	    -e 's,@@USE_KPSEWHICH@@,$(USE_KPSEWHICH),' \
	    -e 's,@@USE_GETOPTS@@,$(USE_GETOPTS),' \
	<$< >$@

WHAT = mkpkfontdir mkpkfontdir.1

all: $(WHAT)

install: all
	install -m 755 mkpkfontdir $(BINDIR)
	install -m 644 mkpkfontdir.1 $(MANDIR)
# Uncomment the following line if your man supports gzipped files
#	gzip -9 $(MANDIR)/mkpkfontdir.1

clean:
	$(RM) $(WHAT)

uninstall:
	$(RM) $(BINDIR)/mkpkfontdir
	$(RM) $(MANDIR)/mkpkfontdir.1 $(MANDIR)/mkpkfontdir.1.gz \
	    $(MANDIR)/mkpkfontdir.1.* $(MANDIR)/../cat1/mkpkfontdir.1 \
	    $(MANDIR)/../cat1/mkpkfontdir.1.*