# Copyright (C) 2014-2022 Free Software Foundation, Inc.
#
# This file is part of 'groff'.
#
# 'groff' 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 3 of the License, or
# (at your option) any later version.
#
# 'groff' 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, see <http://www.gnu.org/licenses/>.

devps_srcdir = $(top_srcdir)/font/devps
devps_builddir = $(top_builddir)/font/devps
DEVPSFONTFILES = \
  font/devps/S \
  font/devps/SS \
  font/devps/ZD \
  font/devps/ZDR \
  font/devps/ZCMI \
  font/devps/AB \
  font/devps/ABI \
  font/devps/AI \
  font/devps/AR \
  font/devps/BMB \
  font/devps/BMBI \
  font/devps/BMI \
  font/devps/BMR \
  font/devps/CB \
  font/devps/CBI \
  font/devps/CI \
  font/devps/CR \
  font/devps/HB \
  font/devps/HBI \
  font/devps/HI \
  font/devps/HR \
  font/devps/HNB \
  font/devps/HNBI \
  font/devps/HNI \
  font/devps/HNR \
  font/devps/NB \
  font/devps/NBI \
  font/devps/NI \
  font/devps/NR \
  font/devps/PB \
  font/devps/PBI \
  font/devps/PI \
  font/devps/PR \
  font/devps/TB \
  font/devps/TBI \
  font/devps/TI \
  font/devps/TR \
  font/devps/EURO \
  font/devps/freeeuro.afm \
  font/devps/symbolsl.afm \
  font/devps/text.enc \
  font/devps/zapfdr.afm \
  font/devps/download

DEVPSFONTFILES_GENERATED = \
  font/devps/DESC \
  font/devps/prologue \
  font/devps/freeeuro.pfa \
  font/devps/zapfdr.pfa \
  font/devps/symbolsl.pfa
devpsfontdir = $(fontdir)/devps
dist_devpsfont_DATA = $(DEVPSFONTFILES)
nodist_devpsfont_DATA = $(DEVPSFONTFILES_GENERATED)

# these files will be installed in oldfontdir
OLDDEVPSFONTFILES = \
  font/devps/old/S \
  font/devps/old/SS \
  font/devps/old/CB \
  font/devps/old/CBI \
  font/devps/old/CI \
  font/devps/old/CR \
  font/devps/old/HB \
  font/devps/old/HBI \
  font/devps/old/HI \
  font/devps/old/HR \
  font/devps/old/HNB \
  font/devps/old/HNBI \
  font/devps/old/HNI \
  font/devps/old/HNR \
  font/devps/old/NB \
  font/devps/old/NBI \
  font/devps/old/NI \
  font/devps/old/NR \
  font/devps/old/PB \
  font/devps/old/PBI \
  font/devps/old/PI \
  font/devps/old/PR \
  font/devps/old/TB \
  font/devps/old/TBI \
  font/devps/old/TI \
  font/devps/old/TR \
  font/devps/old/symbol.afm \
  font/devps/old/symbolsl.afm \
  font/devps/old/zapfdr.afm \
  font/devps/old/zapfdr.ps
olddevpsfontdir = $(oldfontdir)/devps
dist_olddevpsfont_DATA = $(OLDDEVPSFONTFILES)

# Files installed in $(devfontdir)/generate
DEVPSGENFILES = \
  font/devps/generate/Makefile \
  font/devps/generate/dingbats.map \
  font/devps/generate/dingbats-reversed.map \
  font/devps/generate/slanted-symbol.map \
  font/devps/generate/symbol.map \
  font/devps/generate/symbolchars \
  font/devps/generate/text.map
DEVPSGENSCRIPTS = \
  font/devps/generate/afmname \
  font/devps/generate/symbol.sed
devpsgendir = $(devpsfontdir)/generate
dist_devpsgen_DATA = $(DEVPSGENFILES) $(DEVPSGENSCRIPTS)

MOSTLYCLEANFILES += $(DEVPSFONTFILES_GENERATED)
EXTRA_DIST += \
  font/devps/DESC.in  \
  font/devps/prologue.ps \
  font/devps/psstrip.sed \
  font/devps/freeeuro.ps \
  font/devps/symbol.afm \
  font/devps/symbolsl.afm \
  font/devps/symbolsl.ps \
  font/devps/zapfdr.afm \
  font/devps/zapfdr.ps \
  font/devps/generate/freeeuro.sfd \
  font/devps/generate/make-zapfdr \
  font/devps/generate/symbolsl.awk \
  font/devps/generate/sfdtopfa.pe \
  font/devps/generate/zapfdr.sed

font/devps/DESC: $(devps_srcdir)/DESC.in
	$(AM_V_GEN)$(MKDIR_P) font/devps \
	&& cat $(devps_srcdir)/DESC.in >$@.tmp \
	&& echo broken $(BROKEN_SPOOLER_FLAGS) >>$@.tmp \
	&& if test "$(PAGE)" = A4; then \
	     echo "papersize a4" >>$@.tmp; \
	   else \
	     echo "papersize letter" >>$@.tmp; \
	   fi \
	&& (test -z '$(PSPRINT)' \
	    || echo print '$(PSPRINT)' >>$@.tmp)
	$(AM_V_at)mv $@.tmp $@

# PostScript documents to be produced by troff should depend on this
# stamp file to ensure that grops's device and font description files
# are available.
MOSTLYCLEANFILES += font/devps/stamp
font/devps/stamp: font/devps/DESC \
  $(DEVPSFONTFILES) $(DEVPSFONTFILES_GENERATED)
	$(AM_V_at)>$@

maintainer-font-descriptions: devps_font-descriptions
# This target generates font descriptions from installed Type 1 AFM
# files; these are _not_ normally generated during a build, but provided
# with the groff source distribution.
#
# We add top_builddir to the PATH in case the only afmtodit available is
# the one in the current build.
#
# The AFM files from which these descriptions are produced must be
# obtained elsewhere, so this target runs only in "maintainer mode".
devps_font-descriptions: afmtodit font/devps/DESC
	PATH=$(top_builddir)$(GROFF_PATH_SEPARATOR)$(PATH) \
	  $(MAKE) -f $(devps_srcdir)/generate/Makefile \
	  srcdir=$(devps_srcdir)/generate DESC=$(devps_srcdir)/DESC.in

font/devps/prologue: $(devps_srcdir)/prologue.ps
	$(AM_V_GEN)$(MKDIR_P) font/devps \
	&& $(RM) $@ \
	&& sed -f $(devps_srcdir)/psstrip.sed $? >$@

.ps.pfa:
	$(AM_V_GEN)$(MKDIR_P) font/devps \
	&& $(RM) $@ \
	&& sed -f $(devps_srcdir)/psstrip.sed $? >$@


# Local Variables:
# mode: makefile-automake
# fill-column: 72
# End:
# vim: set autoindent filetype=automake textwidth=72:
