################################################################################
#
# Makefile to install various fonts so that LaTeX can find them.
#
# You should only need to run this once after TeX Live install to set things,
# up, which is why it isn't called from the Makefile in the parent directory.
# Since we're installing into TEXMFLOCAL, you'll need to 'sudo make install'.
# WARNING: any predefined TEXMF environment variables probably won't be
# available under sudo! Be sure to pass them on the command line if needed:
# e.g., 'make install TEXMFLOCAL=/usr/local/texmf'.
#
# NOTE: If this is the first time you've done this, you may need to 
#
################################################################################

SHELL=/bin/sh

# Set this to whatever it should be, e.g., /etc/texmf or whatever. This should
# be the parent directory of the 'updmap.d' directory.
# TEXMFSYSCONFIG =
UPDMAP=$(TEXMFSYSCONFIG)/updmap.d

# Set this to whatever it should be, e.g., /usr/local/texmf or whatever.
# Fonts need to go into the local TEXMF tree to be visible to updmap (not your 
# personal TEXMF tree)
# TEXMFLOCAL =
FONTS=$(TEXMFLOCAL)/fonts
LATEX=$(TEXMFLOCAL)/tex/latex

# Use rsync so we don't clobber anything that's already there, and only copy
# what's absolutely necessary. Don't use rsync -a as we don't want to preserve
# the group (-g) and owner (-a) if we're writing into a system directory.
install:
	@cp 99local.cfg $(UPDMAP)
	@mkdir -p $(FONTS) $(LATEX)
	@rsync -rlptDv fonts/ $(FONTS)
	@rsync -rlptDv latex/ $(LATEX)
	@texhash
	@updmap-sys

debug:
	@echo "TEXMFSYSCONFIG = [$(TEXMFSYSCONFIG)]"
	@echo "TEXMFLOCAL = [$(TEXMFLOCAL)]"
	@echo "UPDMAP = [$(UPDMAP)]"
	@echo "FONTS = [$(FONTS)]"
	@echo "LATEX = [$(LATEX)]"
