#
# doc/manpages
#

man_RSTFILES = \
	doc/manpages/bfd-options.rst \
	doc/manpages/common-options.rst \
	doc/manpages/conf.py \
	doc/manpages/defines.rst \
	doc/manpages/epilogue.rst \
	doc/manpages/frr-bfdd.rst \
	doc/manpages/frr-bgpd.rst \
	doc/manpages/frr-eigrpd.rst \
	doc/manpages/frr-fabricd.rst \
	doc/manpages/frr-isisd.rst \
	doc/manpages/frr-ldpd.rst \
	doc/manpages/frr-nhrpd.rst \
	doc/manpages/frr-ospf6d.rst \
	doc/manpages/frr-ospfclient.rst \
	doc/manpages/frr-ospfd.rst \
	doc/manpages/frr-pbrd.rst \
	doc/manpages/frr-pimd.rst \
	doc/manpages/frr-ripd.rst \
	doc/manpages/frr-ripngd.rst \
	doc/manpages/frr-sharpd.rst \
	doc/manpages/frr-staticd.rst \
	doc/manpages/frr-vrrpd.rst \
	doc/manpages/frr-watchfrr.rst \
	doc/manpages/frr-zebra.rst \
	doc/manpages/frr.rst \
	doc/manpages/index.rst \
	doc/manpages/mtracebis.rst \
	doc/manpages/vtysh.rst \
	# end

EXTRA_DIST += $(man_RSTFILES)

MANPARENT = doc/manpages/_build
MANBUILD = $(MANPARENT)/man
doc/manpages/_build/.doctrees/environment.pickle: $(man_RSTFILES)

#
# automake integration
#

rstman1dir = $(mandir)/man1
rstman8dir = $(mandir)/man8

rstman1_DATA =
rstman8_DATA =

if DOC
rstman1_DATA += $(man1)
rstman8_DATA += $(man8)
endif # DOC

man1 = $(MANBUILD)/frr.1
man8 =

# dependency
$(man8) $(man1): $(MANBUILD)/man.stamp

#
# hook-ins for clean / doc
# (install is handled by automake _DATA)
#

clean-local: clean-manpages
.PHONY: clean-manpages
clean-manpages:
	-rm -rf $(MANPARENT)

doc: doc-man
.PHONY: doc-man
doc-man: $(rstman8_DATA) $(rstman1_DATA)
