#---*- Makefile -*-------------------------------------------------------
#$Author: saulius $
#$Date: 2019-03-07 15:33:31 +0000 (Thu, 07 Mar 2019) $
#$Revision: 184 $
#$URL: svn+ssh://saulius-grazulis.lt/home/saulius/svn-repositories/makefiles/mftrace/Makelocal-mftrace $
#------------------------------------------------------------------------

FONT_TREE = /var/cache/fonts

USED_FONTS = $(shell find ${FONT_TREE} -name '*.tfm')
USED_DIRS  = $(dir ${USED_FONTS})
PFA_FILES  = $(notdir ${USED_FONTS:%.tfm=%.pfa})

MAPFILE = mftraced.map

#------------------------------------------------------------------------------

.PHONY: all clean cleanAll distclean

all: ${PFA_FILES} ${MAPFILE}

#------------------------------------------------------------------------------

VPATH = $(sort ${USED_DIRS})

%.pfa: %.tfm
	mftrace $*

${MAPFILE}: ${PFA_FILES}
	printf "%s\n" $^ \
	| xargs -n1 -iI basename I .pfa \
	| awk '{print $$1, $$1, "<"$$1".pfa"}' \
	| tee $@

#------------------------------------------------------------------------------

clean:
	rm -f ${PFA_FILES}
	rm -f ${MAPFILE}

cleanAll distclean: clean
