# Copyright (C) 2014-2020 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/>.

prefixexecbin_PROGRAMS += eqn
prefixexecbin_SCRIPTS += neqn
eqn_CPPFLAGS = \
  $(AM_CPPFLAGS) \
  -I $(top_srcdir)/src/preproc/eqn \
  -I $(top_builddir)/src/preproc/eqn
eqn_LDADD = $(LIBM) libgroff.a lib/libgnu.a
eqn_SOURCES = \
  src/preproc/eqn/main.cpp \
  src/preproc/eqn/lex.cpp \
  src/preproc/eqn/box.cpp \
  src/preproc/eqn/limit.cpp \
  src/preproc/eqn/list.cpp \
  src/preproc/eqn/over.cpp \
  src/preproc/eqn/text.cpp \
  src/preproc/eqn/script.cpp \
  src/preproc/eqn/mark.cpp \
  src/preproc/eqn/other.cpp \
  src/preproc/eqn/delim.cpp \
  src/preproc/eqn/sqrt.cpp \
  src/preproc/eqn/pile.cpp \
  src/preproc/eqn/special.cpp \
  src/preproc/eqn/eqn.ypp \
  src/preproc/eqn/box.h \
  src/preproc/eqn/pbox.h \
  src/preproc/eqn/eqn.h

PREFIXMAN1 += src/preproc/eqn/eqn.1 src/preproc/eqn/neqn.1
EXTRA_DIST += \
  src/preproc/eqn/TODO \
  src/preproc/eqn/eqn.1.man \
  src/preproc/eqn/neqn.1.man \
  src/preproc/eqn/neqn.sh

# Since eqn_CPPFLAGS was set, all .o files have an 'eqn-' prefix.
src/preproc/eqn/eqn-lex.$(OBJEXT): src/preproc/eqn/eqn.hpp

MAINTAINERCLEANFILES += \
  src/preproc/eqn/eqn.hpp \
  src/preproc/eqn/eqn.cpp \
  src/preproc/eqn/eqn.output

neqn: $(top_srcdir)/src/preproc/eqn/neqn.sh $(SH_DEPS_SED_SCRIPT)
	$(AM_V_GEN)sed -e 's/[@]g[@]/$(g)/g' \
	       -f $(SH_DEPS_SED_SCRIPT) \
	       -e $(SH_SCRIPT_SED_CMD) \
	       $(top_srcdir)/src/preproc/eqn/neqn.sh \
	       >$@.tmp \
	&& chmod +x $@.tmp \
	&& mv $@.tmp $@

eqn_TESTS = \
  src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh
TESTS += $(eqn_TESTS)
EXTRA_DIST += $(eqn_TESTS)


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