# Copyright (C) 2011-2020 Free Software Foundation, Inc.
#  Written by Deri James <deri@chuzzlewit.myzen.co.uk>
#  Automake migration by Bertrand Garrigues
#
# 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/>.

gropdf_dir = $(top_srcdir)/src/devices/gropdf

bin_SCRIPTS += gropdf pdfmom
EXTRA_DIST += \
  src/devices/gropdf/TODO \
  src/devices/gropdf/gropdf.pl \
  src/devices/gropdf/pdfmom.pl \
  src/devices/gropdf/gropdf.1.man \
  src/devices/gropdf/pdfmom.1.man

man1_MANS += \
  src/devices/gropdf/gropdf.1 \
  src/devices/gropdf/pdfmom.1

gropdf: $(gropdf_dir)/gropdf.pl $(SH_DEPS_SED_SCRIPT)
	$(AM_V_GEN)$(RM) $@ \
	&& sed -f $(SH_DEPS_SED_SCRIPT) \
	       -e "s|[@]VERSION[@]|$(VERSION)|" \
	       -e "s|[@]PERL[@]|$(PERL)|" \
	       -e "s|[@]GROFF_FONT_DIR[@]|$(fontpath)|" \
	       -e "s|[@]RT_SEP[@]|$(RT_SEP)|" $(gropdf_dir)/gropdf.pl \
	       >$@ \
	&& chmod +x $@

pdfmom: $(gropdf_dir)/pdfmom.pl $(SH_DEPS_SED_SCRIPT)
	$(AM_V_GEN)$(RM) $@ \
	&& sed -f $(SH_DEPS_SED_SCRIPT) \
	       -e "s|[@]VERSION[@]|$(VERSION)|" \
	       -e "s|[@]RT_SEP[@]|$(RT_SEP)|" \
	       -e "s|[@]PERL[@]|$(PERL)|" $(gropdf_dir)/pdfmom.pl \
	       >$@ \
	&& chmod +x $@


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