[PATCH 4/5 v2] newlib: move man page generation into top-level build

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
This allows building the libc & libm pages in parallel, and drops
the duplication in the subdirs with the chew/chapter settings.

The unused rules in Makefile.shared are left in place to minimize
noise in the change.
---
 newlib/Makefile.am              |  16 --
 newlib/Makefile.in              |  71 +++--
 newlib/doc/local.mk             |  12 +
 newlib/libc/Makefile.am         |  78 +-----
 newlib/libc/Makefile.in         | 449 +++-----------------------------
 newlib/libc/Makefile.inc        |  23 +-
 newlib/libc/ctype/Makefile.am   |   6 -
 newlib/libc/ctype/Makefile.in   |  15 +-
 newlib/libc/iconv/Makefile.am   |   6 -
 newlib/libc/iconv/Makefile.in   |   8 +-
 newlib/libc/locale/Makefile.am  |   6 -
 newlib/libc/locale/Makefile.in  |   9 +-
 newlib/libc/misc/Makefile.am    |   6 -
 newlib/libc/misc/Makefile.in    |   8 +-
 newlib/libc/posix/Makefile.am   |   6 -
 newlib/libc/posix/Makefile.in   |   8 +-
 newlib/libc/reent/Makefile.am   |   6 -
 newlib/libc/reent/Makefile.in   |  12 +-
 newlib/libc/search/Makefile.am  |   6 -
 newlib/libc/search/Makefile.in  |   8 +-
 newlib/libc/signal/Makefile.am  |   6 -
 newlib/libc/signal/Makefile.in  |   8 +-
 newlib/libc/ssp/Makefile.am     |   6 -
 newlib/libc/ssp/Makefile.in     |   8 +-
 newlib/libc/stdio/Makefile.am   |   6 -
 newlib/libc/stdio/Makefile.in   |  24 +-
 newlib/libc/stdio64/Makefile.am |   6 -
 newlib/libc/stdio64/Makefile.in |  10 +-
 newlib/libc/stdlib/Makefile.am  |   6 -
 newlib/libc/stdlib/Makefile.in  |  17 +-
 newlib/libc/string/Makefile.am  |   6 -
 newlib/libc/string/Makefile.in  |  26 +-
 newlib/libc/time/Makefile.am    |   6 -
 newlib/libc/time/Makefile.in    |  14 +-
 newlib/libm/Makefile.am         |  22 --
 newlib/libm/Makefile.in         |  24 +-
 newlib/libm/Makefile.inc        |  23 +-
 newlib/libm/common/Makefile.am  |   6 -
 newlib/libm/common/Makefile.in  |  13 +-
 newlib/libm/complex/Makefile.am |   6 -
 newlib/libm/complex/Makefile.in |  11 +-
 newlib/libm/fenv/Makefile.am    |   6 -
 newlib/libm/fenv/Makefile.in    |  11 +-
 newlib/libm/math/Makefile.am    |   6 -
 newlib/libm/math/Makefile.in    |  13 +-
 newlib/libm/mathfp/Makefile.am  |   6 -
 newlib/libm/mathfp/Makefile.in  |  14 +-
 47 files changed, 199 insertions(+), 870 deletions(-)

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 99fa0d77f91f..1e35e64300fa 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -420,22 +420,6 @@ unidata:
 # Force makedoc to be built before building info files.
 info-recursive dvi-recursive: doc/makedoc$(EXEEXT_FOR_BUILD)
 
-# Recursive targets for man and install-man
-man:
-	$(MAKE) man-cache || exit 1; \
-	for d in $(SUBDIRS); do \
-	  if test "$$d" != "."; then \
-	    (cd $$d && $(MAKE) man) || exit 1; \
-	  fi; \
-	done
-
-install-man:
-	for d in $(SUBDIRS); do \
-	  if test "$$d" != "."; then \
-	    (cd $$d && $(MAKE) install-man) || exit 1; \
-	  fi; \
-	done
-
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
 
 include ../multilib.am
diff --git a/newlib/doc/local.mk b/newlib/doc/local.mk
index 5c867c998251..15c43f225e66 100644
--- a/newlib/doc/local.mk
+++ b/newlib/doc/local.mk
@@ -29,3 +29,15 @@ CHEW = $(MKDOC) -f $(srcdir)/%D%/doc.str
 
 .c.def:
 	$(AM_V_GEN)$(CHEW) < $< > $*.def || ( rm $*.def && false )
+
+SUFFIXES += .xml
+
+DOCBOOK_CHEW = ${top_srcdir}/%D%/makedocbook.py
+
+.c.xml:
+	$(AM_V_GEN)$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
+
+# We can't use .tex.xml rule here as it'll conflict with .c.xml when the chapter
+# name (e.g. "stdio.xml") matches a source file name (e.g. "stdio.c").  We've
+# been flattening chapters into the main library dir (e.g. libc/) to avoid that.
+TEXI2DOCBOOK = $(top_srcdir)/%D%/chapter-texi2docbook.py
diff --git a/newlib/libc/Makefile.am b/newlib/libc/Makefile.am
index 4e0b8fdf24ea..7e41b9145d5a 100644
--- a/newlib/libc/Makefile.am
+++ b/newlib/libc/Makefile.am
@@ -124,77 +124,13 @@ endif # USE_LIBTOOL
 
 $(SUBLIBS): ; @true
 
-# This is a list of the stmp-def files in each subdirectory which
-# builds .def files.  We don't list subdirectories which don't build
-# .def files; if the list of subdirectories changes, we must change
-# this as well.
-SUBDEFS = \
-	stdlib/stmp-def \
-	ctype/stmp-def \
-	stdio/stmp-def \
-	stdio64/stmp-def \
-	posix/stmp-def \
-	xdr/stmp-def \
-	string/stmp-def \
-	signal/stmp-def \
-	time/stmp-def \
-	locale/stmp-def \
-	reent/stmp-def \
-	misc/stmp-def
-
-# ditto for stmp-xml files in each subdirectory which builds .xml files
-SUBXMLS = $(SUBDEFS:stmp-def=stmp-xml)
-
-libc.info: targetdep.tex $(SUBDEFS)
-
-libc.dvi: targetdep.tex $(SUBDEFS)
-
-stmp-targetdep: force
-	rm -f tmp-targetdep.texi
-	targetdoc=`pwd`/tmp-targetdep.texi; \
-	for d in $(SUBDIRS); do \
-	  if test "$$d" != "." && test "$$d" != "$(LIBC_MACHINE_DIR)"; then \
-	    (cd $$d && $(MAKE) TARGETDOC=$${targetdoc} doc) || exit 1; \
-	  fi; \
-	done
-	cat $(srcdir)/sys.tex >>tmp-targetdep.texi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-targetdep.texi targetdep.tex
-	touch $@
-
-targetdep.tex: stmp-targetdep ; @true
-
-$(SUBDEFS): stmp-targetdep ; @true
-
-TEXINFO_TEX = ../../texinfo/texinfo.tex
-info_TEXINFOS = libc.texi
-libc_TEXINFOS = targetdep.tex $(SUBDEFS)
-
-docbook-recursive: force
-	for d in $(SUBDIRS); do \
-	  if test "$$d" != "." && test "$$d" != "$(LIBC_MACHINE_DIR)"; then \
-	    (cd $$d && $(MAKE) docbook) || exit 1; \
-	  fi; \
-	done
-
-$(SUBXMLS): docbook-recursive
-
-man: $(SUBXMLS) libc.in.xml
-	xsltproc --xinclude --path ${builddir} --nonet ${srcdir}/../refcontainers.xslt ${srcdir}/libc.in.xml >libc.xml
-	xmlto --skip-validation man -m ${srcdir}/../man.xsl libc.xml
-
-install-man: man
-	mkdir -p $(DESTDIR)$(mandir)/man3
-	$(INSTALL_DATA) *.3 $(DESTDIR)$(mandir)/man3
-
-.PHONY: force
-force:
-
-CLEANFILES = \
-	sigset.texi stmp-sigset \
-	stdio64.texi stmp-stdio64 targetdep.tex stmp-targetdep \
-	tmp-sigset.texi tmp-iconvset.texi \
-	tmp-stdio64.texi tmp-posix.texi tmp-targetdep.texi \
-	*.xml *.3
+crt0.o: sys/crt0.o
+	rm -f $@
+	ln sys/crt0.o $@ >/dev/null 2>/dev/null || cp sys/crt0.o $@
+
+sys/crt0.o: ; @true
+
+CLEANFILES = $(CRT0)
 
 ACLOCAL_AMFLAGS = -I .. -I ../.. -I ../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libc/Makefile.inc b/newlib/libc/Makefile.inc
index b1caae828201..568aa3e4a81c 100644
--- a/newlib/libc/Makefile.inc
+++ b/newlib/libc/Makefile.inc
@@ -4,6 +4,7 @@ info_TEXINFOS += %D%/libc.texi
 LIBC_CHEWOUT_FILES =
 
 LIBC_CHAPTERS = %D%/sys.tex
+LIBC_DOCBOOK_OUT_FILES = $(LIBC_CHEWOUT_FILES:.def=.xml)
 
 %D%/libc.dvi: %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
 
@@ -12,6 +13,24 @@ LIBC_CHAPTERS = %D%/sys.tex
 	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change [email protected] $@
 	$(AM_V_at)touch $@
 
+%D%/libc.xml: %D%/libc.in.xml $(LIBC_CHAPTERS) $(LIBC_DOCBOOK_OUT_FILES)
+	$(AM_V_at)\
+	for chapter in $(LIBC_CHAPTERS); do \
+	  $(TEXI2DOCBOOK) < $(srcdir)/$$chapter > %D%/`basename $${chapter%.tex}`.xml || exit 1; \
+	done
+	$(AM_V_GEN)xsltproc --xinclude --path $(builddir)/%D% --nonet $(srcdir)/refcontainers.xslt $< > [email protected]
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change [email protected] $@
+	$(AM_V_at)touch $@
+
+%C%_man: %D%/libc.xml
+	$(AM_V_GEN)xmlto --skip-validation -o %D% --searchpath $(builddir)/%D% man -m $(srcdir)/man.xsl %D%/libc.xml
+man: %C%_man
+
+%C%_install-man: %C%_man
+	$(MKDIR_P) $(DESTDIR)$(mandir)/man3
+	$(INSTALL_DATA) %D%/*.3 $(DESTDIR)$(mandir)/man3/
+install-man: %C%_install-man
+
 include %D%/ctype/Makefile.inc
 include %D%/iconv/Makefile.inc
 include %D%/locale/Makefile.inc
@@ -29,4 +48,6 @@ include %D%/time/Makefile.inc
 
 CLEANFILES += \
 	%D%/targetdep.tex \
-	$(LIBC_CHEWOUT_FILES)
+	$(LIBC_CHEWOUT_FILES) \
+	$(LIBC_DOCBOOK_OUT_FILES) \
+	%D%/*.xml %D%/*.3
diff --git a/newlib/libc/ctype/Makefile.am b/newlib/libc/ctype/Makefile.am
index e074e4d7f80e..4c4c36db1520 100644
--- a/newlib/libc/ctype/Makefile.am
+++ b/newlib/libc/ctype/Makefile.am
@@ -95,10 +95,4 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
-
 $(lpfx)ctype_.$(oext): ctype_.c ctype_iso.h ctype_cp.h
diff --git a/newlib/libc/iconv/Makefile.am b/newlib/libc/iconv/Makefile.am
index 83570986116c..d9c0d4077b4b 100644
--- a/newlib/libc/iconv/Makefile.am
+++ b/newlib/libc/iconv/Makefile.am
@@ -7,9 +7,3 @@ cct_DATA=encoding.aliases
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
 
 include $(srcdir)/../../Makefile.shared
-
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/locale/Makefile.am b/newlib/libc/locale/Makefile.am
index 3055d0ceb2be..c060496cfcdb 100644
--- a/newlib/libc/locale/Makefile.am
+++ b/newlib/libc/locale/Makefile.am
@@ -35,9 +35,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/misc/Makefile.am b/newlib/libc/misc/Makefile.am
index 6d9fefaec06b..f8f8bb15a548 100644
--- a/newlib/libc/misc/Makefile.am
+++ b/newlib/libc/misc/Makefile.am
@@ -23,9 +23,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/posix/Makefile.am b/newlib/libc/posix/Makefile.am
index 984ae7fb5ac0..4f4c12d8a3e8 100644
--- a/newlib/libc/posix/Makefile.am
+++ b/newlib/libc/posix/Makefile.am
@@ -49,10 +49,4 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
-
 AM_CFLAGS = -D_GNU_SOURCE
diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am
index dad7efdbeb41..bf0c8d7f6a17 100644
--- a/newlib/libc/reent/Makefile.am
+++ b/newlib/libc/reent/Makefile.am
@@ -61,10 +61,4 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
-
 $(lpfx)impure.$(oext): $(srcdir)/impure.c $(srcdir)/../include/sys/reent.h
diff --git a/newlib/libc/search/Makefile.am b/newlib/libc/search/Makefile.am
index eedb2bad6cb2..c64f28931171 100644
--- a/newlib/libc/search/Makefile.am
+++ b/newlib/libc/search/Makefile.am
@@ -62,9 +62,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/signal/Makefile.am b/newlib/libc/signal/Makefile.am
index fdcd17d7e10b..d631662beda1 100644
--- a/newlib/libc/signal/Makefile.am
+++ b/newlib/libc/signal/Makefile.am
@@ -18,9 +18,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/ssp/Makefile.am b/newlib/libc/ssp/Makefile.am
index da5573202f04..2ff5fa0bf924 100644
--- a/newlib/libc/ssp/Makefile.am
+++ b/newlib/libc/ssp/Makefile.am
@@ -62,9 +62,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am
index c8d5f010fbe1..f1fd89f364c8 100644
--- a/newlib/libc/stdio/Makefile.am
+++ b/newlib/libc/stdio/Makefile.am
@@ -241,12 +241,6 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
-
 # Though small footprint nano-formatted-IO implementation is used
 # when NEWLIB_NANO_FORMATTED_IO is enabled, we keep all rules for
 # the other implementation of formatted IO including all i-family
diff --git a/newlib/libc/stdio64/Makefile.am b/newlib/libc/stdio64/Makefile.am
index 56ddbe31f052..3d479d7faf26 100644
--- a/newlib/libc/stdio64/Makefile.am
+++ b/newlib/libc/stdio64/Makefile.am
@@ -38,10 +38,4 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
-
 AM_CFLAGS = -I $(srcdir)/../stdio
diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am
index b88aee40b9f9..75fb52f50d7e 100644
--- a/newlib/libc/stdlib/Makefile.am
+++ b/newlib/libc/stdlib/Makefile.am
@@ -222,12 +222,6 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
-
 MALLOC_COMPILE = $(LIB_COMPILE) -DINTERNAL_NEWLIB
 
 $(lpfx)$(MALLOCR).$(oext): $(MALLOCR).c
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
index d85a51365c34..ac41665bb2dc 100644
--- a/newlib/libc/string/Makefile.am
+++ b/newlib/libc/string/Makefile.am
@@ -143,9 +143,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/time/Makefile.am b/newlib/libc/time/Makefile.am
index e9dcee44c4c7..a2a807917e76 100644
--- a/newlib/libc/time/Makefile.am
+++ b/newlib/libc/time/Makefile.am
@@ -42,10 +42,4 @@ endif # USE_LIBTOOL
 # This rule is needed so that wcsftime.o is rebuilt when strftime.c changes.
 include $(srcdir)/../../Makefile.shared
 
-LIBC_CHEWOUT_FILES =
-LIBC_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
-
 $(lpfx)wcsftime.$(oext): strftime.c
diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
index 1070af011ddd..6ea7ec04fb19 100644
--- a/newlib/libm/Makefile.am
+++ b/newlib/libm/Makefile.am
@@ -36,27 +36,5 @@ endif
 
 $(SUBLIBS):
 
-docbook-recursive: force
-	for d in $(SUBDIRS); do \
-	  if test "$$d" != "."; then \
-	    (cd $$d && $(MAKE) docbook) || exit 1; \
-	  fi; \
-	done
-
-math/stmp-xml complex/stmp-xml: docbook-recursive
-
-man: math/stmp-xml complex/stmp-xml libm.in.xml
-	xsltproc --xinclude --path ${builddir} --nonet ${srcdir}/../refcontainers.xslt ${srcdir}/libm.in.xml >libm.xml
-	xmlto --skip-validation --searchpath ${builddir} man -m ${srcdir}/../man.xsl libm.xml
-
-install-man: man
-	mkdir -p $(DESTDIR)$(mandir)/man3
-	$(INSTALL_DATA) *.3 $(DESTDIR)$(mandir)/man3/
-
-.PHONY: force
-force:
-
-CLEANFILES = *.xml *.3
-
 ACLOCAL_AMFLAGS = -I .. -I ../.. -I ../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/Makefile.inc b/newlib/libm/Makefile.inc
index 9aa5a5c93519..7e35f19f9ce0 100644
--- a/newlib/libm/Makefile.inc
+++ b/newlib/libm/Makefile.inc
@@ -4,6 +4,7 @@ info_TEXINFOS += %D%/libm.texi
 LIBM_CHEWOUT_FILES =
 
 LIBM_CHAPTERS =
+LIBM_DOCBOOK_OUT_FILES = $(LIBM_CHEWOUT_FILES:.def=.xml)
 
 %D%/libm.dvi: %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
 
@@ -12,6 +13,24 @@ LIBM_CHAPTERS =
 	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change [email protected] $@
 	$(AM_V_at)touch $@
 
+%D%/libm.xml: %D%/libm.in.xml $(LIBM_CHAPTERS) $(LIBM_DOCBOOK_OUT_FILES)
+	$(AM_V_at)\
+	for chapter in $(LIBM_CHAPTERS); do \
+	  $(TEXI2DOCBOOK) < $(srcdir)/$$chapter > %D%/`basename $${chapter%.tex}`.xml || exit 1; \
+	done
+	$(AM_V_GEN)xsltproc --xinclude --path $(builddir)/%D% --nonet $(srcdir)/refcontainers.xslt $< > [email protected]
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change [email protected] $@
+	$(AM_V_at)touch $@
+
+%C%_man: %D%/libm.xml
+	$(AM_V_GEN)xmlto --skip-validation -o %D% --searchpath $(builddir)/%D% man -m $(srcdir)/man.xsl %D%/libm.xml
+man: %C%_man
+
+%C%_install-man: %C%_man
+	$(MKDIR_P) $(DESTDIR)$(mandir)/man3
+	$(INSTALL_DATA) %D%/*.3 $(DESTDIR)$(mandir)/man3/
+install-man: %C%_install-man
+
 include %D%/common/Makefile.inc
 include %D%/complex/Makefile.inc
 include %D%/fenv/Makefile.inc
@@ -23,4 +42,6 @@ endif
 
 CLEANFILES += \
 	%D%/targetdep.tex \
-	$(LIBM_CHEWOUT_FILES)
+	$(LIBM_CHEWOUT_FILES) \
+	$(LIBM_DOCBOOK_OUT_FILES) \
+	%D%/*.xml %D%/*.3
diff --git a/newlib/libm/common/Makefile.am b/newlib/libm/common/Makefile.am
index 29597d6031a9..325f4717d736 100644
--- a/newlib/libm/common/Makefile.am
+++ b/newlib/libm/common/Makefile.am
@@ -59,12 +59,6 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBM_CHEWOUT_FILES =
-LIBM_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
-CHAPTERS = $(LIBM_CHAPTERS)
-
 # A partial dependency list.
 
 $(lib_a_OBJECTS): $(srcdir)/../../libc/include/math.h fdlibm.h
diff --git a/newlib/libm/complex/Makefile.am b/newlib/libm/complex/Makefile.am
index 0f27fff19ff6..aceb55e9fc7b 100644
--- a/newlib/libm/complex/Makefile.am
+++ b/newlib/libm/complex/Makefile.am
@@ -35,12 +35,6 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBM_CHEWOUT_FILES =
-LIBM_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
-CHAPTERS = $(LIBM_CHAPTERS)
-
 # A partial dependency list.
 
 $(lib_a_OBJECTS): $(srcdir)/../../libc/include/complex.h $(srcdir)/cephes_subr.h $(srcdir)/cephes_subrf.h  $(srcdir)/cephes_subrl.h
diff --git a/newlib/libm/fenv/Makefile.am b/newlib/libm/fenv/Makefile.am
index 00c55d03898d..d515192c0b36 100644
--- a/newlib/libm/fenv/Makefile.am
+++ b/newlib/libm/fenv/Makefile.am
@@ -22,12 +22,6 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBM_CHEWOUT_FILES =
-LIBM_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
-CHAPTERS = $(LIBM_CHAPTERS)
-
 # A partial dependency list.
 
 $(lib_a_OBJECTS): $(srcdir)/../../libc/include/fenv.h
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am
index 3d23a46a15e6..3402090aaecb 100644
--- a/newlib/libm/math/Makefile.am
+++ b/newlib/libm/math/Makefile.am
@@ -66,12 +66,6 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBM_CHEWOUT_FILES =
-LIBM_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
-CHAPTERS = $(LIBM_CHAPTERS)
-
 # A partial dependency list.
 
 $(lib_a_OBJECTS): $(srcdir)/../../libc/include/math.h $(srcdir)/../common/fdlibm.h
diff --git a/newlib/libm/mathfp/Makefile.am b/newlib/libm/mathfp/Makefile.am
index 44d0e8f28026..3f4bd75d32df 100644
--- a/newlib/libm/mathfp/Makefile.am
+++ b/newlib/libm/mathfp/Makefile.am
@@ -56,12 +56,6 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-LIBM_CHEWOUT_FILES =
-LIBM_CHAPTERS =
-include ./Makefile.inc
-CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
-CHAPTERS = $(LIBM_CHAPTERS)
-
 # A partial dependency list.
 
 $(lib_a_OBJECTS): $(srcdir)/../../libc/include/math.h $(srcdir)/../common/fdlibm.h
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.