man_MANS =
CLEANFILES =
EXTRA_DIST =

XSLTPROC = xsltproc

XSLTPROC_FLAGS = \
	--xinclude \
	--nonet \
	--stringparam man.output.quietly 1 \
	--stringparam funcsynopsis.style ansi \
	--stringparam man.th.extra1.suppress 1 \
	--stringparam man.authors.section.enabled 0 \
	--stringparam man.copyright.section.enabled 0

XSLTPROC_MAN_FLAGS = $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl

if ENABLE_GTK_DOC

%.8: %.xml
	$(AM_V_GEN) xsltproc $(XSLTPROC_MAN_FLAGS) $<

%.5: %.xml
	$(AM_V_GEN) xsltproc $(XSLTPROC_MAN_FLAGS) $<

nm-settings.xml: $(top_builddir)/tools/generate-settings-spec $(top_builddir)/libnm-util/libnm-util.la
	rm -f $(builddir)/$@
	$(top_builddir)/tools/generate-settings-spec refentry $(builddir)/$@

endif

configure_generated_man_pages =		\
	nmcli.1				\
	nm-online.1			\
	nm-system-settings.conf.5

docbook_generated_man_pages =		\
	NetworkManager.8		\
	NetworkManager.conf.5		\
	nmcli-examples.5

docbook_autogenerated_man_pages =	\
	nm-settings.5

generated_man_pages = 			\
	$(docbook_generated_man_pages)	\
	$(docbook_autogenerated_man_pages)

EXTRA_DIST +=					\
	$(docbook_generated_man_pages:.%=.xml)	\
	$(docbook_autogenerated_man_pages)

CLEANFILES +=					\
	nm-settings.xml

man_MANS += $(configure_generated_man_pages)

if ENABLE_GTK_DOC
man_MANS += $(generated_man_pages)
CLEANFILES +=					\
	$(docbook_autogenerated_man_pages)	\
	$(docbook_generated_man_pages)
else
if INSTALL_PREGEN_MANPAGES
man_MANS += $(generated_man_pages)
endif
endif

