#$Header:Makefile 12.0$
#$ACIS:Makefile 12.0$
#$Source: /ibm/acis/usr/src/usr.lib/font/dev3812/typographic/pispecial/RCS/Makefile,v $
# This makefile is for converting the IBM Sonoran Pi and Special
# Fonts for use with the IBM 3812 Pageprinter.
# The fonts must be loaded from diskette into this directory using dosread(1).
#
# The makefile will convert the fonts and then generate the width tables.
# Once the fonts have been converted, this makefile can be used just to 
# re-make the width tables.
# The makefile can be called in one of the following ways:
#
# make - to convert and build the widths.
# make clean - to clean directory before restarting the build again.
# make width - to just make the widths, once the convert has completed.
# make pi - to just re-make the widths for pi serif characters.
# make pisans - to just re-make the widths for pi sans serif characters.
# make special - to just re-make the widths for the special fonts.
# make cleanwidth - to just clean the width tables for rebuild.
# make cleanpi - to just clean the pi width tables for rebuild.
# make cleanspecial - to just clean the special width tables for rebuild.


DESTDIR=
LIBDIR=		${DESTDIR}/usr/lib/font
DEVDIR=		${LIBDIR}/dev3812
FONTDIR=	${DEVDIR}/fonts
DEPDIRS=	${LIBDIR} ${DEVDIR} ${FONTDIR}

CVT3812=	/usr/ibm/cvt20to12
WIDTH3812=	/usr/ibm/width3812
INSTALL=	/usr/bin/install -c

# Width tables and sizes
WDTABLES=  S SB HS HZ D SP
SIZES=  6 7 8 9 10 11 12 0

# Fonts
NEWSIZE= ps.7.ndx ps.7.dat ps.9.ndx ps.9.dat ps.11.ndx ps.11.dat
NEWSIZEB= ps.B.7.ndx ps.B.7.dat ps.B.9.ndx ps.B.9.dat ps.B.11.ndx ps.B.11.dat
NEWSIZEP= pss.7.ndx pss.7.dat pss.9.ndx pss.9.dat pss.11.ndx pss.11.dat
NEWSIZEPB= pss.B.7.ndx pss.B.7.dat pss.B.9.ndx pss.B.9.dat pss.B.11.ndx pss.B.11.dat

# This will install all the IBM Pi and Specia fonts after
# they have been loaded from diskette into this directory.
# The IBM3820 fonts for Pi and Special Serif are named:
#  c0j055?0.pds - Display
#  c0z075?0.pds - Petite 
#  c0p055?0.pds - Pi Sans Serif Medium
#  c0p075?0.pds - Pi Sans Serif Bold
#  c0q055?0.pds - Pi Serif medium
#  c0q075?0.pds - Pi Serif Bold

all:	dat_and_ndx width 

# Using ibm3820 font files, create .dat and .ndx files.
# .dat contains font raster patterns and .ndx contains index by IBM char names.
dat_and_ndx: fontnameTBL
	for i in *.pds; do ${CVT3812} $$i; done

# Using .dat, .ndx and code page files, create width and offset files.
# This offset file is an index into .dat by troff char names.
width: pi pisans special

#This will build the font widths for the IBM PI and Special Serif Fonts.
pi: picp ${NEWSIZE} ${NEWSIZEB}
	${WIDTH3812} -c picp -S -s ${SIZES} -n S ps
	${WIDTH3812} -c picp -S -s ${SIZES} -n SB ps.B

#This will build the font widths for the IBM PI and Special Sans Serif Fonts.
pisans: picp ${NEWSIZEP}  ${NEWSIZEPB}
	${WIDTH3812} -c picp -S -s ${SIZES} -n HS pss
	${WIDTH3812} -c picp -S -s ${SIZES} -n HZ pss.B

#This will build the font widths for the IBM Display and Petite Font.
special: stdcp
	${WIDTH3812} -c stdcp -s 20 36 0 -n D d
	${WIDTH3812} -c stdcp -s 4 0 -n SP pe

${NEWSIZE}:
	cp ps.8.ndx ps.7.ndx
	cp ps.8.dat ps.7.dat
	cp ps.10.ndx ps.9.ndx
	cp ps.10.dat ps.9.dat
	cp ps.12.ndx ps.11.ndx
	cp ps.12.dat ps.11.dat

${NEWSIZEB}:
	cp ps.B.8.ndx ps.B.7.ndx
	cp ps.B.8.dat ps.B.7.dat
	cp ps.B.10.ndx ps.B.9.ndx
	cp ps.B.10.dat ps.B.9.dat
	cp ps.B.12.ndx ps.B.11.ndx
	cp ps.B.12.dat ps.B.11.dat


${NEWSIZEP}:
	cp pss.8.ndx pss.7.ndx
	cp pss.8.dat pss.7.dat
	cp pss.10.ndx pss.9.ndx
	cp pss.10.dat pss.9.dat
	cp pss.12.ndx pss.11.ndx
	cp pss.12.dat pss.11.dat

${NEWSIZEPB}:
	cp pss.B.8.ndx pss.B.7.ndx
	cp pss.B.8.dat pss.B.7.dat
	cp pss.B.10.ndx pss.B.9.ndx
	cp pss.B.10.dat pss.B.9.dat
	cp pss.B.12.ndx pss.B.11.ndx
	cp pss.B.12.dat pss.B.11.dat

# Copy the fontnameTBL and codepage tables from ../font/dev3812/typographic
fontnameTBL picp stdcp:
	cp ../../$@ .

${DEPDIRS}:
	mkdir $@

# Copy all width info for ditroff and the codepages 
install:	${DEPDIRS}
	${INSTALL}  ../DESC.typographic ${DEVDIR}/DESC
	for i in ${WDTABLES}; do ${INSTALL} $$i ${DEVDIR} ; done
	for i in *.dat *.stdcp *.picp; do ${INSTALL} $$i ${FONTDIR}; done


clean: cleanpi cleanspecial
	rm -f *.ndx *.dat ${WDTABLES}
	rm -f fontnameTBL picp stdcp

cleanpi:
	rm -f *.picp
cleanspecial:
	rm -f *.stdcp
