public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] migrate documentation into top-level
@ 2022-01-22  4:32 Mike Frysinger
  2022-01-22  4:32 ` [PATCH 1/5] newlib: libm: move manual into top-level build Mike Frysinger
                   ` (6 more replies)
  0 siblings, 7 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-22  4:32 UTC (permalink / raw)
  To: newlib

The current documentation build rules are spread through out the tree.
I don't mean the subdirs declaring their chapters & source files (that
is a good thing), I mean the rules that actually transform & accumulate
to produce final texi/info/pdf & docbook/man pages.  This means when we
build them, we have to run recursive make to build each subpiece before
having a higher level try and accumulate them.  The TARGETDOC rules in
particular are a bit dicey as multiple subdirs write to the same file.

The end result has the nice properties:
* Fewer lines (final delta is like -2.5k)
* Fewer recursive subdirs
* Can build all the docs in parallel from the top-level
* Can generate stable documentation regardless of configure settings

This is one small but critical step in killing off subdirs entirely.

Mike Frysinger (5):
  newlib: libm: move manual into top-level build
  newlib: libc: include all chapters all the time in the manual
  newlib: libc: move manual into top-level build
  newlib: move man page generation into top-level build
  newlib: drop shared documentation rules

 newlib/Makefile.am                            |  26 +-
 newlib/Makefile.in                            | 726 ++++++++++++++++--
 newlib/Makefile.shared                        |  36 -
 newlib/doc/local.mk                           |  23 +
 newlib/libc/Makefile.am                       | 119 +--
 newlib/libc/Makefile.in                       | 500 +-----------
 newlib/libc/argz/Makefile.am                  |   4 -
 newlib/libc/argz/Makefile.in                  |  43 +-
 newlib/libc/configure                         |  24 +-
 newlib/libc/configure.ac                      |  15 -
 newlib/libc/ctype/Makefile.am                 |  37 -
 newlib/libc/ctype/Makefile.in                 |  76 +-
 newlib/libc/ctype/local.mk                    |  36 +
 newlib/libc/errno/Makefile.am                 |   4 -
 newlib/libc/errno/Makefile.in                 |  43 +-
 newlib/libc/iconv/Makefile.am                 |  24 -
 newlib/libc/iconv/Makefile.in                 |  61 --
 newlib/libc/iconv/ccs/Makefile.am             |   3 -
 newlib/libc/iconv/ccs/Makefile.in             |  42 +-
 newlib/libc/iconv/ccs/binary/Makefile.in      |  39 -
 newlib/libc/iconv/ces/Makefile.am             |   3 -
 newlib/libc/iconv/ces/Makefile.in             |  42 +-
 newlib/libc/iconv/iconv.tex                   |   2 +-
 newlib/libc/iconv/lib/Makefile.am             |   3 -
 newlib/libc/iconv/lib/Makefile.in             |  42 +-
 newlib/libc/iconv/lib/local.mk                |   1 +
 newlib/libc/iconv/local.mk                    |   3 +
 newlib/libc/libc.texi                         |  18 -
 newlib/libc/local.mk                          |  53 ++
 newlib/libc/locale/Makefile.am                |   9 -
 newlib/libc/locale/Makefile.in                |  48 +-
 newlib/libc/locale/local.mk                   |   8 +
 newlib/libc/machine/Makefile.am               |   4 -
 newlib/libc/machine/Makefile.in               |   4 -
 newlib/libc/machine/i386/Makefile.in          |  35 +-
 newlib/libc/misc/Makefile.am                  |   3 -
 newlib/libc/misc/Makefile.in                  |  42 +-
 newlib/libc/misc/local.mk                     |   6 +
 newlib/libc/posix/Makefile.am                 |   6 -
 newlib/libc/posix/Makefile.in                 |  45 +-
 newlib/libc/posix/local.mk                    |   5 +
 newlib/libc/reent/Makefile.am                 |  26 -
 newlib/libc/reent/Makefile.in                 |  65 +-
 newlib/libc/reent/local.mk                    |  25 +
 newlib/libc/search/Makefile.am                |   7 -
 newlib/libc/search/Makefile.in                |  46 +-
 newlib/libc/search/local.mk                   |   4 +
 newlib/libc/signal/Makefile.am                |   4 -
 newlib/libc/signal/Makefile.in                |  42 +-
 newlib/libc/signal/local.mk                   |   7 +
 newlib/libc/ssp/Makefile.am                   |   3 -
 newlib/libc/ssp/Makefile.in                   |  42 +-
 newlib/libc/ssp/local.mk                      |   3 +
 newlib/libc/stdio/Makefile.am                 | 464 +++++------
 newlib/libc/stdio/Makefile.in                 | 120 +--
 newlib/libc/stdio/local.mk                    |  80 ++
 newlib/libc/stdio64/Makefile.am               |  12 -
 newlib/libc/stdio64/Makefile.in               |  51 +-
 newlib/libc/stdio64/local.mk                  |  11 +
 newlib/libc/stdlib/Makefile.am                |  52 --
 newlib/libc/stdlib/Makefile.in                |  91 +--
 newlib/libc/stdlib/local.mk                   |  51 ++
 newlib/libc/string/Makefile.am                |  23 -
 newlib/libc/string/Makefile.in                |  62 +-
 newlib/libc/string/local.mk                   |  22 +
 newlib/libc/sys/Makefile.am                   |   4 -
 newlib/libc/sys/Makefile.in                   |   4 -
 newlib/libc/sys/linux/argp/Makefile.in        |  35 +-
 newlib/libc/sys/linux/cmath/Makefile.in       |  35 +-
 newlib/libc/sys/linux/dl/Makefile.in          |  35 +-
 newlib/libc/sys/linux/iconv/Makefile.in       |  35 +-
 newlib/libc/sys/linux/intl/Makefile.in        |  35 +-
 .../libc/sys/linux/linuxthreads/Makefile.in   |  35 +-
 .../linuxthreads/machine/i386/Makefile.in     |  35 +-
 .../libc/sys/linux/machine/i386/Makefile.in   |  35 +-
 newlib/libc/sys/linux/net/Makefile.in         |  35 +-
 newlib/libc/syscalls/Makefile.am              |   4 -
 newlib/libc/syscalls/Makefile.in              |  43 +-
 newlib/libc/time/Makefile.am                  |  16 -
 newlib/libc/time/Makefile.in                  |  55 +-
 newlib/libc/time/local.mk                     |  15 +
 newlib/libc/unix/Makefile.am                  |   4 -
 newlib/libc/unix/Makefile.in                  |  43 +-
 newlib/libc/xdr/Makefile.am                   |   4 -
 newlib/libc/xdr/Makefile.in                   |  43 +-
 newlib/libm/Makefile.am                       |  47 --
 newlib/libm/Makefile.in                       | 420 +---------
 newlib/libm/common/Makefile.am                |  10 -
 newlib/libm/common/Makefile.in                |  44 +-
 newlib/libm/common/local.mk                   |  10 +
 newlib/libm/complex/Makefile.am               |   8 -
 newlib/libm/complex/Makefile.in               |  42 +-
 newlib/libm/complex/local.mk                  |   8 +
 newlib/libm/fenv/Makefile.am                  |   7 -
 newlib/libm/fenv/Makefile.in                  |  41 +-
 newlib/libm/fenv/local.mk                     |   7 +
 newlib/libm/local.mk                          |  47 ++
 newlib/libm/machine/Makefile.am               |   4 -
 newlib/libm/machine/Makefile.in               |   4 -
 newlib/libm/machine/aarch64/Makefile.in       |  35 +-
 newlib/libm/machine/arm/Makefile.in           |  35 +-
 newlib/libm/machine/i386/Makefile.in          |  35 +-
 newlib/libm/machine/mips/Makefile.in          |  35 +-
 newlib/libm/machine/nds32/Makefile.in         |  35 +-
 newlib/libm/machine/powerpc/Makefile.in       |  35 +-
 newlib/libm/machine/pru/Makefile.in           |  35 +-
 newlib/libm/machine/riscv/Makefile.in         |  35 +-
 newlib/libm/machine/sparc/Makefile.in         |  35 +-
 newlib/libm/machine/spu/Makefile.in           |  35 +-
 newlib/libm/machine/x86_64/Makefile.in        |  35 +-
 newlib/libm/math/Makefile.am                  |  11 -
 newlib/libm/math/Makefile.in                  |  45 +-
 newlib/libm/math/local.mk                     |  11 +
 newlib/libm/mathfp/Makefile.am                |  31 -
 newlib/libm/mathfp/Makefile.in                |  65 +-
 newlib/libm/mathfp/local.mk                   |  31 +
 116 files changed, 1463 insertions(+), 3941 deletions(-)
 create mode 100644 newlib/libc/ctype/local.mk
 create mode 100644 newlib/libc/iconv/lib/local.mk
 create mode 100644 newlib/libc/iconv/local.mk
 create mode 100644 newlib/libc/local.mk
 create mode 100644 newlib/libc/locale/local.mk
 create mode 100644 newlib/libc/misc/local.mk
 create mode 100644 newlib/libc/posix/local.mk
 create mode 100644 newlib/libc/reent/local.mk
 create mode 100644 newlib/libc/search/local.mk
 create mode 100644 newlib/libc/signal/local.mk
 create mode 100644 newlib/libc/ssp/local.mk
 create mode 100644 newlib/libc/stdio/local.mk
 create mode 100644 newlib/libc/stdio64/local.mk
 create mode 100644 newlib/libc/stdlib/local.mk
 create mode 100644 newlib/libc/string/local.mk
 create mode 100644 newlib/libc/time/local.mk
 create mode 100644 newlib/libm/common/local.mk
 create mode 100644 newlib/libm/complex/local.mk
 create mode 100644 newlib/libm/fenv/local.mk
 create mode 100644 newlib/libm/local.mk
 create mode 100644 newlib/libm/math/local.mk
 create mode 100644 newlib/libm/mathfp/local.mk

-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/5] newlib: libm: move manual into top-level build
  2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
@ 2022-01-22  4:32 ` Mike Frysinger
  2022-01-22  4:32 ` [PATCH 2/5] newlib: libc: include all chapters all the time in the manual Mike Frysinger
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-22  4:32 UTC (permalink / raw)
  To: newlib

This doesn't migrate all the docs, just the libm's manual (pdf/info).
This is to show the basic form of migrating the chew files.
---
 newlib/Makefile.am              |   9 +
 newlib/Makefile.in              | 454 +++++++++++++++++++++++++++++---
 newlib/doc/local.mk             |  11 +
 newlib/libm/Makefile.am         |  27 +-
 newlib/libm/Makefile.in         | 398 +++-------------------------
 newlib/libm/common/Makefile.am  |  14 +-
 newlib/libm/common/Makefile.in  |  22 +-
 newlib/libm/common/local.mk     |  10 +
 newlib/libm/complex/Makefile.am |  12 +-
 newlib/libm/complex/Makefile.in |  18 +-
 newlib/libm/complex/local.mk    |   8 +
 newlib/libm/fenv/Makefile.am    |  11 +-
 newlib/libm/fenv/Makefile.in    |  15 +-
 newlib/libm/fenv/local.mk       |   7 +
 newlib/libm/local.mk            |  26 ++
 newlib/libm/math/Makefile.am    |  15 +-
 newlib/libm/math/Makefile.in    |  23 +-
 newlib/libm/math/local.mk       |  11 +
 newlib/libm/mathfp/Makefile.am  |  35 +--
 newlib/libm/mathfp/Makefile.in  |  42 +--
 newlib/libm/mathfp/local.mk     |  31 +++
 21 files changed, 638 insertions(+), 561 deletions(-)
 create mode 100644 newlib/libm/common/local.mk
 create mode 100644 newlib/libm/complex/local.mk
 create mode 100644 newlib/libm/fenv/local.mk
 create mode 100644 newlib/libm/local.mk
 create mode 100644 newlib/libm/math/local.mk
 create mode 100644 newlib/libm/mathfp/local.mk

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 6a28215d3620..8ad74cfd54fe 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -5,6 +5,8 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 
 # Variables that will accumulate in subdirs.
 PHONY =
+SUFFIXES =
+info_TEXINFOS =
 noinst_DATA =
 
 # Multilib support variables.
@@ -536,8 +538,15 @@ check-DEJAGNU: site.exp
 clean-local:
 	-rm -rf targ-include newlib.h _newlib_version.h stamp-*
 
+# Workaround bad automake/texinfo interactions.
+# https://bugs.gnu.org/23599
+TEXI2DVI = texi2dvi -E
+
+TEXINFO_TEX = ../texinfo/texinfo.tex
+
 if HAVE_DOC
 include doc/local.mk
 endif
+include libm/local.mk
 
 .PHONY: $(PHONY)
diff --git a/newlib/doc/local.mk b/newlib/doc/local.mk
index 64083c3dd600..5c867c998251 100644
--- a/newlib/doc/local.mk
+++ b/newlib/doc/local.mk
@@ -18,3 +18,14 @@ man-cache:
 	${srcdir}/doc/makedocbook.py --cache
 
 PHONY += man-cache
+
+#
+# Subdir documentation rules.
+#
+
+SUFFIXES += .def
+
+CHEW = $(MKDOC) -f $(srcdir)/%D%/doc.str
+
+.c.def:
+	$(AM_V_GEN)$(CHEW) < $< > $*.def || ( rm $*.def && false )
diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
index 8d355cbf6f69..08d6faa8ac17 100644
--- a/newlib/libm/Makefile.am
+++ b/newlib/libm/Makefile.am
@@ -33,31 +33,6 @@ endif
 
 $(SUBLIBS):
 
-TEXINFO_TEX = ../../texinfo/texinfo.tex
-info_TEXINFOS = libm.texi
-libm_TEXINFOS = targetdep.tex
-
-libm.dvi: targetdep.tex math/stmp-def complex/stmp-def fenv/stmp-def
-
-stmp-targetdep: force
-	rm -f tmp.texi
-	targetdoc=`pwd`/tmp.texi; \
-	for d in $(SUBDIRS); do \
-	  if test "$$d" != "."; then \
-	    (cd $$d && $(MAKE) doc) || exit 1; \
-	  fi; \
-	done
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp.texi targetdep.tex
-	touch $@
-
-targetdep.tex: stmp-targetdep ; @true
-
-math/stmp-def: stmp-targetdep ; @true
-
-complex/stmp-def: stmp-targetdep ; @true
-
-fenv/stmp-def: stmp-targetdep ; @true
-
 docbook-recursive: force
 	for d in $(SUBDIRS); do \
 	  if test "$$d" != "."; then \
@@ -78,7 +53,7 @@ install-man: man
 .PHONY: force
 force:
 
-CLEANFILES = tmp.texi targetdep.tex stmp-targetdep *.xml *.3
+CLEANFILES = *.xml *.3
 
 ACLOCAL_AMFLAGS = -I .. -I ../.. -I ../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/common/Makefile.am b/newlib/libm/common/Makefile.am
index ef55e90ea462..52f74eec5763 100644
--- a/newlib/libm/common/Makefile.am
+++ b/newlib/libm/common/Makefile.am
@@ -59,15 +59,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	s_cbrt.def s_copysign.def s_exp10.def s_expm1.def s_ilogb.def \
-	s_infinity.def s_isnan.def s_log1p.def s_modf.def \
-	s_nan.def s_nextafter.def s_pow10.def s_scalbn.def \
-	s_fdim.def s_fma.def s_fmax.def s_fmin.def \
-	s_logb.def s_log2.def s_lrint.def s_lround.def s_nearbyint.def \
-	s_remquo.def s_rint.def s_round.def s_signbit.def s_trunc.def \
-	isgreater.def
-
-CHAPTERS =
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/common/local.mk b/newlib/libm/common/local.mk
new file mode 100644
index 000000000000..b0d3013c522b
--- /dev/null
+++ b/newlib/libm/common/local.mk
@@ -0,0 +1,10 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/s_cbrt.def %D%/s_copysign.def %D%/s_exp10.def %D%/s_expm1.def %D%/s_ilogb.def \
+	%D%/s_infinity.def %D%/s_isnan.def %D%/s_log1p.def %D%/s_modf.def \
+	%D%/s_nan.def %D%/s_nextafter.def %D%/s_pow10.def %D%/s_scalbn.def \
+	%D%/s_fdim.def %D%/s_fma.def %D%/s_fmax.def %D%/s_fmin.def \
+	%D%/s_logb.def %D%/s_log2.def %D%/s_lrint.def %D%/s_lround.def %D%/s_nearbyint.def \
+	%D%/s_remquo.def %D%/s_rint.def %D%/s_round.def %D%/s_signbit.def %D%/s_trunc.def \
+	%D%/isgreater.def
+
+LIBM_CHAPTERS +=
diff --git a/newlib/libm/complex/Makefile.am b/newlib/libm/complex/Makefile.am
index 73fa19045754..27993dc43fa2 100644
--- a/newlib/libm/complex/Makefile.am
+++ b/newlib/libm/complex/Makefile.am
@@ -35,13 +35,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	cabs.def cacos.def cacosh.def carg.def \
-        casin.def casinh.def catan.def catanh.def \
-        ccos.def ccosh.def cexp.def cimag.def clog.def \
-        clog10.def conj.def cpow.def cproj.def creal.def \
-        csin.def csinh.def csqrt.def ctan.def ctanh.def
-
-CHAPTERS = complex.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/complex/local.mk b/newlib/libm/complex/local.mk
new file mode 100644
index 000000000000..94288082ea32
--- /dev/null
+++ b/newlib/libm/complex/local.mk
@@ -0,0 +1,8 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/cabs.def %D%/cacos.def %D%/cacosh.def %D%/carg.def \
+	%D%/casin.def %D%/casinh.def %D%/catan.def %D%/catanh.def \
+	%D%/ccos.def %D%/ccosh.def %D%/cexp.def %D%/cimag.def %D%/clog.def \
+	%D%/clog10.def %D%/conj.def %D%/cpow.def %D%/cproj.def %D%/creal.def \
+	%D%/csin.def %D%/csinh.def %D%/csqrt.def %D%/ctan.def %D%/ctanh.def
+
+LIBM_CHAPTERS += %D%/complex.tex
diff --git a/newlib/libm/fenv/Makefile.am b/newlib/libm/fenv/Makefile.am
index db59c8048490..3d0052e53617 100644
--- a/newlib/libm/fenv/Makefile.am
+++ b/newlib/libm/fenv/Makefile.am
@@ -22,12 +22,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	feclearexcept.def fegetenv.def \
-	fegetexceptflag.def fegetround.def feholdexcept.def \
-	feraiseexcept.def fesetenv.def fesetexceptflag.def fesetround.def \
-	fetestexcept.def feupdateenv.def
-
-CHAPTERS = fenv.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/fenv/local.mk b/newlib/libm/fenv/local.mk
new file mode 100644
index 000000000000..0399638ad603
--- /dev/null
+++ b/newlib/libm/fenv/local.mk
@@ -0,0 +1,7 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/feclearexcept.def %D%/fegetenv.def \
+	%D%/fegetexceptflag.def %D%/fegetround.def %D%/feholdexcept.def \
+	%D%/feraiseexcept.def %D%/fesetenv.def %D%/fesetexceptflag.def %D%/fesetround.def \
+	%D%/fetestexcept.def %D%/feupdateenv.def
+
+LIBM_CHAPTERS += %D%/fenv.tex
diff --git a/newlib/libm/local.mk b/newlib/libm/local.mk
new file mode 100644
index 000000000000..db10751f9392
--- /dev/null
+++ b/newlib/libm/local.mk
@@ -0,0 +1,26 @@
+info_TEXINFOS += %D%/libm.texi
+%C%_libm_TEXINFOS = %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
+
+LIBM_CHEWOUT_FILES =
+
+LIBM_CHAPTERS =
+
+%D%/libm.dvi: %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
+
+%D%/targetdep.tex: $(LIBM_CHAPTERS)
+	$(AM_V_GEN)cat $^ > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(AM_V_at)touch $@
+
+include %D%/common/local.mk
+include %D%/complex/local.mk
+include %D%/fenv/local.mk
+if NEWLIB_HW_FP
+include %D%/mathfp/local.mk
+else
+include %D%/math/local.mk
+endif
+
+CLEANFILES += \
+	%D%/targetdep.tex \
+	$(LIBM_CHEWOUT_FILES)
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am
index 5529c358a80e..97d5d3748936 100644
--- a/newlib/libm/math/Makefile.am
+++ b/newlib/libm/math/Makefile.am
@@ -66,16 +66,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = w_acos.def w_acosh.def w_asin.def s_asinh.def \
-	s_atan.def w_atan2.def w_atanh.def w_j0.def \
-	w_cosh.def s_erf.def w_exp.def w_exp2.def \
-	s_fabs.def s_floor.def w_fmod.def s_frexp.def \
-	w_gamma.def w_hypot.def s_ldexp.def w_log.def \
-	w_log10.def \
-	w_pow.def w_remainder.def s_sin.def w_sinh.def \
-	w_sqrt.def s_tan.def s_tanh.def
-
-CHAPTERS = math.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/math/local.mk b/newlib/libm/math/local.mk
new file mode 100644
index 000000000000..bc3205e0b156
--- /dev/null
+++ b/newlib/libm/math/local.mk
@@ -0,0 +1,11 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/w_acos.def %D%/w_acosh.def %D%/w_asin.def %D%/s_asinh.def \
+	%D%/s_atan.def %D%/w_atan2.def %D%/w_atanh.def %D%/w_j0.def \
+	%D%/w_cosh.def %D%/s_erf.def %D%/w_exp.def %D%/w_exp2.def \
+	%D%/s_fabs.def %D%/s_floor.def %D%/w_fmod.def %D%/s_frexp.def \
+	%D%/w_gamma.def %D%/w_hypot.def %D%/s_ldexp.def %D%/w_log.def \
+	%D%/w_log10.def \
+	%D%/w_pow.def %D%/w_remainder.def %D%/s_sin.def %D%/w_sinh.def \
+	%D%/w_sqrt.def %D%/s_tan.def %D%/s_tanh.def
+
+LIBM_CHAPTERS += %D%/math.tex
diff --git a/newlib/libm/mathfp/Makefile.am b/newlib/libm/mathfp/Makefile.am
index 39fb8b1db69e..a35ae1f54d36 100644
--- a/newlib/libm/mathfp/Makefile.am
+++ b/newlib/libm/mathfp/Makefile.am
@@ -56,36 +56,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = e_acosh.def \
-	e_atanh.def \
-	e_hypot.def \
-	e_remainder.def \
-	er_lgamma.def \
-	s_acos.def \
-	s_asine.def \
-	s_asinh.def \
-	s_atan.def \
-	s_atan2.def \
-	s_atangent.def \
-	s_cosh.def \
-	s_erf.def \
-	s_exp.def \
-	s_fabs.def \
-	s_floor.def \
-	s_fmod.def \
-	s_frexp.def \
-	s_ldexp.def \
-	s_log10.def \
-	s_logarithm.def \
-	s_pow.def \
-	s_sine.def \
-	s_sineh.def \
-	s_sqrt.def \
-	s_tan.def \
-	s_tanh.def \
-	w_jn.def
-
-CHAPTERS = mathfp.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/mathfp/local.mk b/newlib/libm/mathfp/local.mk
new file mode 100644
index 000000000000..739e41f16d0b
--- /dev/null
+++ b/newlib/libm/mathfp/local.mk
@@ -0,0 +1,31 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/e_acosh.def \
+	%D%/e_atanh.def \
+	%D%/e_hypot.def \
+	%D%/e_remainder.def \
+	%D%/er_lgamma.def \
+	%D%/s_acos.def \
+	%D%/s_asine.def \
+	%D%/s_asinh.def \
+	%D%/s_atan.def \
+	%D%/s_atan2.def \
+	%D%/s_atangent.def \
+	%D%/s_cosh.def \
+	%D%/s_erf.def \
+	%D%/s_exp.def \
+	%D%/s_fabs.def \
+	%D%/s_floor.def \
+	%D%/s_fmod.def \
+	%D%/s_frexp.def \
+	%D%/s_ldexp.def \
+	%D%/s_log10.def \
+	%D%/s_logarithm.def \
+	%D%/s_pow.def \
+	%D%/s_sine.def \
+	%D%/s_sineh.def \
+	%D%/s_sqrt.def \
+	%D%/s_tan.def \
+	%D%/s_tanh.def \
+	%D%/w_jn.def
+
+LIBM_CHAPTERS += %D%/mathfp.tex
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 2/5] newlib: libc: include all chapters all the time in the manual
  2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
  2022-01-22  4:32 ` [PATCH 1/5] newlib: libm: move manual into top-level build Mike Frysinger
@ 2022-01-22  4:32 ` Mike Frysinger
  2022-01-22  4:32 ` [PATCH 3/5] newlib: libc: move manual into top-level build Mike Frysinger
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-22  4:32 UTC (permalink / raw)
  To: newlib

THe stdio subdir is actually required by the documentation.  The
stdio/def is handled dynamically, but libc.texi always expects it
to be included, and fails if it isn't.  So making it required when
building docs is safe.

The xdr subdir is handled dynamically, but it doesn't include any
docs, so the dynamic logic isn't (currently) adding any value.  So
making it required when building docs is safe.

That leaves: iconv, stdio64, posix, and signal subdirs.  The chapters
have a little disclaimer saying they are system-dependent, but even
then, imo having stable manuals regardless of the target is preferable,
and we can add more disclaimer language to these chapters if we want.

This doesn't touch the man page codepaths, just the info/pdf.
---
 newlib/libc/Makefile.am                  | 69 ++++------------------
 newlib/libc/Makefile.in                  | 75 ++++--------------------
 newlib/libc/argz/Makefile.in             |  5 --
 newlib/libc/configure                    | 24 +-------
 newlib/libc/configure.ac                 | 15 -----
 newlib/libc/ctype/Makefile.in            |  5 --
 newlib/libc/errno/Makefile.in            |  5 --
 newlib/libc/iconv/Makefile.in            |  5 --
 newlib/libc/iconv/ccs/Makefile.in        |  5 --
 newlib/libc/iconv/ccs/binary/Makefile.in |  5 --
 newlib/libc/iconv/ces/Makefile.in        |  5 --
 newlib/libc/iconv/lib/Makefile.in        |  5 --
 newlib/libc/libc.texi                    | 18 ------
 newlib/libc/locale/Makefile.in           |  5 --
 newlib/libc/misc/Makefile.in             |  5 --
 newlib/libc/posix/Makefile.in            |  5 --
 newlib/libc/reent/Makefile.in            |  5 --
 newlib/libc/search/Makefile.in           |  5 --
 newlib/libc/signal/Makefile.in           |  5 --
 newlib/libc/ssp/Makefile.in              |  5 --
 newlib/libc/stdio/Makefile.in            |  5 --
 newlib/libc/stdio64/Makefile.in          |  5 --
 newlib/libc/stdlib/Makefile.in           |  5 --
 newlib/libc/string/Makefile.in           |  5 --
 newlib/libc/syscalls/Makefile.in         |  5 --
 newlib/libc/time/Makefile.in             |  5 --
 newlib/libc/unix/Makefile.in             |  5 --
 newlib/libc/xdr/Makefile.in              |  5 --
 28 files changed, 22 insertions(+), 294 deletions(-)

diff --git a/newlib/libc/Makefile.am b/newlib/libc/Makefile.am
index cdeaf84c4e21..62e04abcfbc1 100644
--- a/newlib/libc/Makefile.am
+++ b/newlib/libc/Makefile.am
@@ -128,12 +128,12 @@ sys/crt0.o: ; @true
 SUBDEFS = \
 	stdlib/stmp-def \
 	ctype/stmp-def \
-	$(LIBC_STDIO_DEF) \
-	$(LIBC_STDIO64_DEF) \
-	$(LIBC_POSIX_DEF) \
-	$(LIBC_XDR_DEF) \
+	stdio/stmp-def \
+	stdio64/stmp-def \
+	posix/stmp-def \
+	xdr/stmp-def \
 	string/stmp-def \
-	$(LIBC_SIGNAL_DEF) \
+	signal/stmp-def \
 	time/stmp-def \
 	locale/stmp-def \
 	reent/stmp-def \
@@ -142,55 +142,9 @@ SUBDEFS = \
 # ditto for stmp-xml files in each subdirectory which builds .xml files
 SUBXMLS = $(SUBDEFS:stmp-def=stmp-xml)
 
-libc.info: sigset.texi stdio64.texi posix.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
+libc.info: targetdep.tex $(SUBDEFS)
 
-libc.dvi: sigset.texi stdio64.texi posix.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
-
-stmp-sigset: config.status
-	if test -n "$(LIBC_SIGNAL_LIB)"; then \
-	  echo "@set SIGNALS" >tmp-sigset.texi; \
-	else \
-	  echo "@clear SIGNALS" >tmp-sigset.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-sigset.texi sigset.texi
-	touch $@
-
-sigset.texi: stmp-sigset ; @true
-
-stmp-iconvset: config.status
-	if test -n "$(NEWLIB_ICONV_LIBS)"; then \
-	  echo "@set ICONV" >tmp-iconvset.texi; \
-	else \
-	  echo "@clear ICONV" >tmp-iconvset.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-iconvset.texi iconvset.texi
-	touch $@
-
-iconvset.texi: stmp-iconvset ; @true
-
-stmp-stdio64: config.status
-	if test -n "$(LIBC_STDIO64_LIB)"; then \
-	  echo "@set STDIO64" >tmp-stdio64.texi; \
-	else \
-	  echo "@clear STDIO64" >tmp-stdio64.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-stdio64.texi stdio64.texi
-	touch $@
-
-stdio64.texi: stmp-stdio64 ; @true
-
-stmp-posix: config.status
-	if test -n "$(LIBC_POSIX_LIB)"; then \
-	  echo "@set POSIX" >tmp-posix.texi; \
-	else \
-	  echo "@clear POSIX" >tmp-posix.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-posix.texi posix.texi
-	touch $@
-
-posix.texi: stmp-posix ; @true
+libc.dvi: targetdep.tex $(SUBDEFS)
 
 stmp-targetdep: force
 	rm -f tmp-targetdep.texi
@@ -210,8 +164,7 @@ $(SUBDEFS): stmp-targetdep ; @true
 
 TEXINFO_TEX = ../../texinfo/texinfo.tex
 info_TEXINFOS = libc.texi
-libc_TEXINFOS = sigset.texi posix.texi stdio64.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
+libc_TEXINFOS = targetdep.tex $(SUBDEFS)
 
 docbook-recursive: force
 	for d in $(SUBDIRS); do \
@@ -234,10 +187,8 @@ install-man: man
 force:
 
 CLEANFILES = $(CRT0) \
-	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 \
+	targetdep.tex stmp-targetdep \
+	tmp-targetdep.texi \
 	*.xml *.3
 
 ACLOCAL_AMFLAGS = -I .. -I ../.. -I ../../config
diff --git a/newlib/libc/configure.ac b/newlib/libc/configure.ac
index 9ed0a5a2e059..311d8fb50ede 100644
--- a/newlib/libc/configure.ac
+++ b/newlib/libc/configure.ac
@@ -71,73 +71,58 @@ dnl for the library and an automake conditional for whether we should
 dnl build the library.
 
 LIBC_SIGNAL_LIB=
-LIBC_SIGNAL_DEF=
 if test -n "${signal_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_SIGNAL_LIB=${signal_dir}/lib${signal_dir}.${aext}
   else
     LIBC_SIGNAL_LIB=${signal_dir}/lib.${aext}
   fi
-  LIBC_SIGNAL_DEF=${signal_dir}/stmp-def
 fi
 AC_SUBST(LIBC_SIGNAL_LIB)
-AC_SUBST(LIBC_SIGNAL_DEF)
 AM_CONDITIONAL(HAVE_SIGNAL_DIR, test x${signal_dir} != x)
 
 LIBC_STDIO_LIB=
-LIBC_STDIO_DEF=
 if test -n "${stdio_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_STDIO_LIB=${stdio_dir}/lib${stdio_dir}.${aext}
   else
     LIBC_STDIO_LIB=${stdio_dir}/lib.${aext}
   fi
-  LIBC_STDIO_DEF=${stdio_dir}/stmp-def
 fi
 AC_SUBST(LIBC_STDIO_LIB)
-AC_SUBST(LIBC_STDIO_DEF)
 AM_CONDITIONAL(HAVE_STDIO_DIR, test x${stdio_dir} != x)
 
 LIBC_STDIO64_LIB=
-LIBC_STDIO64_DEF=
 if test -n "${stdio64_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_STDIO64_LIB=${stdio64_dir}/lib${stdio64_dir}.${aext}
   else
     LIBC_STDIO64_LIB=${stdio64_dir}/lib.${aext}
   fi
-  LIBC_STDIO64_DEF=${stdio64_dir}/stmp-def
 fi
 AC_SUBST(LIBC_STDIO64_LIB)
-AC_SUBST(LIBC_STDIO64_DEF)
 AM_CONDITIONAL(HAVE_STDIO64_DIR, test x${stdio64_dir} != x)
 
 LIBC_POSIX_LIB=
-LIBC_POSIX_DEF=
 if test -n "${posix_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_POSIX_LIB=${posix_dir}/lib${posix_dir}.${aext}
   else
     LIBC_POSIX_LIB=${posix_dir}/lib.${aext}
   fi
-  LIBC_POSIX_DEF=${posix_dir}/stmp-def
 fi
 AC_SUBST(LIBC_POSIX_LIB)
-AC_SUBST(LIBC_POSIX_DEF)
 AM_CONDITIONAL(HAVE_POSIX_DIR, test x${posix_dir} != x)
 
 LIBC_XDR_LIB=
-LIBC_XDR_DEF=
 if test -n "${xdr_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_XDR_LIB=${xdr_dir}/lib${xdr_dir}.${aext}
   else
     LIBC_XDR_LIB=${xdr_dir}/lib.${aext}
   fi
-  LIBC_XDR_DEF=${xdr_dir}/stmp-def
 fi
 AC_SUBST(LIBC_XDR_LIB)
-AC_SUBST(LIBC_XDR_DEF)
 AM_CONDITIONAL(HAVE_XDR_DIR, test x${xdr_dir} != x)
 
 LIBC_SYSCALL_LIB=
diff --git a/newlib/libc/iconv/ccs/binary/Makefile.in b/newlib/libc/iconv/ccs/binary/Makefile.in
index a6bd94360c77..a5b242b98b84 100644
--- a/newlib/libc/iconv/ccs/binary/Makefile.in
+++ b/newlib/libc/iconv/ccs/binary/Makefile.in
@@ -193,18 +193,13 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBC_MACHINE_LIB = @LIBC_MACHINE_LIB@
-LIBC_POSIX_DEF = @LIBC_POSIX_DEF@
 LIBC_POSIX_LIB = @LIBC_POSIX_LIB@
-LIBC_SIGNAL_DEF = @LIBC_SIGNAL_DEF@
 LIBC_SIGNAL_LIB = @LIBC_SIGNAL_LIB@
-LIBC_STDIO64_DEF = @LIBC_STDIO64_DEF@
 LIBC_STDIO64_LIB = @LIBC_STDIO64_LIB@
-LIBC_STDIO_DEF = @LIBC_STDIO_DEF@
 LIBC_STDIO_LIB = @LIBC_STDIO_LIB@
 LIBC_SYSCALL_LIB = @LIBC_SYSCALL_LIB@
 LIBC_SYS_LIB = @LIBC_SYS_LIB@
 LIBC_UNIX_LIB = @LIBC_UNIX_LIB@
-LIBC_XDR_DEF = @LIBC_XDR_DEF@
 LIBC_XDR_LIB = @LIBC_XDR_LIB@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
diff --git a/newlib/libc/libc.texi b/newlib/libc/libc.texi
index 0cab22036dee..d217d8118277 100644
--- a/newlib/libc/libc.texi
+++ b/newlib/libc/libc.texi
@@ -132,44 +132,26 @@ into another language, under the above conditions for modified versions.
 @node Top
 @top The Red Hat newlib C Library
 
-@c The menu contents depend on the configuration, so we include them
-@c as a separate file
-
-@c switch to set SIGNALS on or off, according to whether config picks up
-@c signal subdirectory:
-@include sigset.texi
-@include posix.texi
-@include stdio64.texi
-@include iconvset.texi
-
 @menu
 * Introduction::
 * Stdlib::
 * Ctype::
 * Stdio::
-@ifset STDIO64
 * Stdio64::
-@end ifset
 
 * Strings::
 * Wchar strings::
-@ifset SIGNALS
 * Signals::
-@end ifset
 
 * Timefns::
 * Locale::
 * Reentrancy::
 
 * Misc::
-@ifset POSIX
 * Posix::
-@end ifset
 * Syscalls::
 * Arglists::
-@ifset ICONV
 * Iconv::
-@end ifset
 * Overflow Protection::
 
 * Document Index::
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 3/5] newlib: libc: move manual into top-level build
  2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
  2022-01-22  4:32 ` [PATCH 1/5] newlib: libm: move manual into top-level build Mike Frysinger
  2022-01-22  4:32 ` [PATCH 2/5] newlib: libc: include all chapters all the time in the manual Mike Frysinger
@ 2022-01-22  4:32 ` Mike Frysinger
  2022-01-24 14:30   ` Corinna Vinschen
  2022-01-22  4:32 ` [PATCH 4/5] newlib: move man page generation " Mike Frysinger
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 25+ messages in thread
From: Mike Frysinger @ 2022-01-22  4:32 UTC (permalink / raw)
  To: newlib

This doesn't migrate all the docs, just the libc's manual (pdf/info).
This is to show the basic form of migrating the chew files.

For subdirs that didn't have any docs, I've stripped their settings
for clarity.  If someone wanted to suddenly add docs, they can add
the corresponding local.mk files easily.
---
 newlib/Makefile.am                |   1 +
 newlib/Makefile.in                | 235 ++++++++++++++-
 newlib/libc/argz/Makefile.am      |   4 -
 newlib/libc/argz/Makefile.in      |   3 -
 newlib/libc/ctype/Makefile.am     |  41 +--
 newlib/libc/ctype/Makefile.in     |  51 +---
 newlib/libc/ctype/local.mk        |  36 +++
 newlib/libc/errno/Makefile.am     |   4 -
 newlib/libc/errno/Makefile.in     |   3 -
 newlib/libc/iconv/Makefile.am     |  28 +-
 newlib/libc/iconv/Makefile.in     |  30 +-
 newlib/libc/iconv/ccs/Makefile.am |   3 -
 newlib/libc/iconv/ccs/Makefile.in |   2 -
 newlib/libc/iconv/ces/Makefile.am |   3 -
 newlib/libc/iconv/ces/Makefile.in |   2 -
 newlib/libc/iconv/iconv.tex       |   2 +-
 newlib/libc/iconv/lib/Makefile.am |   3 -
 newlib/libc/iconv/lib/Makefile.in |   2 -
 newlib/libc/iconv/lib/local.mk    |   1 +
 newlib/libc/iconv/local.mk        |   3 +
 newlib/libc/local.mk              |  32 ++
 newlib/libc/locale/Makefile.am    |  13 +-
 newlib/libc/locale/Makefile.in    |  17 +-
 newlib/libc/locale/local.mk       |   8 +
 newlib/libc/machine/Makefile.am   |   4 -
 newlib/libc/misc/Makefile.am      |   7 +-
 newlib/libc/misc/Makefile.in      |  10 +-
 newlib/libc/misc/local.mk         |   6 +
 newlib/libc/posix/Makefile.am     |  10 +-
 newlib/libc/posix/Makefile.in     |  13 +-
 newlib/libc/posix/local.mk        |   5 +
 newlib/libc/reent/Makefile.am     |  30 +-
 newlib/libc/reent/Makefile.in     |  37 +--
 newlib/libc/reent/local.mk        |  25 ++
 newlib/libc/search/Makefile.am    |  13 +-
 newlib/libc/search/Makefile.in    |  14 +-
 newlib/libc/search/local.mk       |   4 +
 newlib/libc/signal/Makefile.am    |   8 +-
 newlib/libc/signal/Makefile.in    |  10 +-
 newlib/libc/signal/local.mk       |   7 +
 newlib/libc/ssp/Makefile.am       |   9 +-
 newlib/libc/ssp/Makefile.in       |  10 +-
 newlib/libc/ssp/local.mk          |   3 +
 newlib/libc/stdio/Makefile.am     | 468 +++++++++++++-----------------
 newlib/libc/stdio/Makefile.in     | 104 ++-----
 newlib/libc/stdio/local.mk        |  80 +++++
 newlib/libc/stdio64/Makefile.am   |  18 +-
 newlib/libc/stdio64/Makefile.in   |  21 +-
 newlib/libc/stdio64/local.mk      |  11 +
 newlib/libc/stdlib/Makefile.am    |  58 +---
 newlib/libc/stdlib/Makefile.in    |  68 +----
 newlib/libc/stdlib/local.mk       |  51 ++++
 newlib/libc/string/Makefile.am    |  27 +-
 newlib/libc/string/Makefile.in    |  48 +--
 newlib/libc/string/local.mk       |  22 ++
 newlib/libc/sys/Makefile.am       |   4 -
 newlib/libc/syscalls/Makefile.am  |   4 -
 newlib/libc/syscalls/Makefile.in  |   3 -
 newlib/libc/time/Makefile.am      |  22 +-
 newlib/libc/time/Makefile.in      |  29 +-
 newlib/libc/time/local.mk         |  15 +
 newlib/libc/unix/Makefile.am      |   4 -
 newlib/libc/unix/Makefile.in      |   3 -
 newlib/libc/xdr/Makefile.am       |   4 -
 newlib/libc/xdr/Makefile.in       |   3 -
 65 files changed, 943 insertions(+), 876 deletions(-)
 create mode 100644 newlib/libc/ctype/local.mk
 create mode 100644 newlib/libc/iconv/lib/local.mk
 create mode 100644 newlib/libc/iconv/local.mk
 create mode 100644 newlib/libc/local.mk
 create mode 100644 newlib/libc/locale/local.mk
 create mode 100644 newlib/libc/misc/local.mk
 create mode 100644 newlib/libc/posix/local.mk
 create mode 100644 newlib/libc/reent/local.mk
 create mode 100644 newlib/libc/search/local.mk
 create mode 100644 newlib/libc/signal/local.mk
 create mode 100644 newlib/libc/ssp/local.mk
 create mode 100644 newlib/libc/stdio/local.mk
 create mode 100644 newlib/libc/stdio64/local.mk
 create mode 100644 newlib/libc/stdlib/local.mk
 create mode 100644 newlib/libc/string/local.mk
 create mode 100644 newlib/libc/time/local.mk

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 8ad74cfd54fe..21945fd71c0f 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -547,6 +547,7 @@ TEXINFO_TEX = ../texinfo/texinfo.tex
 if HAVE_DOC
 include doc/local.mk
 endif
+include libc/local.mk
 include libm/local.mk
 
 .PHONY: $(PHONY)
diff --git a/newlib/libc/argz/Makefile.am b/newlib/libc/argz/Makefile.am
index 0f73cd2b8cfb..a8351b8e20e4 100644
--- a/newlib/libc/argz/Makefile.am
+++ b/newlib/libc/argz/Makefile.am
@@ -41,8 +41,4 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for argz.
-
 include $(srcdir)/../../Makefile.shared
diff --git a/newlib/libc/ctype/Makefile.am b/newlib/libc/ctype/Makefile.am
index 447b7afde2e0..6d68622b5175 100644
--- a/newlib/libc/ctype/Makefile.am
+++ b/newlib/libc/ctype/Makefile.am
@@ -95,41 +95,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES= \
-	isalnum.def	\
-	isalpha.def	\
-	isascii.def	\
-	isblank.def	\
-	iscntrl.def	\
-	isdigit.def	\
-	islower.def	\
-	isprint.def	\
-	ispunct.def	\
-	isspace.def	\
-	isupper.def	\
-	iswalnum.def	\
-	iswalpha.def	\
-	iswblank.def 	\
-	iswcntrl.def 	\
-	iswctype.def 	\
-	iswdigit.def 	\
-	iswgraph.def 	\
-	iswlower.def 	\
-	iswprint.def 	\
-	iswpunct.def 	\
-	iswspace.def 	\
-	iswupper.def 	\
-	iswxdigit.def 	\
-	isxdigit.def	\
-	toascii.def	\
-	tolower.def	\
-	toupper.def	\
-	towctrans.def	\
-	towlower.def	\
-	towupper.def	\
-	wctrans.def	\
-	wctype.def
-
-CHAPTERS = ctype.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
 $(lpfx)ctype_.$(oext): ctype_.c ctype_iso.h ctype_cp.h
diff --git a/newlib/libc/ctype/local.mk b/newlib/libc/ctype/local.mk
new file mode 100644
index 000000000000..8cef16630ac1
--- /dev/null
+++ b/newlib/libc/ctype/local.mk
@@ -0,0 +1,36 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/isalnum.def \
+	%D%/isalpha.def \
+	%D%/isascii.def \
+	%D%/isblank.def \
+	%D%/iscntrl.def \
+	%D%/isdigit.def \
+	%D%/islower.def \
+	%D%/isprint.def \
+	%D%/ispunct.def \
+	%D%/isspace.def \
+	%D%/isupper.def \
+	%D%/iswalnum.def \
+	%D%/iswalpha.def \
+	%D%/iswblank.def \
+	%D%/iswcntrl.def \
+	%D%/iswctype.def \
+	%D%/iswdigit.def \
+	%D%/iswgraph.def \
+	%D%/iswlower.def \
+	%D%/iswprint.def \
+	%D%/iswpunct.def \
+	%D%/iswspace.def \
+	%D%/iswupper.def \
+	%D%/iswxdigit.def \
+	%D%/isxdigit.def \
+	%D%/toascii.def \
+	%D%/tolower.def \
+	%D%/toupper.def \
+	%D%/towctrans.def \
+	%D%/towlower.def \
+	%D%/towupper.def \
+	%D%/wctrans.def \
+	%D%/wctype.def
+
+LIBC_CHAPTERS += %D%/ctype.tex
diff --git a/newlib/libc/errno/Makefile.am b/newlib/libc/errno/Makefile.am
index 77a0b8b83ad8..3470abd0bc1c 100644
--- a/newlib/libc/errno/Makefile.am
+++ b/newlib/libc/errno/Makefile.am
@@ -18,7 +18,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for errno.
diff --git a/newlib/libc/iconv/Makefile.am b/newlib/libc/iconv/Makefile.am
index 4123c7acbcca..0b861d3b8c68 100644
--- a/newlib/libc/iconv/Makefile.am
+++ b/newlib/libc/iconv/Makefile.am
@@ -6,28 +6,10 @@ cct_DATA=encoding.aliases
 
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
 
-SUBDEFS = lib/stmp-def
-
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = iconv.def
-CHAPTERS = iconv.tex
-
-iconv.def: lib/iconv.def
-	cp lib/iconv.def iconv.def
-
-iconv.xml: lib/iconv.xml
-	cp lib/iconv.xml iconv.xml
-
-stmp-def: force
-	(cd lib && $(MAKE) doc)
-	touch $@
-
-.PHONY: force
-force:
-
-$(SUBDEFS): stmp-def
-
-lib/iconv.def: $(SUBDEFS); @true
-
-lib/stmp-def: ; @true
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/iconv/ccs/Makefile.am b/newlib/libc/iconv/ccs/Makefile.am
index f87d072b8e70..071b75b8ef4f 100644
--- a/newlib/libc/iconv/ccs/Makefile.am
+++ b/newlib/libc/iconv/ccs/Makefile.am
@@ -45,7 +45,4 @@ noinst_DATA =
 
 SUBDIRS=binary
 
-CHEWOUT_FILES =
-CHAPTERS =
-
 include $(srcdir)/../../../Makefile.shared
diff --git a/newlib/libc/iconv/ces/Makefile.am b/newlib/libc/iconv/ces/Makefile.am
index 21a37b7b8000..9f129c9978b8 100644
--- a/newlib/libc/iconv/ces/Makefile.am
+++ b/newlib/libc/iconv/ces/Makefile.am
@@ -39,6 +39,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
diff --git a/newlib/libc/iconv/iconv.tex b/newlib/libc/iconv/iconv.tex
index 46ced296b907..42d04c0b616f 100644
--- a/newlib/libc/iconv/iconv.tex
+++ b/newlib/libc/iconv/iconv.tex
@@ -21,7 +21,7 @@ The iconv functions declarations are in
 @end menu
 
 @page
-@include iconv/iconv.def
+@include iconv/lib/iconv.def
 
 @page
 @node Introduction to iconv
diff --git a/newlib/libc/iconv/lib/Makefile.am b/newlib/libc/iconv/lib/Makefile.am
index 4e495573a287..0114b2aa3e96 100644
--- a/newlib/libc/iconv/lib/Makefile.am
+++ b/newlib/libc/iconv/lib/Makefile.am
@@ -30,6 +30,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-CHEWOUT_FILES = iconv.def
-CHAPTER =
diff --git a/newlib/libc/iconv/lib/local.mk b/newlib/libc/iconv/lib/local.mk
new file mode 100644
index 000000000000..62a2be87ba5e
--- /dev/null
+++ b/newlib/libc/iconv/lib/local.mk
@@ -0,0 +1 @@
+LIBC_CHEWOUT_FILES += %D%/iconv.def
diff --git a/newlib/libc/iconv/local.mk b/newlib/libc/iconv/local.mk
new file mode 100644
index 000000000000..ea8e78783d04
--- /dev/null
+++ b/newlib/libc/iconv/local.mk
@@ -0,0 +1,3 @@
+LIBC_CHAPTERS += %D%/iconv.tex
+
+include %D%/lib/local.mk
diff --git a/newlib/libc/local.mk b/newlib/libc/local.mk
new file mode 100644
index 000000000000..f6b797f612c2
--- /dev/null
+++ b/newlib/libc/local.mk
@@ -0,0 +1,32 @@
+info_TEXINFOS += %D%/libc.texi
+%C%_libc_TEXINFOS = %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
+
+LIBC_CHEWOUT_FILES =
+
+LIBC_CHAPTERS = %D%/sys.tex
+
+%D%/libc.dvi: %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
+
+%D%/targetdep.tex: $(LIBC_CHAPTERS)
+	$(AM_V_GEN)cat $^ > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(AM_V_at)touch $@
+
+include %D%/ctype/local.mk
+include %D%/iconv/local.mk
+include %D%/locale/local.mk
+include %D%/misc/local.mk
+include %D%/posix/local.mk
+include %D%/reent/local.mk
+include %D%/search/local.mk
+include %D%/signal/local.mk
+include %D%/ssp/local.mk
+include %D%/stdio64/local.mk
+include %D%/stdio/local.mk
+include %D%/stdlib/local.mk
+include %D%/string/local.mk
+include %D%/time/local.mk
+
+CLEANFILES += \
+	%D%/targetdep.tex \
+	$(LIBC_CHEWOUT_FILES)
diff --git a/newlib/libc/locale/Makefile.am b/newlib/libc/locale/Makefile.am
index 1fd2530f7c43..0fc51ffd4d74 100644
--- a/newlib/libc/locale/Makefile.am
+++ b/newlib/libc/locale/Makefile.am
@@ -36,11 +36,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	duplocale.def \
-	freelocale.def \
-	locale.def \
-	newlocale.def \
-	uselocale.def
-
-CHAPTERS = locale.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/locale/local.mk b/newlib/libc/locale/local.mk
new file mode 100644
index 000000000000..7af1534c8f96
--- /dev/null
+++ b/newlib/libc/locale/local.mk
@@ -0,0 +1,8 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/duplocale.def \
+	%D%/freelocale.def \
+	%D%/locale.def \
+	%D%/newlocale.def \
+	%D%/uselocale.def
+
+LIBC_CHAPTERS += %D%/locale.tex
diff --git a/newlib/libc/machine/Makefile.am b/newlib/libc/machine/Makefile.am
index 49c85fb2087d..1b941d0e06e1 100644
--- a/newlib/libc/machine/Makefile.am
+++ b/newlib/libc/machine/Makefile.am
@@ -18,9 +18,5 @@ endif
 
 $(machine_dir)/lib.a:
 
-doc:
-
-docbook:
-
 ACLOCAL_AMFLAGS = -I ../.. -I ../../.. -I ../../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libc/misc/Makefile.am b/newlib/libc/misc/Makefile.am
index da4f90f46815..c9fb96c68696 100644
--- a/newlib/libc/misc/Makefile.am
+++ b/newlib/libc/misc/Makefile.am
@@ -24,5 +24,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = unctrl.def lock.def ffs.def
-CHAPTERS = misc.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/misc/local.mk b/newlib/libc/misc/local.mk
new file mode 100644
index 000000000000..54a53efff220
--- /dev/null
+++ b/newlib/libc/misc/local.mk
@@ -0,0 +1,6 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/ffs.def \
+	%D%/lock.def \
+	%D%/unctrl.def
+
+LIBC_CHAPTERS += %D%/misc.tex
diff --git a/newlib/libc/posix/Makefile.am b/newlib/libc/posix/Makefile.am
index 5fb1fa2afa1c..88976a14d4a9 100644
--- a/newlib/libc/posix/Makefile.am
+++ b/newlib/libc/posix/Makefile.am
@@ -49,10 +49,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	popen.def \
-	posix_spawn.def
-
-CHAPTERS = posix.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
 AM_CFLAGS = -D_GNU_SOURCE
diff --git a/newlib/libc/posix/local.mk b/newlib/libc/posix/local.mk
new file mode 100644
index 000000000000..74539dddbe72
--- /dev/null
+++ b/newlib/libc/posix/local.mk
@@ -0,0 +1,5 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/popen.def \
+	%D%/posix_spawn.def
+
+LIBC_CHAPTERS += %D%/posix.tex
diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am
index 622a74c82cea..c5396890d067 100644
--- a/newlib/libc/reent/Makefile.am
+++ b/newlib/libc/reent/Makefile.am
@@ -61,30 +61,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	closer.def \
-	reent.def \
-	execr.def \
-	fcntlr.def \
-	fstat64r.def \
-	fstatr.def \
-	gettimeofdayr.def \
-	linkr.def \
-	lseek64r.def \
-	lseekr.def \
-	mkdirr.def \
-	open64r.def \
-	openr.def \
-	readr.def \
-	renamer.def \
-	signalr.def \
-	sbrkr.def \
-	stat64r.def \
-	statr.def \
-	timesr.def \
-	unlinkr.def \
-	writer.def
-
-CHAPTERS = reent.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
 $(lpfx)impure.$(oext): $(srcdir)/impure.c $(srcdir)/../include/sys/reent.h
diff --git a/newlib/libc/reent/local.mk b/newlib/libc/reent/local.mk
new file mode 100644
index 000000000000..975a8d82a83a
--- /dev/null
+++ b/newlib/libc/reent/local.mk
@@ -0,0 +1,25 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/closer.def \
+	%D%/reent.def \
+	%D%/execr.def \
+	%D%/fcntlr.def \
+	%D%/fstatr.def \
+	%D%/gettimeofdayr.def \
+	%D%/linkr.def \
+	%D%/lseekr.def \
+	%D%/mkdirr.def \
+	%D%/openr.def \
+	%D%/readr.def \
+	%D%/renamer.def \
+	%D%/signalr.def \
+	%D%/sbrkr.def \
+	%D%/statr.def \
+	%D%/timesr.def \
+	%D%/unlinkr.def \
+	%D%/fstat64r.def \
+	%D%/lseek64r.def \
+	%D%/stat64r.def \
+	%D%/open64r.def \
+	%D%/writer.def
+
+LIBC_CHAPTERS += %D%/reent.tex
diff --git a/newlib/libc/search/Makefile.am b/newlib/libc/search/Makefile.am
index 5c5e0dcf6264..ef1c1e223376 100644
--- a/newlib/libc/search/Makefile.am
+++ b/newlib/libc/search/Makefile.am
@@ -61,11 +61,10 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES = \
-	bsearch.def \
-	qsort.def \
-	qsort_r.def
-
-CHAPTERS =
-
 include $(srcdir)/../../Makefile.shared
+
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/search/local.mk b/newlib/libc/search/local.mk
new file mode 100644
index 000000000000..a1704539b04c
--- /dev/null
+++ b/newlib/libc/search/local.mk
@@ -0,0 +1,4 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/bsearch.def \
+	%D%/qsort.def \
+	%D%/qsort_r.def
diff --git a/newlib/libc/signal/Makefile.am b/newlib/libc/signal/Makefile.am
index 4b5bc209ca26..1f644b9c9ef3 100644
--- a/newlib/libc/signal/Makefile.am
+++ b/newlib/libc/signal/Makefile.am
@@ -19,6 +19,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = psignal.def raise.def signal.def sig2str.def
-
-CHAPTERS = signal.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/signal/local.mk b/newlib/libc/signal/local.mk
new file mode 100644
index 000000000000..e0da75349a18
--- /dev/null
+++ b/newlib/libc/signal/local.mk
@@ -0,0 +1,7 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/psignal.def \
+	%D%/raise.def \
+	%D%/signal.def \
+	%D%/sig2str.def
+
+LIBC_CHAPTERS += %D%/signal.tex
diff --git a/newlib/libc/ssp/Makefile.am b/newlib/libc/ssp/Makefile.am
index 937741cd62d2..2d0a25d0c63f 100644
--- a/newlib/libc/ssp/Makefile.am
+++ b/newlib/libc/ssp/Makefile.am
@@ -61,7 +61,10 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS = ssp.tex
-
 include $(srcdir)/../../Makefile.shared
+
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/ssp/local.mk b/newlib/libc/ssp/local.mk
new file mode 100644
index 000000000000..e87115b50025
--- /dev/null
+++ b/newlib/libc/ssp/local.mk
@@ -0,0 +1,3 @@
+LIBC_CHEWOUT_FILES +=
+
+LIBC_CHAPTERS += %D%/ssp.tex
diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am
index 30339033c8f6..25207cea26bb 100644
--- a/newlib/libc/stdio/Makefile.am
+++ b/newlib/libc/stdio/Makefile.am
@@ -6,91 +6,91 @@ if NEWLIB_NANO_FORMATTED_IO
 GENERAL_INT_FORMATTED_IO_SOURCES =
 else
 GENERAL_INT_FORMATTED_IO_SOURCES = \
-	fiprintf.c			\
-	fiscanf.c			\
-	iprintf.c			\
-	iscanf.c			\
-	siprintf.c			\
-	siscanf.c			\
-	sniprintf.c			\
-	vdiprintf.c			\
-	vfprintf.c			\
-	vfwprintf.c			\
-	viprintf.c			\
-	viscanf.c			\
-	vsiprintf.c			\
-	vsiscanf.c			\
-	vsniprintf.c
+	%D%/fiprintf.c			\
+	%D%/fiscanf.c			\
+	%D%/iprintf.c			\
+	%D%/iscanf.c			\
+	%D%/siprintf.c			\
+	%D%/siscanf.c			\
+	%D%/sniprintf.c			\
+	%D%/vdiprintf.c			\
+	%D%/vfprintf.c			\
+	%D%/vfwprintf.c			\
+	%D%/viprintf.c			\
+	%D%/viscanf.c			\
+	%D%/vsiprintf.c			\
+	%D%/vsiscanf.c			\
+	%D%/vsniprintf.c
 endif
 
 GENERAL_SOURCES = \
-	$(GENERAL_INT_FORMATTED_IO_SOURCES) \
-	clearerr.c			\
-	fclose.c			\
-	fdopen.c			\
-	feof.c				\
-	ferror.c			\
-	fflush.c			\
-	fgetc.c			\
-	fgetpos.c			\
-	fgets.c			\
-	fileno.c			\
-	findfp.c			\
-	flags.c			\
-	fopen.c			\
-	fprintf.c			\
-	fputc.c			\
-	fputs.c			\
-	fread.c			\
-	freopen.c			\
-	fscanf.c			\
-	fseek.c			\
-	fsetpos.c			\
-	ftell.c			\
-	fvwrite.c			\
-	fwalk.c			\
-	fwrite.c			\
-	getc.c				\
-	getchar.c			\
-	getc_u.c			\
-	getchar_u.c			\
-	getdelim.c			\
-	getline.c			\
-	gets.c				\
-	makebuf.c			\
-	perror.c			\
-	printf.c			\
-	putc.c				\
-	putchar.c			\
-	putc_u.c			\
-	putchar_u.c			\
-	puts.c				\
-	refill.c			\
-	remove.c			\
-	rename.c			\
-	rewind.c			\
-	rget.c				\
-	scanf.c			\
-	sccl.c				\
-	setbuf.c			\
-	setbuffer.c			\
-	setlinebuf.c			\
-	setvbuf.c			\
-	snprintf.c			\
-	sprintf.c			\
-	sscanf.c			\
-	stdio.c			\
-	tmpfile.c			\
-	tmpnam.c			\
-	ungetc.c			\
-	vdprintf.c			\
-	vprintf.c			\
-	vscanf.c			\
-	vsnprintf.c			\
-	vsprintf.c			\
-	vsscanf.c			\
-	wbuf.c				\
-	wsetup.c
+	%D%/$(GENERAL_INT_FORMATTED_IO_SOURCES) \
+	%D%/clearerr.c			\
+	%D%/fclose.c			\
+	%D%/fdopen.c			\
+	%D%/feof.c				\
+	%D%/ferror.c			\
+	%D%/fflush.c			\
+	%D%/fgetc.c			\
+	%D%/fgetpos.c			\
+	%D%/fgets.c			\
+	%D%/fileno.c			\
+	%D%/findfp.c			\
+	%D%/flags.c			\
+	%D%/fopen.c			\
+	%D%/fprintf.c			\
+	%D%/fputc.c			\
+	%D%/fputs.c			\
+	%D%/fread.c			\
+	%D%/freopen.c			\
+	%D%/fscanf.c			\
+	%D%/fseek.c			\
+	%D%/fsetpos.c			\
+	%D%/ftell.c			\
+	%D%/fvwrite.c			\
+	%D%/fwalk.c			\
+	%D%/fwrite.c			\
+	%D%/getc.c				\
+	%D%/getchar.c			\
+	%D%/getc_u.c			\
+	%D%/getchar_u.c			\
+	%D%/getdelim.c			\
+	%D%/getline.c			\
+	%D%/gets.c				\
+	%D%/makebuf.c			\
+	%D%/perror.c			\
+	%D%/printf.c			\
+	%D%/putc.c				\
+	%D%/putchar.c			\
+	%D%/putc_u.c			\
+	%D%/putchar_u.c			\
+	%D%/puts.c				\
+	%D%/refill.c			\
+	%D%/remove.c			\
+	%D%/rename.c			\
+	%D%/rewind.c			\
+	%D%/rget.c				\
+	%D%/scanf.c			\
+	%D%/sccl.c				\
+	%D%/setbuf.c			\
+	%D%/setbuffer.c			\
+	%D%/setlinebuf.c			\
+	%D%/setvbuf.c			\
+	%D%/snprintf.c			\
+	%D%/sprintf.c			\
+	%D%/sscanf.c			\
+	%D%/stdio.c			\
+	%D%/tmpfile.c			\
+	%D%/tmpnam.c			\
+	%D%/ungetc.c			\
+	%D%/vdprintf.c			\
+	%D%/vprintf.c			\
+	%D%/vscanf.c			\
+	%D%/vsnprintf.c			\
+	%D%/vsprintf.c			\
+	%D%/vsscanf.c			\
+	%D%/wbuf.c				\
+	%D%/wsetup.c
 
 ## The following are EL/IX level 2 interfaces
 if ELIX_LEVEL_1
@@ -100,20 +100,20 @@ if NEWLIB_NANO_FORMATTED_IO
 ELIX_2_INT_FORMATTED_IO_SOURCES =
 else
 ELIX_2_INT_FORMATTED_IO_SOURCES = \
-	asiprintf.c		\
-	vasiprintf.c
+	%D%/asiprintf.c		\
+	%D%/vasiprintf.c
 
 endif !NEWLIB_NANO_FORMATTED_IO
 ELIX_2_SOURCES = \
-	$(ELIX_2_INT_FORMATTED_IO_SOURCES) \
-	asprintf.c		\
-	fcloseall.c		\
-	fseeko.c		\
-	ftello.c		\
-	getw.c			\
-	mktemp.c		\
-	putw.c			\
-	vasprintf.c
+	%D%/$(ELIX_2_INT_FORMATTED_IO_SOURCES) \
+	%D%/asprintf.c		\
+	%D%/fcloseall.c		\
+	%D%/fseeko.c		\
+	%D%/ftello.c		\
+	%D%/getw.c			\
+	%D%/mktemp.c		\
+	%D%/putw.c			\
+	%D%/vasprintf.c
 endif !ELIX_LEVEL_1
 
 ## The following are EL/IX level 2 interfaces
@@ -130,62 +130,62 @@ if NEWLIB_NANO_FORMATTED_IO
 ELIX_4_INT_FORMATTED_IO_SOURCES =
 else
 ELIX_4_INT_FORMATTED_IO_SOURCES = \
-	asniprintf.c		\
-	diprintf.c		\
-	vasniprintf.c
+	%D%/asniprintf.c		\
+	%D%/diprintf.c		\
+	%D%/vasniprintf.c
 
 endif !NEWLIB_NANO_FORMATTED_IO
 ELIX_4_SOURCES = \
-	$(ELIX_4_INT_FORMATTED_IO_SOURCES) \
-	asnprintf.c		\
-	clearerr_u.c		\
-	dprintf.c		\
-	feof_u.c		\
-	ferror_u.c		\
-	fflush_u.c		\
-	fgetc_u.c		\
-	fgets_u.c		\
-	fgetwc.c		\
-	fgetwc_u.c		\
-	fgetws.c		\
-	fgetws_u.c		\
-	fileno_u.c		\
-	fmemopen.c		\
-	fopencookie.c		\
-	fpurge.c		\
-	fputc_u.c		\
-	fputs_u.c		\
-	fputwc.c		\
-	fputwc_u.c		\
-	fputws.c		\
-	fputws_u.c		\
-	fread_u.c		\
-	fsetlocking.c		\
-	funopen.c		\
-	fwide.c			\
-	fwprintf.c		\
-	fwrite_u.c		\
-	fwscanf.c		\
-	getwc.c			\
-	getwc_u.c		\
-	getwchar.c		\
-	getwchar_u.c		\
-	open_memstream.c	\
-	putwc.c			\
-	putwc_u.c		\
-	putwchar.c		\
-	putwchar_u.c		\
-	stdio_ext.c		\
-	swprintf.c		\
-	swscanf.c		\
-	ungetwc.c		\
-	vasnprintf.c		\
-	vswprintf.c		\
-	vswscanf.c		\
-	vwprintf.c		\
-	vwscanf.c		\
-	wprintf.c		\
-	wscanf.c
+	%D%/$(ELIX_4_INT_FORMATTED_IO_SOURCES) \
+	%D%/asnprintf.c		\
+	%D%/clearerr_u.c		\
+	%D%/dprintf.c		\
+	%D%/feof_u.c		\
+	%D%/ferror_u.c		\
+	%D%/fflush_u.c		\
+	%D%/fgetc_u.c		\
+	%D%/fgets_u.c		\
+	%D%/fgetwc.c		\
+	%D%/fgetwc_u.c		\
+	%D%/fgetws.c		\
+	%D%/fgetws_u.c		\
+	%D%/fileno_u.c		\
+	%D%/fmemopen.c		\
+	%D%/fopencookie.c		\
+	%D%/fpurge.c		\
+	%D%/fputc_u.c		\
+	%D%/fputs_u.c		\
+	%D%/fputwc.c		\
+	%D%/fputwc_u.c		\
+	%D%/fputws.c		\
+	%D%/fputws_u.c		\
+	%D%/fread_u.c		\
+	%D%/fsetlocking.c		\
+	%D%/funopen.c		\
+	%D%/fwide.c			\
+	%D%/fwprintf.c		\
+	%D%/fwrite_u.c		\
+	%D%/fwscanf.c		\
+	%D%/getwc.c			\
+	%D%/getwc_u.c		\
+	%D%/getwchar.c		\
+	%D%/getwchar_u.c		\
+	%D%/open_memstream.c	\
+	%D%/putwc.c			\
+	%D%/putwc_u.c		\
+	%D%/putwchar.c		\
+	%D%/putwchar_u.c		\
+	%D%/stdio_ext.c		\
+	%D%/swprintf.c		\
+	%D%/swscanf.c		\
+	%D%/ungetwc.c		\
+	%D%/vasnprintf.c		\
+	%D%/vswprintf.c		\
+	%D%/vswscanf.c		\
+	%D%/vwprintf.c		\
+	%D%/vwscanf.c		\
+	%D%/wprintf.c		\
+	%D%/wscanf.c
 
 endif !ELIX_LEVEL_3
 endif !ELIX_LEVEL_2
@@ -193,31 +193,31 @@ endif !ELIX_LEVEL_1
 
 if NEWLIB_NANO_FORMATTED_IO
 LIBADD_OBJS = \
-	$(lpfx)nano-vfprintf_float.$(oext)	\
-	$(lpfx)nano-svfprintf.$(oext)		\
-	$(lpfx)nano-svfscanf.$(oext)		\
-	$(lpfx)nano-vfprintf.$(oext)		\
-	$(lpfx)nano-vfprintf_i.$(oext)		\
-	$(lpfx)nano-vfscanf.$(oext)		\
-	$(lpfx)nano-vfscanf_i.$(oext)		\
-	$(lpfx)nano-vfscanf_float.$(oext)	\
-	$(lpfx)svfiwprintf.$(oext)		\
-	$(lpfx)svfwprintf.$(oext)		\
-	$(lpfx)vfiwprintf.$(oext)		\
-	$(lpfx)svfiwscanf.$(oext)		\
-	$(lpfx)svfwscanf.$(oext)		\
-	$(lpfx)vfiwscanf.$(oext)		\
-	$(lpfx)vfwscanf.$(oext)
+	%D%/$(lpfx)nano-vfprintf_float.$(oext)	\
+	%D%/$(lpfx)nano-svfprintf.$(oext)		\
+	%D%/$(lpfx)nano-svfscanf.$(oext)		\
+	%D%/$(lpfx)nano-vfprintf.$(oext)		\
+	%D%/$(lpfx)nano-vfprintf_i.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf_i.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf_float.$(oext)	\
+	%D%/$(lpfx)svfiwprintf.$(oext)		\
+	%D%/$(lpfx)svfwprintf.$(oext)		\
+	%D%/$(lpfx)vfiwprintf.$(oext)		\
+	%D%/$(lpfx)svfiwscanf.$(oext)		\
+	%D%/$(lpfx)svfwscanf.$(oext)		\
+	%D%/$(lpfx)vfiwscanf.$(oext)		\
+	%D%/$(lpfx)vfwscanf.$(oext)
 else
 LIBADD_OBJS = \
-	$(lpfx)svfiprintf.$(oext) $(lpfx)svfprintf.$(oext) \
-	$(lpfx)svfiscanf.$(oext) $(lpfx)svfscanf.$(oext) \
-	$(lpfx)vfiprintf.$(oext) \
-	$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext) \
-	$(lpfx)svfiwprintf.$(oext) $(lpfx)svfwprintf.$(oext) \
-	$(lpfx)vfiwprintf.$(oext) \
-	$(lpfx)svfiwscanf.$(oext) $(lpfx)svfwscanf.$(oext) \
-	$(lpfx)vfiwscanf.$(oext) $(lpfx)vfwscanf.$(oext)
+	%D%/$(lpfx)svfiprintf.$(oext) $(lpfx)svfprintf.$(oext) \
+	%D%/$(lpfx)svfiscanf.$(oext) $(lpfx)svfscanf.$(oext) \
+	%D%/$(lpfx)vfiprintf.$(oext) \
+	%D%/$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext) \
+	%D%/$(lpfx)svfiwprintf.$(oext) $(lpfx)svfwprintf.$(oext) \
+	%D%/$(lpfx)vfiwprintf.$(oext) \
+	%D%/$(lpfx)svfiwscanf.$(oext) $(lpfx)svfwscanf.$(oext) \
+	%D%/$(lpfx)vfiwscanf.$(oext) $(lpfx)vfwscanf.$(oext)
 endif
 
 libstdio_la_LDFLAGS = -Xcompiler -nostdlib
@@ -241,6 +241,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+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
@@ -252,158 +257,77 @@ include $(srcdir)/../../Makefile.shared
 if NEWLIB_NANO_FORMATTED_IO
 # Rules compiling small-footprint nano-formatted-io implementation.
 $(lpfx)nano-vfprintf.$(oext): nano-vfprintf.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf.c -o $@
 
 $(lpfx)nano-vfprintf_i.$(oext): nano-vfprintf_i.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_i.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_i.c -o $@
 
 $(lpfx)nano-vfprintf_float.$(oext): nano-vfprintf_float.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_float.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_float.c -o $@
 
 $(lpfx)nano-svfprintf.$(oext): nano-vfprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfprintf.c -o $@
 endif
 
 # This rule is needed so that libtool compiles vfiprintf before vfprintf.
 # Otherwise libtool moves vfprintf.o and subsequently can't find it.
 
 $(lpfx)vfiprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)svfprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)svfiprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)vfiwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 $(lpfx)svfwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 $(lpfx)svfiwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 if NEWLIB_NANO_FORMATTED_IO
 # Rules compiling small-footprint nano-formatted-io implementation.
 $(lpfx)nano-vfscanf.$(oext): nano-vfscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf.c -o $@
 
 $(lpfx)nano-vfscanf_i.$(oext): nano-vfscanf_i.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_i.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_i.c -o $@
 
 $(lpfx)nano-vfscanf_float.$(oext): nano-vfscanf_float.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_float.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_float.c -o $@
 
 $(lpfx)nano-svfscanf.$(oext): nano-vfscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfscanf.c -o $@
 endif
 
 $(lpfx)vfscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)vfiscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)svfscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)svfiscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)vfwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)vfiwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)svfwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)svfiwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
-
-CHEWOUT_FILES = \
-	clearerr.def		\
-	diprintf.def		\
-	dprintf.def		\
-	fclose.def		\
-	fcloseall.def		\
-	fdopen.def		\
-	feof.def		\
-	ferror.def		\
-	fflush.def		\
-	fgetc.def		\
-	fgetpos.def		\
-	fgets.def		\
-	fgetwc.def		\
-	fgetws.def		\
-	fileno.def		\
-	fmemopen.def		\
-	fopen.def		\
-	fopencookie.def		\
-	fpurge.def		\
-	fputc.def		\
-	fputs.def		\
-	fputwc.def		\
-	fputws.def		\
-	fread.def		\
-	freopen.def		\
-	fseek.def		\
-	fsetlocking.def		\
-	fsetpos.def		\
-	ftell.def		\
-	funopen.def		\
-	fwide.def		\
-	fwrite.def		\
-	getc.def		\
-	getc_u.def		\
-	getchar.def		\
-	getchar_u.def		\
-	getdelim.def		\
-	getline.def		\
-	gets.def		\
-	getw.def		\
-	getwchar.def		\
-	mktemp.def		\
-	nano-vfprintf.def	\
-	nano-vfscanf.def	\
-	open_memstream.def	\
-	perror.def		\
-	putc.def		\
-	putc_u.def		\
-	putchar.def		\
-	putchar_u.def		\
-	puts.def		\
-	putw.def		\
-	putwchar.def		\
-	remove.def		\
-	rename.def		\
-	rewind.def		\
-	setbuf.def		\
-	setbuffer.def		\
-	setlinebuf.def		\
-	setvbuf.def		\
-	siprintf.def		\
-	siscanf.def		\
-	sprintf.def		\
-	sscanf.def		\
-	stdio_ext.def		\
-	swprintf.def		\
-	swscanf.def		\
-	tmpfile.def		\
-	tmpnam.def		\
-	ungetc.def		\
-	ungetwc.def		\
-	vfprintf.def		\
-	vfscanf.def		\
-	vfwprintf.def		\
-	vfwscanf.def		\
-	viprintf.def		\
-	viscanf.def
-
-CHAPTERS = stdio.tex
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)clearerr.$(oext): local.h
 $(lpfx)clearerr_u.$(oext): local.h
diff --git a/newlib/libc/stdio/local.mk b/newlib/libc/stdio/local.mk
new file mode 100644
index 000000000000..2e1b8c416ddf
--- /dev/null
+++ b/newlib/libc/stdio/local.mk
@@ -0,0 +1,80 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/clearerr.def \
+	%D%/diprintf.def \
+	%D%/dprintf.def \
+	%D%/fcloseall.def \
+	%D%/fclose.def \
+	%D%/fdopen.def \
+	%D%/feof.def \
+	%D%/ferror.def \
+	%D%/fflush.def \
+	%D%/fgetc.def \
+	%D%/fgetpos.def \
+	%D%/fgets.def \
+	%D%/fgetwc.def \
+	%D%/fgetws.def \
+	%D%/fileno.def \
+	%D%/fmemopen.def \
+	%D%/fopen.def \
+	%D%/fopencookie.def \
+	%D%/fpurge.def \
+	%D%/fputc.def \
+	%D%/fputs.def \
+	%D%/fputwc.def \
+	%D%/fputws.def \
+	%D%/fread.def \
+	%D%/freopen.def \
+	%D%/fseek.def \
+	%D%/fsetlocking.def \
+	%D%/fsetpos.def \
+	%D%/ftell.def \
+	%D%/funopen.def \
+	%D%/fwide.def \
+	%D%/fwrite.def \
+	%D%/getc.def \
+	%D%/getc_u.def \
+	%D%/getchar.def \
+	%D%/getchar_u.def \
+	%D%/getdelim.def \
+	%D%/getline.def \
+	%D%/gets.def \
+	%D%/getw.def \
+	%D%/getwchar.def \
+	%D%/mktemp.def \
+	%D%/nano-vfprintf.def \
+	%D%/nano-vfscanf.def \
+	%D%/open_memstream.def \
+	%D%/perror.def \
+	%D%/putc.def \
+	%D%/putc_u.def \
+	%D%/putchar.def \
+	%D%/putchar_u.def \
+	%D%/puts.def \
+	%D%/putw.def \
+	%D%/putwchar.def \
+	%D%/remove.def \
+	%D%/rename.def \
+	%D%/rewind.def \
+	%D%/setbuf.def \
+	%D%/setbuffer.def \
+	%D%/setlinebuf.def \
+	%D%/setvbuf.def \
+	%D%/siprintf.def \
+	%D%/siscanf.def \
+	%D%/sprintf.def \
+	%D%/sscanf.def \
+	%D%/stdio_ext.def \
+	%D%/swprintf.def \
+	%D%/swscanf.def \
+	%D%/tmpfile.def \
+	%D%/tmpnam.def \
+	%D%/ungetc.def \
+	%D%/ungetwc.def \
+	%D%/vfprintf.def \
+	%D%/vfscanf.def \
+	%D%/vfwprintf.def \
+	%D%/vfwscanf.def \
+	%D%/viprintf.def \
+	%D%/viscanf.def
+
+LIBC_CHAPTERS += %D%/stdio.tex
diff --git a/newlib/libc/stdio64/Makefile.am b/newlib/libc/stdio64/Makefile.am
index 074107e0c5ae..e93f7056518c 100644
--- a/newlib/libc/stdio64/Makefile.am
+++ b/newlib/libc/stdio64/Makefile.am
@@ -38,16 +38,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-AM_CFLAGS = -I $(srcdir)/../stdio
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
-CHEWOUT_FILES = \
-	fdopen64.def		\
-	fgetpos64.def		\
-	fopen64.def		\
-	freopen64.def		\
-	fseeko64.def		\
-	fsetpos64.def		\
-	ftello64.def		\
-	tmpfile64.def
-
-CHAPTERS = stdio64.tex
+AM_CFLAGS = -I $(srcdir)/../stdio
diff --git a/newlib/libc/stdio64/local.mk b/newlib/libc/stdio64/local.mk
new file mode 100644
index 000000000000..bfe252766f81
--- /dev/null
+++ b/newlib/libc/stdio64/local.mk
@@ -0,0 +1,11 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/fdopen64.def \
+	%D%/fgetpos64.def \
+	%D%/fopen64.def \
+	%D%/freopen64.def \
+	%D%/fseeko64.def \
+	%D%/fsetpos64.def \
+	%D%/ftello64.def \
+	%D%/tmpfile64.def
+
+LIBC_CHAPTERS += %D%/stdio64.tex
diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am
index f0e3b0003915..4cfcab39a9d6 100644
--- a/newlib/libc/stdlib/Makefile.am
+++ b/newlib/libc/stdlib/Makefile.am
@@ -222,6 +222,12 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
+
 MALLOC_COMPILE = $(LIB_COMPILE) -DINTERNAL_NEWLIB
 
 $(lpfx)$(MALLOCR).$(oext): $(MALLOCR).c
@@ -260,58 +266,6 @@ $(lpfx)$(MSIZER).$(oext): $(MALLOCR).c
 $(lpfx)$(MALLOPTR).$(oext): $(MALLOCR).c
 	$(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@
 
-CHEWOUT_FILES= \
-	_Exit.def	\
-	a64l.def	\
-	abort.def	\
-	abs.def		\
-	assert.def	\
-	atexit.def	\
-	atof.def 	\
-	atoi.def 	\
-	atoll.def 	\
-	calloc.def	\
-	div.def		\
-	ecvtbuf.def	\
-	efgcvt.def 	\
-	envlock.def	\
-	exit.def	\
-	getenv.def	\
-	itoa.def	\
-	labs.def	\
-	ldiv.def	\
-	llabs.def	\
-	lldiv.def	\
-	malloc.def	\
-	mblen.def	\
-	mbsnrtowcs.def	\
-	mbstowcs.def	\
-	mbtowc.def	\
-	mlock.def	\
-	mstats.def	\
-	on_exit.def	\
-	rand.def	\
-	rand48.def	\
-	random.def	\
-	rpmatch.def	\
-	strtod.def 	\
-	strtol.def 	\
-	strtoll.def 	\
-	strtoul.def 	\
-	strtoull.def 	\
-	utoa.def	\
-	wcsnrtombs.def	\
-	wcstod.def 	\
-	wcstol.def 	\
-	wcstoll.def 	\
-	wcstoul.def 	\
-	wcstoull.def 	\
-	system.def	\
-	wcstombs.def	\
-	wctomb.def	
-
-CHAPTERS = stdlib.tex
-
 $(lpfx)dtoa.$(oext): dtoa.c mprec.h
 $(lpfx)ldtoa.$(oext): ldtoa.c mprec.h gdtoa.h
 $(lpfx)gdtoa-ldtoa.$(oext): gdtoa-ldtoa.c mprec.h gdtoaimp.h gdtoa.h
diff --git a/newlib/libc/stdlib/local.mk b/newlib/libc/stdlib/local.mk
new file mode 100644
index 000000000000..d2f199d8cab3
--- /dev/null
+++ b/newlib/libc/stdlib/local.mk
@@ -0,0 +1,51 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/_Exit.def \
+	%D%/a64l.def \
+	%D%/abort.def \
+	%D%/abs.def \
+	%D%/assert.def \
+	%D%/atexit.def \
+	%D%/atof.def \
+	%D%/atoi.def \
+	%D%/atoll.def \
+	%D%/calloc.def \
+	%D%/div.def \
+	%D%/ecvtbuf.def \
+	%D%/efgcvt.def \
+	%D%/envlock.def \
+	%D%/exit.def \
+	%D%/getenv.def \
+	%D%/itoa.def \
+	%D%/labs.def \
+	%D%/ldiv.def \
+	%D%/llabs.def \
+	%D%/lldiv.def \
+	%D%/malloc.def \
+	%D%/mblen.def \
+	%D%/mbsnrtowcs.def \
+	%D%/mbstowcs.def \
+	%D%/mbtowc.def \
+	%D%/mlock.def \
+	%D%/mstats.def \
+	%D%/on_exit.def \
+	%D%/rand.def \
+	%D%/rand48.def \
+	%D%/random.def \
+	%D%/rpmatch.def \
+	%D%/strtod.def \
+	%D%/strtol.def \
+	%D%/strtoll.def \
+	%D%/strtoul.def \
+	%D%/strtoull.def \
+	%D%/utoa.def \
+	%D%/wcsnrtombs.def \
+	%D%/wcstod.def \
+	%D%/wcstol.def \
+	%D%/wcstoll.def \
+	%D%/wcstoul.def \
+	%D%/wcstoull.def \
+	%D%/system.def \
+	%D%/wcstombs.def \
+	%D%/wctomb.def
+
+LIBC_CHAPTERS += %D%/stdlib.tex
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
index 7eb9fcdbcf6a..70bf7afdc01f 100644
--- a/newlib/libc/string/Makefile.am
+++ b/newlib/libc/string/Makefile.am
@@ -144,25 +144,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES=\
-bcmp.def	memcpy.def	strcmp.def	strncat.def strstr.def \
-bcopy.def	memmove.def	strcoll.def	strncmp.def strtok.def \
-bzero.def	memset.def	strcpy.def	strncpy.def strxfrm.def \
-index.def	rindex.def	strcspn.def	strpbrk.def swab.def \
-memchr.def	strcat.def	strerror.def	strerror_r.def strrchr.def \
-memcmp.def	strchr.def	strlen.def	strnlen.def strspn.def \
-strcasecmp.def	strncasecmp.def strcasestr.def	strlwr.def  strupr.def \
-memccpy.def 	mempcpy.def	stpcpy.def	stpncpy.def strsignal.def \
-wcscasecmp.def	wcscat.def	wcschr.def	wcscmp.def wcscoll.def \
-wcscpy.def	wcscspn.def	wcpcpy.def	wcpncpy.def wcsdup.def \
-wcslcat.def	wcslcpy.def	wcslen.def	wcsncasecmp.def wcsncat.def \
-wcsncmp.def	wcsncpy.def	wcsnlen.def	wcspbrk.def \
-wcsrchr.def	wcsspn.def	wcsstr.def 	wcstok.def  \
-wcswidth.def	wcsxfrm.def	wcwidth.def	wmemchr.def \
-wmemcmp.def	wmemcpy.def	wmemmove.def	wmemset.def \
-memmem.def	memrchr.def	rawmemchr.def	strchrnul.def \
-strcasecmp_l.def strcoll_l.def	strncasecmp_l.def strxfrm_l.def \
-wcscasecmp_l.def wcscoll_l.def	wcsncasecmp_l.def wcsxfrm_l.def \
-strverscmp.def	strnstr.def	wmempcpy.def
-
-CHAPTERS = strings.tex wcstrings.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/string/local.mk b/newlib/libc/string/local.mk
new file mode 100644
index 000000000000..5bcec8dd4ca6
--- /dev/null
+++ b/newlib/libc/string/local.mk
@@ -0,0 +1,22 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/bcmp.def	%D%/memcpy.def	%D%/strcmp.def	%D%/strncat.def %D%/strstr.def \
+	%D%/bcopy.def	%D%/memmove.def	%D%/strcoll.def	%D%/strncmp.def %D%/strtok.def \
+	%D%/bzero.def	%D%/memset.def	%D%/strcpy.def	%D%/strncpy.def %D%/strxfrm.def \
+	%D%/index.def	%D%/rindex.def	%D%/strcspn.def	%D%/strpbrk.def %D%/swab.def \
+	%D%/memchr.def	%D%/strcat.def	%D%/strerror.def	%D%/strerror_r.def %D%/strrchr.def \
+	%D%/memcmp.def	%D%/strchr.def	%D%/strlen.def	%D%/strnlen.def %D%/strspn.def \
+	%D%/strcasecmp.def	%D%/strncasecmp.def %D%/strcasestr.def	%D%/strlwr.def  %D%/strupr.def \
+	%D%/memccpy.def 	%D%/mempcpy.def	%D%/stpcpy.def	%D%/stpncpy.def %D%/strsignal.def \
+	%D%/wcscasecmp.def	%D%/wcscat.def	%D%/wcschr.def	%D%/wcscmp.def %D%/wcscoll.def \
+	%D%/wcscpy.def	%D%/wcscspn.def	%D%/wcpcpy.def	%D%/wcpncpy.def %D%/wcsdup.def \
+	%D%/wcslcat.def	%D%/wcslcpy.def	%D%/wcslen.def	%D%/wcsncasecmp.def %D%/wcsncat.def \
+	%D%/wcsncmp.def	%D%/wcsncpy.def	%D%/wcsnlen.def	%D%/wcspbrk.def \
+	%D%/wcsrchr.def	%D%/wcsspn.def	%D%/wcsstr.def 	%D%/wcstok.def  \
+	%D%/wcswidth.def	%D%/wcsxfrm.def	%D%/wcwidth.def	%D%/wmemchr.def \
+	%D%/wmemcmp.def	%D%/wmemcpy.def	%D%/wmemmove.def	%D%/wmemset.def \
+	%D%/memmem.def	%D%/memrchr.def	%D%/rawmemchr.def	%D%/strchrnul.def \
+	%D%/strcasecmp_l.def %D%/strcoll_l.def	%D%/strncasecmp_l.def %D%/strxfrm_l.def \
+	%D%/wcscasecmp_l.def %D%/wcscoll_l.def	%D%/wcsncasecmp_l.def %D%/wcsxfrm_l.def \
+	%D%/strverscmp.def	%D%/strnstr.def	%D%/wmempcpy.def
+
+LIBC_CHAPTERS += %D%/strings.tex %D%/wcstrings.tex
diff --git a/newlib/libc/sys/Makefile.am b/newlib/libc/sys/Makefile.am
index a8e65ec80345..9b515f5283ce 100644
--- a/newlib/libc/sys/Makefile.am
+++ b/newlib/libc/sys/Makefile.am
@@ -29,9 +29,5 @@ $(sys_dir)/$(CRT0): ; @true
 
 CLEANFILES = $(CRT0)
 
-doc:
-
-docbook:
-
 ACLOCAL_AMFLAGS = -I ../.. -I ../../.. -I ../../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libc/syscalls/Makefile.am b/newlib/libc/syscalls/Makefile.am
index 5895be430929..ada372a7aa1c 100644
--- a/newlib/libc/syscalls/Makefile.am
+++ b/newlib/libc/syscalls/Makefile.am
@@ -49,7 +49,3 @@ noinst_DATA =
 endif
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for syscalls.
diff --git a/newlib/libc/time/Makefile.am b/newlib/libc/time/Makefile.am
index 8871d1afb41f..90081823230e 100644
--- a/newlib/libc/time/Makefile.am
+++ b/newlib/libc/time/Makefile.am
@@ -42,20 +42,10 @@ endif # USE_LIBTOOL
 # This rule is needed so that wcsftime.o is rebuilt when strftime.c changes.
 include $(srcdir)/../../Makefile.shared
 
-$(lpfx)wcsftime.$(oext): strftime.c
-
-CHEWOUT_FILES = \
-	asctime.def	\
-	clock.def 	\
-	ctime.def	\
-	difftime.def	\
-	gmtime.def	\
-	lcltime.def	\
-	mktime.def	\
-	strftime.def	\
-	time.def	\
-	tzlock.def	\
-	tzset.def	\
-	wcsftime.def
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./local.mk
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
-CHAPTERS = time.tex
+$(lpfx)wcsftime.$(oext): strftime.c
diff --git a/newlib/libc/time/local.mk b/newlib/libc/time/local.mk
new file mode 100644
index 000000000000..3e7ba4157ea1
--- /dev/null
+++ b/newlib/libc/time/local.mk
@@ -0,0 +1,15 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/asctime.def \
+	%D%/clock.def \
+	%D%/ctime.def \
+	%D%/difftime.def \
+	%D%/gmtime.def \
+	%D%/lcltime.def \
+	%D%/mktime.def \
+	%D%/strftime.def \
+	%D%/time.def \
+	%D%/tzlock.def \
+	%D%/tzset.def \
+	%D%/wcsftime.def
+
+LIBC_CHAPTERS += %D%/time.tex
diff --git a/newlib/libc/unix/Makefile.am b/newlib/libc/unix/Makefile.am
index a2d830f1adb3..a74738d74ca0 100644
--- a/newlib/libc/unix/Makefile.am
+++ b/newlib/libc/unix/Makefile.am
@@ -49,7 +49,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for unix.
diff --git a/newlib/libc/xdr/Makefile.am b/newlib/libc/xdr/Makefile.am
index ad9968c9acf0..8f4ac7d04a33 100644
--- a/newlib/libc/xdr/Makefile.am
+++ b/newlib/libc/xdr/Makefile.am
@@ -56,8 +56,4 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for xdr.
-
 include $(srcdir)/../../Makefile.shared
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 4/5] newlib: move man page generation into top-level build
  2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
                   ` (2 preceding siblings ...)
  2022-01-22  4:32 ` [PATCH 3/5] newlib: libc: move manual into top-level build Mike Frysinger
@ 2022-01-22  4:32 ` Mike Frysinger
  2022-01-22  4:32 ` [PATCH 5/5] newlib: drop shared documentation rules Mike Frysinger
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-22  4:32 UTC (permalink / raw)
  To: newlib

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         |  70 +----
 newlib/libc/Makefile.in         | 445 +++-----------------------------
 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/local.mk            |  23 +-
 newlib/libc/locale/Makefile.am  |   6 -
 newlib/libc/locale/Makefile.in  |   9 +-
 newlib/libc/machine/Makefile.in |   4 -
 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/sys/Makefile.in     |   4 -
 newlib/libc/time/Makefile.am    |   6 -
 newlib/libc/time/Makefile.in    |  14 +-
 newlib/libm/Makefile.am         |  22 --
 newlib/libm/Makefile.in         |  24 +-
 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/local.mk            |  23 +-
 newlib/libm/machine/Makefile.am |   4 -
 newlib/libm/machine/Makefile.in |   4 -
 newlib/libm/math/Makefile.am    |   6 -
 newlib/libm/math/Makefile.in    |  13 +-
 newlib/libm/mathfp/Makefile.am  |   6 -
 newlib/libm/mathfp/Makefile.in  |  14 +-
 51 files changed, 189 insertions(+), 884 deletions(-)

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 21945fd71c0f..0ad3045246fc 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -426,22 +426,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
 
 # Multilib support.
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 62e04abcfbc1..91f6b95d7dc3 100644
--- a/newlib/libc/Makefile.am
+++ b/newlib/libc/Makefile.am
@@ -121,75 +121,7 @@ crt0.o: sys/crt0.o
 
 sys/crt0.o: ; @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" != "."; 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" != "."; 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 = $(CRT0) \
-	targetdep.tex stmp-targetdep \
-	tmp-targetdep.texi \
-	*.xml *.3
+CLEANFILES = $(CRT0)
 
 ACLOCAL_AMFLAGS = -I .. -I ../.. -I ../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libc/ctype/Makefile.am b/newlib/libc/ctype/Makefile.am
index 6d68622b5175..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 ./local.mk
-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 0b861d3b8c68..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 ./local.mk
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/local.mk b/newlib/libc/local.mk
index f6b797f612c2..d3cd02315af4 100644
--- a/newlib/libc/local.mk
+++ b/newlib/libc/local.mk
@@ -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 $@.tmp $@
 	$(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 $< > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(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/local.mk
 include %D%/iconv/local.mk
 include %D%/locale/local.mk
@@ -29,4 +48,6 @@ include %D%/time/local.mk
 
 CLEANFILES += \
 	%D%/targetdep.tex \
-	$(LIBC_CHEWOUT_FILES)
+	$(LIBC_CHEWOUT_FILES) \
+	$(LIBC_DOCBOOK_OUT_FILES) \
+	%D%/*.xml %D%/*.3
diff --git a/newlib/libc/locale/Makefile.am b/newlib/libc/locale/Makefile.am
index 0fc51ffd4d74..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 ./local.mk
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/misc/Makefile.am b/newlib/libc/misc/Makefile.am
index c9fb96c68696..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 ./local.mk
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/posix/Makefile.am b/newlib/libc/posix/Makefile.am
index 88976a14d4a9..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 ./local.mk
-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 c5396890d067..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 ./local.mk
-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 ef1c1e223376..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 ./local.mk
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/signal/Makefile.am b/newlib/libc/signal/Makefile.am
index 1f644b9c9ef3..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 ./local.mk
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/ssp/Makefile.am b/newlib/libc/ssp/Makefile.am
index 2d0a25d0c63f..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 ./local.mk
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am
index 25207cea26bb..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 ./local.mk
-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 e93f7056518c..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 ./local.mk
-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 4cfcab39a9d6..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 ./local.mk
-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 70bf7afdc01f..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 ./local.mk
-CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
-CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/time/Makefile.am b/newlib/libc/time/Makefile.am
index 90081823230e..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 ./local.mk
-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 08d6faa8ac17..158d873ca815 100644
--- a/newlib/libm/Makefile.am
+++ b/newlib/libm/Makefile.am
@@ -33,27 +33,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/common/Makefile.am b/newlib/libm/common/Makefile.am
index 52f74eec5763..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 ./local.mk
-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 27993dc43fa2..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 ./local.mk
-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 3d0052e53617..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 ./local.mk
-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/local.mk b/newlib/libm/local.mk
index db10751f9392..a6bdfc8fd511 100644
--- a/newlib/libm/local.mk
+++ b/newlib/libm/local.mk
@@ -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 $@.tmp $@
 	$(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 $< > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(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/local.mk
 include %D%/complex/local.mk
 include %D%/fenv/local.mk
@@ -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/machine/Makefile.am b/newlib/libm/machine/Makefile.am
index 3b05fb103fc1..823a3302c03c 100644
--- a/newlib/libm/machine/Makefile.am
+++ b/newlib/libm/machine/Makefile.am
@@ -18,9 +18,5 @@ endif # USE_LIBTOOL
 
 $(libm_machine_dir)/lib.a:
 
-doc:
-
-docbook:
-
 ACLOCAL_AMFLAGS = -I ../.. -I ../../.. -I ../../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am
index 97d5d3748936..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 ./local.mk
-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 a35ae1f54d36..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 ./local.mk
-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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 5/5] newlib: drop shared documentation rules
  2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
                   ` (3 preceding siblings ...)
  2022-01-22  4:32 ` [PATCH 4/5] newlib: move man page generation " Mike Frysinger
@ 2022-01-22  4:32 ` Mike Frysinger
  2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
  2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
  6 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-22  4:32 UTC (permalink / raw)
  To: newlib

Now that the top-level makefile handles these, don't need to copy
these into every single subdir.
---
 newlib/Makefile.shared                        | 36 -------------------
 newlib/libc/argz/Makefile.in                  | 35 +-----------------
 newlib/libc/ctype/Makefile.in                 | 35 +-----------------
 newlib/libc/errno/Makefile.in                 | 35 +-----------------
 newlib/libc/iconv/Makefile.in                 | 34 ------------------
 newlib/libc/iconv/ccs/Makefile.in             | 35 +-----------------
 newlib/libc/iconv/ccs/binary/Makefile.in      | 34 ------------------
 newlib/libc/iconv/ces/Makefile.in             | 35 +-----------------
 newlib/libc/iconv/lib/Makefile.in             | 35 +-----------------
 newlib/libc/locale/Makefile.in                | 35 +-----------------
 newlib/libc/machine/i386/Makefile.in          | 35 +-----------------
 newlib/libc/misc/Makefile.in                  | 35 +-----------------
 newlib/libc/posix/Makefile.in                 | 35 +-----------------
 newlib/libc/reent/Makefile.in                 | 35 +-----------------
 newlib/libc/search/Makefile.in                | 35 +-----------------
 newlib/libc/signal/Makefile.in                | 35 +-----------------
 newlib/libc/ssp/Makefile.in                   | 35 +-----------------
 newlib/libc/stdio/Makefile.in                 | 35 +-----------------
 newlib/libc/stdio64/Makefile.in               | 35 +-----------------
 newlib/libc/stdlib/Makefile.in                | 35 +-----------------
 newlib/libc/string/Makefile.in                | 35 +-----------------
 newlib/libc/sys/linux/argp/Makefile.in        | 35 +-----------------
 newlib/libc/sys/linux/cmath/Makefile.in       | 35 +-----------------
 newlib/libc/sys/linux/dl/Makefile.in          | 35 +-----------------
 newlib/libc/sys/linux/iconv/Makefile.in       | 35 +-----------------
 newlib/libc/sys/linux/intl/Makefile.in        | 35 +-----------------
 .../libc/sys/linux/linuxthreads/Makefile.in   | 35 +-----------------
 .../linuxthreads/machine/i386/Makefile.in     | 35 +-----------------
 .../libc/sys/linux/machine/i386/Makefile.in   | 35 +-----------------
 newlib/libc/sys/linux/net/Makefile.in         | 35 +-----------------
 newlib/libc/syscalls/Makefile.in              | 35 +-----------------
 newlib/libc/time/Makefile.in                  | 35 +-----------------
 newlib/libc/unix/Makefile.in                  | 35 +-----------------
 newlib/libc/xdr/Makefile.in                   | 35 +-----------------
 newlib/libm/common/Makefile.in                | 35 +-----------------
 newlib/libm/complex/Makefile.in               | 35 +-----------------
 newlib/libm/fenv/Makefile.in                  | 35 +-----------------
 newlib/libm/machine/aarch64/Makefile.in       | 35 +-----------------
 newlib/libm/machine/arm/Makefile.in           | 35 +-----------------
 newlib/libm/machine/i386/Makefile.in          | 35 +-----------------
 newlib/libm/machine/mips/Makefile.in          | 35 +-----------------
 newlib/libm/machine/nds32/Makefile.in         | 35 +-----------------
 newlib/libm/machine/powerpc/Makefile.in       | 35 +-----------------
 newlib/libm/machine/pru/Makefile.in           | 35 +-----------------
 newlib/libm/machine/riscv/Makefile.in         | 35 +-----------------
 newlib/libm/machine/sparc/Makefile.in         | 35 +-----------------
 newlib/libm/machine/spu/Makefile.in           | 35 +-----------------
 newlib/libm/machine/x86_64/Makefile.in        | 35 +-----------------
 newlib/libm/math/Makefile.in                  | 35 +-----------------
 newlib/libm/mathfp/Makefile.in                | 35 +-----------------
 50 files changed, 47 insertions(+), 1702 deletions(-)

diff --git a/newlib/Makefile.shared b/newlib/Makefile.shared
index f1152fc627cf..00ea8533581c 100644
--- a/newlib/Makefile.shared
+++ b/newlib/Makefile.shared
@@ -4,39 +4,3 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	do \
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
-
-#
-# documentation rules
-#
-
-SUFFIXES = .def .xml
-
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
diff --git a/newlib/libc/iconv/ccs/binary/Makefile.in b/newlib/libc/iconv/ccs/binary/Makefile.in
index a5b242b98b84..379c02e1c23e 100644
--- a/newlib/libc/iconv/ccs/binary/Makefile.in
+++ b/newlib/libc/iconv/ccs/binary/Makefile.in
@@ -309,20 +309,9 @@ cp775.cct cp850.cct cp852.cct cp855.cct cp866.cct \
 jis_x0212_1990.cct jis_x0201_1976.cct jis_x0208_1990.cct ksx1001.cct \
 cns11643_plane1.cct cns11643_plane2.cct cns11643_plane14.cct
 
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .c
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -415,7 +404,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -511,28 +499,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 info:
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/newlib/libc/sys/linux/argp/Makefile.in b/newlib/libc/sys/linux/argp/Makefile.in
index b4104554a01e..d7faf3dbde0b 100644
--- a/newlib/libc/sys/linux/argp/Makefile.in
+++ b/newlib/libc/sys/linux/argp/Makefile.in
@@ -340,20 +340,10 @@ libargp_la_LDFLAGS = -Xcompiler -nostdlib
 @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(LIB_SOURCES)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .c .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -559,7 +549,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -662,28 +651,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/newlib/libc/sys/linux/cmath/Makefile.in b/newlib/libc/sys/linux/cmath/Makefile.in
index 76380af131f5..0c9a9dd50d8c 100644
--- a/newlib/libc/sys/linux/cmath/Makefile.in
+++ b/newlib/libc/sys/linux/cmath/Makefile.in
@@ -363,20 +363,10 @@ libcmath_la_LDFLAGS = -Xcompiler -nostdlib
 @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(LIB_SOURCES)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .c .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -744,7 +734,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -847,28 +836,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/newlib/libc/sys/linux/dl/Makefile.in b/newlib/libc/sys/linux/dl/Makefile.in
index 18798a921d9e..ae88d5ac4a3c 100644
--- a/newlib/libc/sys/linux/dl/Makefile.in
+++ b/newlib/libc/sys/linux/dl/Makefile.in
@@ -350,20 +350,10 @@ libdl_la_LDFLAGS = -Xcompiler -nostdlib
 @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(LIB_SOURCES)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .c .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -647,7 +637,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -750,28 +739,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/newlib/libc/sys/linux/iconv/Makefile.in b/newlib/libc/sys/linux/iconv/Makefile.in
index b4842171deb0..e274154dc8df 100644
--- a/newlib/libc/sys/linux/iconv/Makefile.in
+++ b/newlib/libc/sys/linux/iconv/Makefile.in
@@ -350,20 +350,10 @@ libiconv_la_LDFLAGS = -Xcompiler -nostdlib
 @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(LIB_SOURCES)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .c .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -632,7 +622,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -735,28 +724,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/newlib/libc/sys/linux/intl/Makefile.in b/newlib/libc/sys/linux/intl/Makefile.in
index b19def434f89..38e147fe3904 100644
--- a/newlib/libc/sys/linux/intl/Makefile.in
+++ b/newlib/libc/sys/linux/intl/Makefile.in
@@ -349,16 +349,6 @@ msgcatdir = /usr/share/locale
 @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(LIB_SOURCES)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 AM_CFLAGS = -DNOT_IN_libc -DHAVE_CONFIG_H -D_GNU_SOURCE -D__libc_enable_secure=1 -D'LOCALEDIR="$(msgcatdir)"' -D'LOCALE_ALIAS_PATH="$(msgcatdir)"' -DNLSPATH='"$(msgcatdir)/%L/%N:$(msgcatdir)/%L/LC_MESSAGES/%N:$(msgcatdir)/%l/%N:$(msgcatdir)/%l/LC_MESSAGES/%N:"'
 
 # shouldn't have to do the following, but if needed
@@ -366,7 +356,7 @@ BISONFLAGS = --yacc --name-prefix=__gettext --output
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .c .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -626,7 +616,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -728,28 +717,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	do \
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
-
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
 plural.c: plural.y
 	$(BISON) $(BISONFLAGS) $@ $^
 
diff --git a/newlib/libc/sys/linux/linuxthreads/Makefile.in b/newlib/libc/sys/linux/linuxthreads/Makefile.in
index cf47655f022a..05355bcdd519 100644
--- a/newlib/libc/sys/linux/linuxthreads/Makefile.in
+++ b/newlib/libc/sys/linux/linuxthreads/Makefile.in
@@ -534,16 +534,6 @@ libthread_db_la_LDFLAGS = -version-info $(LIBTOOL_VERSION_INFO) -release newlib
 @USE_LIBTOOL_FALSE@libpthread_a_DEPENDENCIES = $(LIBADD_OBJS) $(MACHINE_LIB)
 @USE_LIBTOOL_FALSE@libthread_db_a_SOURCES = $(LIB_DB_SOURCES)
 @USE_LIBTOOL_FALSE@libthread_db_a_CFLAGS = $(AM_CFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 AM_CFLAGS = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1
 ACLOCAL_AMFLAGS = -I ../../../.. -I ../../../../.. -I ../../../../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
@@ -554,7 +544,7 @@ CFLAGS_pthread = -D__NO_WEAK_PTHREAD_ALIASES -DHAVE_Z_NODELETE
 all: all-recursive
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .c .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
@@ -1245,7 +1235,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -1360,28 +1349,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 doc:
 
 install-data-local: install-toollibLIBRARIES
diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in b/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in
index ae0907c37cd0..298300e4eb98 100644
--- a/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in
+++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in
@@ -350,23 +350,13 @@ liblinuxthreadsi386_la_LDFLAGS = -Xcompiler -nostdlib
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(LIB_SOURCES)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
 @USE_LIBTOOL_FALSE@lib_a_CCASFLAGS = $(AM_CCASFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 AM_CFLAGS = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1
 ACLOCAL_AMFLAGS = -I ../../../../../.. -I ../../../../../../.. -I ../../../../../../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .S .c .lo .o .obj
+.SUFFIXES: .S .c .lo .o .obj
 am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../../../Makefile.shared $(am__configure_deps)
@@ -565,7 +555,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -672,28 +661,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/newlib/libc/sys/linux/machine/i386/Makefile.in b/newlib/libc/sys/linux/machine/i386/Makefile.in
index 3ab261652bfc..7b1ef28ba4de 100644
--- a/newlib/libc/sys/linux/machine/i386/Makefile.in
+++ b/newlib/libc/sys/linux/machine/i386/Makefile.in
@@ -352,22 +352,12 @@ AM_CCASFLAGS = -I$(srcdir)/../.. $(AM_CPPFLAGS)
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(LIB_SOURCES)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
 @USE_LIBTOOL_FALSE@lib_a_CCASFLAGS = $(AM_CCASFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 ACLOCAL_AMFLAGS = -I ../../../../.. -I ../../../../../.. -I ../../../../../../config
 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .S .c .lo .o .obj
+.SUFFIXES: .S .c .lo .o .obj
 am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../../Makefile.shared $(am__configure_deps)
@@ -578,7 +568,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -685,28 +674,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 all-local: crt0.o
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/newlib/libc/sys/linux/net/Makefile.in b/newlib/libc/sys/linux/net/Makefile.in
index 2e76ef9c83df..934405d3c973 100644
--- a/newlib/libc/sys/linux/net/Makefile.in
+++ b/newlib/libc/sys/linux/net/Makefile.in
@@ -477,20 +477,10 @@ libnet_la_CFLAGS = -DINET6
 @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
 @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
 @USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
-
-#
-# documentation rules
-#
-SUFFIXES = .def .xml
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .def .xml .c .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -1587,7 +1577,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -1690,28 +1679,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
 
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
 install-data-local:
 	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \
 	for i in $(srcdir)/../include/arpa/*.h; do \
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 3/5] newlib: libc: move manual into top-level build
  2022-01-22  4:32 ` [PATCH 3/5] newlib: libc: move manual into top-level build Mike Frysinger
@ 2022-01-24 14:30   ` Corinna Vinschen
  0 siblings, 0 replies; 25+ messages in thread
From: Corinna Vinschen @ 2022-01-24 14:30 UTC (permalink / raw)
  To: newlib

On Jan 21 23:32, Mike Frysinger wrote:
> This doesn't migrate all the docs, just the libc's manual (pdf/info).
> This is to show the basic form of migrating the chew files.
> 
> For subdirs that didn't have any docs, I've stripped their settings
> for clarity.  If someone wanted to suddenly add docs, they can add
> the corresponding local.mk files easily.

Wait, I'm totally for a change like this, but... local.mk  Are you
planning to reuse the local.mk files for something other than the docs?
Otherwise, wouldn't it make sense to use a self-explaining name like,
say, Makefile.doc?


Corinna


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/5 v2] newlib: libm: move manual into top-level build
  2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
                   ` (4 preceding siblings ...)
  2022-01-22  4:32 ` [PATCH 5/5] newlib: drop shared documentation rules Mike Frysinger
@ 2022-01-28  7:58 ` Mike Frysinger
  2022-01-28  7:58   ` [PATCH 2/5 v2] newlib: libc: include all chapters all the time in the manual Mike Frysinger
                     ` (4 more replies)
  2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
  6 siblings, 5 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-28  7:58 UTC (permalink / raw)
  To: newlib

This doesn't migrate all the docs, just the libm's manual (pdf/info).
This is to show the basic form of migrating the chew files.
---
 newlib/Makefile.am               |   9 +
 newlib/Makefile.in               | 442 ++++++++++++++++++++++++++++---
 newlib/doc/local.mk              |  11 +
 newlib/libm/Makefile.am          |  27 +-
 newlib/libm/Makefile.in          | 398 +++-------------------------
 newlib/libm/Makefile.inc         |  26 ++
 newlib/libm/common/Makefile.am   |  14 +-
 newlib/libm/common/Makefile.in   |  22 +-
 newlib/libm/common/Makefile.inc  |  10 +
 newlib/libm/complex/Makefile.am  |  12 +-
 newlib/libm/complex/Makefile.in  |  18 +-
 newlib/libm/complex/Makefile.inc |   8 +
 newlib/libm/fenv/Makefile.am     |  11 +-
 newlib/libm/fenv/Makefile.in     |  15 +-
 newlib/libm/fenv/Makefile.inc    |   7 +
 newlib/libm/math/Makefile.am     |  15 +-
 newlib/libm/math/Makefile.in     |  23 +-
 newlib/libm/math/Makefile.inc    |  11 +
 newlib/libm/mathfp/Makefile.am   |  35 +--
 newlib/libm/mathfp/Makefile.in   |  42 +--
 newlib/libm/mathfp/Makefile.inc  |  31 +++
 21 files changed, 631 insertions(+), 556 deletions(-)
 create mode 100644 newlib/libm/Makefile.inc
 create mode 100644 newlib/libm/common/Makefile.inc
 create mode 100644 newlib/libm/complex/Makefile.inc
 create mode 100644 newlib/libm/fenv/Makefile.inc
 create mode 100644 newlib/libm/math/Makefile.inc
 create mode 100644 newlib/libm/mathfp/Makefile.inc

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 718002535c78..a4cb965c2af2 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -5,6 +5,8 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 
 # Variables that will accumulate in subdirs.
 PHONY =
+SUFFIXES =
+info_TEXINFOS =
 noinst_DATA =
 pkglib_LTLIBRARIES =
 
@@ -510,11 +512,18 @@ check-DEJAGNU: site.exp
 clean-local:
 	-rm -rf targ-include newlib.h _newlib_version.h stamp-*
 
+# Workaround bad automake/texinfo interactions.
+# https://bugs.gnu.org/23599
+TEXI2DVI = texi2dvi -E
+
+TEXINFO_TEX = ../texinfo/texinfo.tex
+
 if HAVE_DOC
 include doc/local.mk
 endif
 if HAVE_ICONVDATA
 include iconvdata/Makefile.inc
 endif
+include libm/Makefile.inc
 
 .PHONY: $(PHONY)
diff --git a/newlib/doc/local.mk b/newlib/doc/local.mk
index 64083c3dd600..5c867c998251 100644
--- a/newlib/doc/local.mk
+++ b/newlib/doc/local.mk
@@ -18,3 +18,14 @@ man-cache:
 	${srcdir}/doc/makedocbook.py --cache
 
 PHONY += man-cache
+
+#
+# Subdir documentation rules.
+#
+
+SUFFIXES += .def
+
+CHEW = $(MKDOC) -f $(srcdir)/%D%/doc.str
+
+.c.def:
+	$(AM_V_GEN)$(CHEW) < $< > $*.def || ( rm $*.def && false )
diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
index 5165ff34b9c0..1070af011ddd 100644
--- a/newlib/libm/Makefile.am
+++ b/newlib/libm/Makefile.am
@@ -36,31 +36,6 @@ endif
 
 $(SUBLIBS):
 
-TEXINFO_TEX = ../../texinfo/texinfo.tex
-info_TEXINFOS = libm.texi
-libm_TEXINFOS = targetdep.tex
-
-libm.dvi: targetdep.tex math/stmp-def complex/stmp-def fenv/stmp-def
-
-stmp-targetdep: force
-	rm -f tmp.texi
-	targetdoc=`pwd`/tmp.texi; \
-	for d in $(SUBDIRS); do \
-	  if test "$$d" != "."; then \
-	    (cd $$d && $(MAKE) doc) || exit 1; \
-	  fi; \
-	done
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp.texi targetdep.tex
-	touch $@
-
-targetdep.tex: stmp-targetdep ; @true
-
-math/stmp-def: stmp-targetdep ; @true
-
-complex/stmp-def: stmp-targetdep ; @true
-
-fenv/stmp-def: stmp-targetdep ; @true
-
 docbook-recursive: force
 	for d in $(SUBDIRS); do \
 	  if test "$$d" != "."; then \
@@ -81,7 +56,7 @@ install-man: man
 .PHONY: force
 force:
 
-CLEANFILES = tmp.texi targetdep.tex stmp-targetdep *.xml *.3
+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
new file mode 100644
index 000000000000..9aa5a5c93519
--- /dev/null
+++ b/newlib/libm/Makefile.inc
@@ -0,0 +1,26 @@
+info_TEXINFOS += %D%/libm.texi
+%C%_libm_TEXINFOS = %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
+
+LIBM_CHEWOUT_FILES =
+
+LIBM_CHAPTERS =
+
+%D%/libm.dvi: %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
+
+%D%/targetdep.tex: $(LIBM_CHAPTERS)
+	$(AM_V_GEN)cat $^ > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(AM_V_at)touch $@
+
+include %D%/common/Makefile.inc
+include %D%/complex/Makefile.inc
+include %D%/fenv/Makefile.inc
+if NEWLIB_HW_FP
+include %D%/mathfp/Makefile.inc
+else
+include %D%/math/Makefile.inc
+endif
+
+CLEANFILES += \
+	%D%/targetdep.tex \
+	$(LIBM_CHEWOUT_FILES)
diff --git a/newlib/libm/common/Makefile.am b/newlib/libm/common/Makefile.am
index ef55e90ea462..29597d6031a9 100644
--- a/newlib/libm/common/Makefile.am
+++ b/newlib/libm/common/Makefile.am
@@ -59,15 +59,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	s_cbrt.def s_copysign.def s_exp10.def s_expm1.def s_ilogb.def \
-	s_infinity.def s_isnan.def s_log1p.def s_modf.def \
-	s_nan.def s_nextafter.def s_pow10.def s_scalbn.def \
-	s_fdim.def s_fma.def s_fmax.def s_fmin.def \
-	s_logb.def s_log2.def s_lrint.def s_lround.def s_nearbyint.def \
-	s_remquo.def s_rint.def s_round.def s_signbit.def s_trunc.def \
-	isgreater.def
-
-CHAPTERS =
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/common/Makefile.inc b/newlib/libm/common/Makefile.inc
new file mode 100644
index 000000000000..b0d3013c522b
--- /dev/null
+++ b/newlib/libm/common/Makefile.inc
@@ -0,0 +1,10 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/s_cbrt.def %D%/s_copysign.def %D%/s_exp10.def %D%/s_expm1.def %D%/s_ilogb.def \
+	%D%/s_infinity.def %D%/s_isnan.def %D%/s_log1p.def %D%/s_modf.def \
+	%D%/s_nan.def %D%/s_nextafter.def %D%/s_pow10.def %D%/s_scalbn.def \
+	%D%/s_fdim.def %D%/s_fma.def %D%/s_fmax.def %D%/s_fmin.def \
+	%D%/s_logb.def %D%/s_log2.def %D%/s_lrint.def %D%/s_lround.def %D%/s_nearbyint.def \
+	%D%/s_remquo.def %D%/s_rint.def %D%/s_round.def %D%/s_signbit.def %D%/s_trunc.def \
+	%D%/isgreater.def
+
+LIBM_CHAPTERS +=
diff --git a/newlib/libm/complex/Makefile.am b/newlib/libm/complex/Makefile.am
index 73fa19045754..0f27fff19ff6 100644
--- a/newlib/libm/complex/Makefile.am
+++ b/newlib/libm/complex/Makefile.am
@@ -35,13 +35,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	cabs.def cacos.def cacosh.def carg.def \
-        casin.def casinh.def catan.def catanh.def \
-        ccos.def ccosh.def cexp.def cimag.def clog.def \
-        clog10.def conj.def cpow.def cproj.def creal.def \
-        csin.def csinh.def csqrt.def ctan.def ctanh.def
-
-CHAPTERS = complex.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/complex/Makefile.inc b/newlib/libm/complex/Makefile.inc
new file mode 100644
index 000000000000..94288082ea32
--- /dev/null
+++ b/newlib/libm/complex/Makefile.inc
@@ -0,0 +1,8 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/cabs.def %D%/cacos.def %D%/cacosh.def %D%/carg.def \
+	%D%/casin.def %D%/casinh.def %D%/catan.def %D%/catanh.def \
+	%D%/ccos.def %D%/ccosh.def %D%/cexp.def %D%/cimag.def %D%/clog.def \
+	%D%/clog10.def %D%/conj.def %D%/cpow.def %D%/cproj.def %D%/creal.def \
+	%D%/csin.def %D%/csinh.def %D%/csqrt.def %D%/ctan.def %D%/ctanh.def
+
+LIBM_CHAPTERS += %D%/complex.tex
diff --git a/newlib/libm/fenv/Makefile.am b/newlib/libm/fenv/Makefile.am
index db59c8048490..00c55d03898d 100644
--- a/newlib/libm/fenv/Makefile.am
+++ b/newlib/libm/fenv/Makefile.am
@@ -22,12 +22,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	feclearexcept.def fegetenv.def \
-	fegetexceptflag.def fegetround.def feholdexcept.def \
-	feraiseexcept.def fesetenv.def fesetexceptflag.def fesetround.def \
-	fetestexcept.def feupdateenv.def
-
-CHAPTERS = fenv.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/fenv/Makefile.inc b/newlib/libm/fenv/Makefile.inc
new file mode 100644
index 000000000000..0399638ad603
--- /dev/null
+++ b/newlib/libm/fenv/Makefile.inc
@@ -0,0 +1,7 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/feclearexcept.def %D%/fegetenv.def \
+	%D%/fegetexceptflag.def %D%/fegetround.def %D%/feholdexcept.def \
+	%D%/feraiseexcept.def %D%/fesetenv.def %D%/fesetexceptflag.def %D%/fesetround.def \
+	%D%/fetestexcept.def %D%/feupdateenv.def
+
+LIBM_CHAPTERS += %D%/fenv.tex
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am
index 5529c358a80e..3d23a46a15e6 100644
--- a/newlib/libm/math/Makefile.am
+++ b/newlib/libm/math/Makefile.am
@@ -66,16 +66,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = w_acos.def w_acosh.def w_asin.def s_asinh.def \
-	s_atan.def w_atan2.def w_atanh.def w_j0.def \
-	w_cosh.def s_erf.def w_exp.def w_exp2.def \
-	s_fabs.def s_floor.def w_fmod.def s_frexp.def \
-	w_gamma.def w_hypot.def s_ldexp.def w_log.def \
-	w_log10.def \
-	w_pow.def w_remainder.def s_sin.def w_sinh.def \
-	w_sqrt.def s_tan.def s_tanh.def
-
-CHAPTERS = math.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/math/Makefile.inc b/newlib/libm/math/Makefile.inc
new file mode 100644
index 000000000000..bc3205e0b156
--- /dev/null
+++ b/newlib/libm/math/Makefile.inc
@@ -0,0 +1,11 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/w_acos.def %D%/w_acosh.def %D%/w_asin.def %D%/s_asinh.def \
+	%D%/s_atan.def %D%/w_atan2.def %D%/w_atanh.def %D%/w_j0.def \
+	%D%/w_cosh.def %D%/s_erf.def %D%/w_exp.def %D%/w_exp2.def \
+	%D%/s_fabs.def %D%/s_floor.def %D%/w_fmod.def %D%/s_frexp.def \
+	%D%/w_gamma.def %D%/w_hypot.def %D%/s_ldexp.def %D%/w_log.def \
+	%D%/w_log10.def \
+	%D%/w_pow.def %D%/w_remainder.def %D%/s_sin.def %D%/w_sinh.def \
+	%D%/w_sqrt.def %D%/s_tan.def %D%/s_tanh.def
+
+LIBM_CHAPTERS += %D%/math.tex
diff --git a/newlib/libm/mathfp/Makefile.am b/newlib/libm/mathfp/Makefile.am
index 39fb8b1db69e..44d0e8f28026 100644
--- a/newlib/libm/mathfp/Makefile.am
+++ b/newlib/libm/mathfp/Makefile.am
@@ -56,36 +56,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = e_acosh.def \
-	e_atanh.def \
-	e_hypot.def \
-	e_remainder.def \
-	er_lgamma.def \
-	s_acos.def \
-	s_asine.def \
-	s_asinh.def \
-	s_atan.def \
-	s_atan2.def \
-	s_atangent.def \
-	s_cosh.def \
-	s_erf.def \
-	s_exp.def \
-	s_fabs.def \
-	s_floor.def \
-	s_fmod.def \
-	s_frexp.def \
-	s_ldexp.def \
-	s_log10.def \
-	s_logarithm.def \
-	s_pow.def \
-	s_sine.def \
-	s_sineh.def \
-	s_sqrt.def \
-	s_tan.def \
-	s_tanh.def \
-	w_jn.def
-
-CHAPTERS = mathfp.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/mathfp/Makefile.inc b/newlib/libm/mathfp/Makefile.inc
new file mode 100644
index 000000000000..739e41f16d0b
--- /dev/null
+++ b/newlib/libm/mathfp/Makefile.inc
@@ -0,0 +1,31 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/e_acosh.def \
+	%D%/e_atanh.def \
+	%D%/e_hypot.def \
+	%D%/e_remainder.def \
+	%D%/er_lgamma.def \
+	%D%/s_acos.def \
+	%D%/s_asine.def \
+	%D%/s_asinh.def \
+	%D%/s_atan.def \
+	%D%/s_atan2.def \
+	%D%/s_atangent.def \
+	%D%/s_cosh.def \
+	%D%/s_erf.def \
+	%D%/s_exp.def \
+	%D%/s_fabs.def \
+	%D%/s_floor.def \
+	%D%/s_fmod.def \
+	%D%/s_frexp.def \
+	%D%/s_ldexp.def \
+	%D%/s_log10.def \
+	%D%/s_logarithm.def \
+	%D%/s_pow.def \
+	%D%/s_sine.def \
+	%D%/s_sineh.def \
+	%D%/s_sqrt.def \
+	%D%/s_tan.def \
+	%D%/s_tanh.def \
+	%D%/w_jn.def
+
+LIBM_CHAPTERS += %D%/mathfp.tex
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 2/5 v2] newlib: libc: include all chapters all the time in the manual
  2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
@ 2022-01-28  7:58   ` Mike Frysinger
  2022-01-28  7:58   ` [PATCH 3/5 v2] newlib: libc: move manual into top-level build Mike Frysinger
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-28  7:58 UTC (permalink / raw)
  To: newlib

THe stdio subdir is actually required by the documentation.  The
stdio/def is handled dynamically, but libc.texi always expects it
to be included, and fails if it isn't.  So making it required when
building docs is safe.

The xdr subdir is handled dynamically, but it doesn't include any
docs, so the dynamic logic isn't (currently) adding any value.  So
making it required when building docs is safe.

That leaves: iconv, stdio64, posix, and signal subdirs.  The chapters
have a little disclaimer saying they are system-dependent, but even
then, imo having stable manuals regardless of the target is preferable,
and we can add more disclaimer language to these chapters if we want.

This doesn't touch the man page codepaths, just the info/pdf.
---
 newlib/libc/Makefile.am                    | 63 +++-----------------
 newlib/libc/Makefile.in                    | 69 +++-------------------
 newlib/libc/argz/Makefile.in               |  5 --
 newlib/libc/configure                      | 24 +-------
 newlib/libc/configure.ac                   | 15 -----
 newlib/libc/ctype/Makefile.in              |  5 --
 newlib/libc/errno/Makefile.in              |  5 --
 newlib/libc/iconv/Makefile.in              |  5 --
 newlib/libc/iconv/ccs/Makefile.in          |  5 --
 newlib/libc/iconv/ccs/binary/Makefile.in   |  5 --
 newlib/libc/iconv/ces/Makefile.in          |  5 --
 newlib/libc/iconv/lib/Makefile.in          |  5 --
 newlib/libc/libc.texi                      | 18 ------
 newlib/libc/locale/Makefile.in             |  5 --
 newlib/libc/machine/a29k/Makefile.in       |  5 --
 newlib/libc/machine/aarch64/Makefile.in    |  5 --
 newlib/libc/machine/amdgcn/Makefile.in     |  5 --
 newlib/libc/machine/arc/Makefile.in        |  5 --
 newlib/libc/machine/arm/Makefile.in        |  5 --
 newlib/libc/machine/bfin/Makefile.in       |  5 --
 newlib/libc/machine/cr16/Makefile.in       |  5 --
 newlib/libc/machine/cris/Makefile.in       |  5 --
 newlib/libc/machine/crx/Makefile.in        |  5 --
 newlib/libc/machine/csky/Makefile.in       |  5 --
 newlib/libc/machine/d10v/Makefile.in       |  5 --
 newlib/libc/machine/d30v/Makefile.in       |  5 --
 newlib/libc/machine/epiphany/Makefile.in   |  5 --
 newlib/libc/machine/fr30/Makefile.in       |  5 --
 newlib/libc/machine/frv/Makefile.in        |  5 --
 newlib/libc/machine/ft32/Makefile.in       |  5 --
 newlib/libc/machine/h8300/Makefile.in      |  5 --
 newlib/libc/machine/h8500/Makefile.in      |  5 --
 newlib/libc/machine/hppa/Makefile.in       |  5 --
 newlib/libc/machine/i386/Makefile.in       |  5 --
 newlib/libc/machine/i960/Makefile.in       |  5 --
 newlib/libc/machine/iq2000/Makefile.in     |  5 --
 newlib/libc/machine/lm32/Makefile.in       |  5 --
 newlib/libc/machine/m32c/Makefile.in       |  5 --
 newlib/libc/machine/m32r/Makefile.in       |  5 --
 newlib/libc/machine/m68hc11/Makefile.in    |  5 --
 newlib/libc/machine/m68k/Makefile.in       |  5 --
 newlib/libc/machine/m88k/Makefile.in       |  5 --
 newlib/libc/machine/mep/Makefile.in        |  5 --
 newlib/libc/machine/microblaze/Makefile.in |  5 --
 newlib/libc/machine/mips/Makefile.in       |  5 --
 newlib/libc/machine/mn10200/Makefile.in    |  5 --
 newlib/libc/machine/mn10300/Makefile.in    |  5 --
 newlib/libc/machine/moxie/Makefile.in      |  5 --
 newlib/libc/machine/msp430/Makefile.in     |  5 --
 newlib/libc/machine/mt/Makefile.in         |  5 --
 newlib/libc/machine/nds32/Makefile.in      |  5 --
 newlib/libc/machine/necv70/Makefile.in     |  5 --
 newlib/libc/machine/nios2/Makefile.in      |  5 --
 newlib/libc/machine/nvptx/Makefile.in      |  5 --
 newlib/libc/machine/or1k/Makefile.in       |  5 --
 newlib/libc/machine/powerpc/Makefile.in    |  5 --
 newlib/libc/machine/pru/Makefile.in        |  5 --
 newlib/libc/machine/riscv/Makefile.in      |  5 --
 newlib/libc/machine/rl78/Makefile.in       |  5 --
 newlib/libc/machine/rx/Makefile.in         |  5 --
 newlib/libc/machine/sh/Makefile.in         |  5 --
 newlib/libc/machine/sparc/Makefile.in      |  5 --
 newlib/libc/machine/spu/Makefile.in        |  5 --
 newlib/libc/machine/tic4x/Makefile.in      |  5 --
 newlib/libc/machine/tic6x/Makefile.in      |  5 --
 newlib/libc/machine/tic80/Makefile.in      |  5 --
 newlib/libc/machine/v850/Makefile.in       |  5 --
 newlib/libc/machine/visium/Makefile.in     |  5 --
 newlib/libc/machine/w65/Makefile.in        |  5 --
 newlib/libc/machine/x86_64/Makefile.in     |  5 --
 newlib/libc/machine/xc16x/Makefile.in      |  5 --
 newlib/libc/machine/xstormy16/Makefile.in  |  5 --
 newlib/libc/machine/z8k/Makefile.in        |  5 --
 newlib/libc/misc/Makefile.in               |  5 --
 newlib/libc/posix/Makefile.in              |  5 --
 newlib/libc/reent/Makefile.in              |  5 --
 newlib/libc/search/Makefile.in             |  5 --
 newlib/libc/signal/Makefile.in             |  5 --
 newlib/libc/ssp/Makefile.in                |  5 --
 newlib/libc/stdio/Makefile.in              |  5 --
 newlib/libc/stdio64/Makefile.in            |  5 --
 newlib/libc/stdlib/Makefile.in             |  5 --
 newlib/libc/string/Makefile.in             |  5 --
 newlib/libc/sys/a29khif/Makefile.in        |  5 --
 newlib/libc/sys/amdgcn/Makefile.in         |  5 --
 newlib/libc/sys/arm/Makefile.in            |  5 --
 newlib/libc/sys/d10v/Makefile.in           |  5 --
 newlib/libc/sys/decstation/Makefile.in     |  5 --
 newlib/libc/sys/epiphany/Makefile.in       |  5 --
 newlib/libc/sys/h8300hms/Makefile.in       |  5 --
 newlib/libc/sys/h8500hms/Makefile.in       |  5 --
 newlib/libc/sys/m88kbug/Makefile.in        |  5 --
 newlib/libc/sys/mmixware/Makefile.in       |  5 --
 newlib/libc/sys/netware/Makefile.in        |  5 --
 newlib/libc/sys/or1k/Makefile.in           |  5 --
 newlib/libc/sys/rdos/Makefile.in           |  5 --
 newlib/libc/sys/rtems/Makefile.in          |  5 --
 newlib/libc/sys/sh/Makefile.in             |  5 --
 newlib/libc/sys/sparc64/Makefile.in        |  5 --
 newlib/libc/sys/sun4/Makefile.in           |  5 --
 newlib/libc/sys/sysmec/Makefile.in         |  5 --
 newlib/libc/sys/sysnec810/Makefile.in      |  5 --
 newlib/libc/sys/sysnecv850/Makefile.in     |  5 --
 newlib/libc/sys/sysvi386/Makefile.in       |  5 --
 newlib/libc/sys/sysvnecv70/Makefile.in     |  5 --
 newlib/libc/sys/tic80/Makefile.in          |  5 --
 newlib/libc/sys/tirtos/Makefile.in         |  5 --
 newlib/libc/sys/w65/Makefile.in            |  5 --
 newlib/libc/sys/z8ksim/Makefile.in         |  5 --
 newlib/libc/syscalls/Makefile.in           |  5 --
 newlib/libc/time/Makefile.in               |  5 --
 newlib/libc/unix/Makefile.in               |  5 --
 newlib/libc/xdr/Makefile.in                |  5 --
 113 files changed, 18 insertions(+), 711 deletions(-)

diff --git a/newlib/libc/Makefile.am b/newlib/libc/Makefile.am
index 5151e00daed7..4e0b8fdf24ea 100644
--- a/newlib/libc/Makefile.am
+++ b/newlib/libc/Makefile.am
@@ -131,12 +131,12 @@ $(SUBLIBS): ; @true
 SUBDEFS = \
 	stdlib/stmp-def \
 	ctype/stmp-def \
-	$(LIBC_STDIO_DEF) \
-	$(LIBC_STDIO64_DEF) \
-	$(LIBC_POSIX_DEF) \
-	$(LIBC_XDR_DEF) \
+	stdio/stmp-def \
+	stdio64/stmp-def \
+	posix/stmp-def \
+	xdr/stmp-def \
 	string/stmp-def \
-	$(LIBC_SIGNAL_DEF) \
+	signal/stmp-def \
 	time/stmp-def \
 	locale/stmp-def \
 	reent/stmp-def \
@@ -145,55 +145,9 @@ SUBDEFS = \
 # ditto for stmp-xml files in each subdirectory which builds .xml files
 SUBXMLS = $(SUBDEFS:stmp-def=stmp-xml)
 
-libc.info: sigset.texi stdio64.texi posix.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
+libc.info: targetdep.tex $(SUBDEFS)
 
-libc.dvi: sigset.texi stdio64.texi posix.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
-
-stmp-sigset: config.status
-	if test -n "$(LIBC_SIGNAL_LIB)"; then \
-	  echo "@set SIGNALS" >tmp-sigset.texi; \
-	else \
-	  echo "@clear SIGNALS" >tmp-sigset.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-sigset.texi sigset.texi
-	touch $@
-
-sigset.texi: stmp-sigset ; @true
-
-stmp-iconvset: config.status
-	if test -n "$(NEWLIB_ICONV_LIBS)"; then \
-	  echo "@set ICONV" >tmp-iconvset.texi; \
-	else \
-	  echo "@clear ICONV" >tmp-iconvset.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-iconvset.texi iconvset.texi
-	touch $@
-
-iconvset.texi: stmp-iconvset ; @true
-
-stmp-stdio64: config.status
-	if test -n "$(LIBC_STDIO64_LIB)"; then \
-	  echo "@set STDIO64" >tmp-stdio64.texi; \
-	else \
-	  echo "@clear STDIO64" >tmp-stdio64.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-stdio64.texi stdio64.texi
-	touch $@
-
-stdio64.texi: stmp-stdio64 ; @true
-
-stmp-posix: config.status
-	if test -n "$(LIBC_POSIX_LIB)"; then \
-	  echo "@set POSIX" >tmp-posix.texi; \
-	else \
-	  echo "@clear POSIX" >tmp-posix.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-posix.texi posix.texi
-	touch $@
-
-posix.texi: stmp-posix ; @true
+libc.dvi: targetdep.tex $(SUBDEFS)
 
 stmp-targetdep: force
 	rm -f tmp-targetdep.texi
@@ -213,8 +167,7 @@ $(SUBDEFS): stmp-targetdep ; @true
 
 TEXINFO_TEX = ../../texinfo/texinfo.tex
 info_TEXINFOS = libc.texi
-libc_TEXINFOS = sigset.texi posix.texi stdio64.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
+libc_TEXINFOS = targetdep.tex $(SUBDEFS)
 
 docbook-recursive: force
 	for d in $(SUBDIRS); do \
diff --git a/newlib/libc/configure.ac b/newlib/libc/configure.ac
index 5d4dc7bf5600..c24021c1d539 100644
--- a/newlib/libc/configure.ac
+++ b/newlib/libc/configure.ac
@@ -69,73 +69,58 @@ dnl for the library and an automake conditional for whether we should
 dnl build the library.
 
 LIBC_SIGNAL_LIB=
-LIBC_SIGNAL_DEF=
 if test -n "${signal_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_SIGNAL_LIB=${signal_dir}/lib${signal_dir}.${aext}
   else
     LIBC_SIGNAL_LIB=${signal_dir}/lib.${aext}
   fi
-  LIBC_SIGNAL_DEF=${signal_dir}/stmp-def
 fi
 AC_SUBST(LIBC_SIGNAL_LIB)
-AC_SUBST(LIBC_SIGNAL_DEF)
 AM_CONDITIONAL(HAVE_SIGNAL_DIR, test x${signal_dir} != x)
 
 LIBC_STDIO_LIB=
-LIBC_STDIO_DEF=
 if test -n "${stdio_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_STDIO_LIB=${stdio_dir}/lib${stdio_dir}.${aext}
   else
     LIBC_STDIO_LIB=${stdio_dir}/lib.${aext}
   fi
-  LIBC_STDIO_DEF=${stdio_dir}/stmp-def
 fi
 AC_SUBST(LIBC_STDIO_LIB)
-AC_SUBST(LIBC_STDIO_DEF)
 AM_CONDITIONAL(HAVE_STDIO_DIR, test x${stdio_dir} != x)
 
 LIBC_STDIO64_LIB=
-LIBC_STDIO64_DEF=
 if test -n "${stdio64_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_STDIO64_LIB=${stdio64_dir}/lib${stdio64_dir}.${aext}
   else
     LIBC_STDIO64_LIB=${stdio64_dir}/lib.${aext}
   fi
-  LIBC_STDIO64_DEF=${stdio64_dir}/stmp-def
 fi
 AC_SUBST(LIBC_STDIO64_LIB)
-AC_SUBST(LIBC_STDIO64_DEF)
 AM_CONDITIONAL(HAVE_STDIO64_DIR, test x${stdio64_dir} != x)
 
 LIBC_POSIX_LIB=
-LIBC_POSIX_DEF=
 if test -n "${posix_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_POSIX_LIB=${posix_dir}/lib${posix_dir}.${aext}
   else
     LIBC_POSIX_LIB=${posix_dir}/lib.${aext}
   fi
-  LIBC_POSIX_DEF=${posix_dir}/stmp-def
 fi
 AC_SUBST(LIBC_POSIX_LIB)
-AC_SUBST(LIBC_POSIX_DEF)
 AM_CONDITIONAL(HAVE_POSIX_DIR, test x${posix_dir} != x)
 
 LIBC_XDR_LIB=
-LIBC_XDR_DEF=
 if test -n "${xdr_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_XDR_LIB=${xdr_dir}/lib${xdr_dir}.${aext}
   else
     LIBC_XDR_LIB=${xdr_dir}/lib.${aext}
   fi
-  LIBC_XDR_DEF=${xdr_dir}/stmp-def
 fi
 AC_SUBST(LIBC_XDR_LIB)
-AC_SUBST(LIBC_XDR_DEF)
 AM_CONDITIONAL(HAVE_XDR_DIR, test x${xdr_dir} != x)
 
 LIBC_SYSCALL_LIB=
diff --git a/newlib/libc/libc.texi b/newlib/libc/libc.texi
index 0cab22036dee..d217d8118277 100644
--- a/newlib/libc/libc.texi
+++ b/newlib/libc/libc.texi
@@ -132,44 +132,26 @@ into another language, under the above conditions for modified versions.
 @node Top
 @top The Red Hat newlib C Library
 
-@c The menu contents depend on the configuration, so we include them
-@c as a separate file
-
-@c switch to set SIGNALS on or off, according to whether config picks up
-@c signal subdirectory:
-@include sigset.texi
-@include posix.texi
-@include stdio64.texi
-@include iconvset.texi
-
 @menu
 * Introduction::
 * Stdlib::
 * Ctype::
 * Stdio::
-@ifset STDIO64
 * Stdio64::
-@end ifset
 
 * Strings::
 * Wchar strings::
-@ifset SIGNALS
 * Signals::
-@end ifset
 
 * Timefns::
 * Locale::
 * Reentrancy::
 
 * Misc::
-@ifset POSIX
 * Posix::
-@end ifset
 * Syscalls::
 * Arglists::
-@ifset ICONV
 * Iconv::
-@end ifset
 * Overflow Protection::
 
 * Document Index::
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 3/5 v2] newlib: libc: move manual into top-level build
  2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
  2022-01-28  7:58   ` [PATCH 2/5 v2] newlib: libc: include all chapters all the time in the manual Mike Frysinger
@ 2022-01-28  7:58   ` Mike Frysinger
  2022-01-28  7:58   ` [PATCH 4/5 v2] newlib: move man page generation " Mike Frysinger
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-28  7:58 UTC (permalink / raw)
  To: newlib

This doesn't migrate all the docs, just the libc's manual (pdf/info).
This is to show the basic form of migrating the chew files.

For subdirs that didn't have any docs, I've stripped their settings
for clarity.  If someone wanted to suddenly add docs, they can add
the corresponding local.mk files easily.
---
 newlib/Makefile.am                 |   1 +
 newlib/Makefile.in                 | 235 ++++++++++++++-
 newlib/libc/Makefile.inc           |  32 ++
 newlib/libc/argz/Makefile.am       |   4 -
 newlib/libc/argz/Makefile.in       |   3 -
 newlib/libc/ctype/Makefile.am      |  41 +--
 newlib/libc/ctype/Makefile.in      |  51 +---
 newlib/libc/ctype/Makefile.inc     |  36 +++
 newlib/libc/errno/Makefile.am      |   4 -
 newlib/libc/errno/Makefile.in      |   3 -
 newlib/libc/iconv/Makefile.am      |  28 +-
 newlib/libc/iconv/Makefile.in      |  30 +-
 newlib/libc/iconv/Makefile.inc     |   3 +
 newlib/libc/iconv/ccs/Makefile.am  |   3 -
 newlib/libc/iconv/ccs/Makefile.in  |   2 -
 newlib/libc/iconv/ces/Makefile.am  |   3 -
 newlib/libc/iconv/ces/Makefile.in  |   2 -
 newlib/libc/iconv/iconv.tex        |   2 +-
 newlib/libc/iconv/lib/Makefile.am  |   3 -
 newlib/libc/iconv/lib/Makefile.in  |   2 -
 newlib/libc/iconv/lib/Makefile.inc |   1 +
 newlib/libc/locale/Makefile.am     |  13 +-
 newlib/libc/locale/Makefile.in     |  17 +-
 newlib/libc/locale/Makefile.inc    |   8 +
 newlib/libc/misc/Makefile.am       |   7 +-
 newlib/libc/misc/Makefile.in       |  10 +-
 newlib/libc/misc/Makefile.inc      |   6 +
 newlib/libc/posix/Makefile.am      |  10 +-
 newlib/libc/posix/Makefile.in      |  13 +-
 newlib/libc/posix/Makefile.inc     |   5 +
 newlib/libc/reent/Makefile.am      |  30 +-
 newlib/libc/reent/Makefile.in      |  37 +--
 newlib/libc/reent/Makefile.inc     |  25 ++
 newlib/libc/search/Makefile.am     |  13 +-
 newlib/libc/search/Makefile.in     |  14 +-
 newlib/libc/search/Makefile.inc    |   4 +
 newlib/libc/signal/Makefile.am     |   8 +-
 newlib/libc/signal/Makefile.in     |  10 +-
 newlib/libc/signal/Makefile.inc    |   7 +
 newlib/libc/ssp/Makefile.am        |   9 +-
 newlib/libc/ssp/Makefile.in        |  10 +-
 newlib/libc/ssp/Makefile.inc       |   3 +
 newlib/libc/stdio/Makefile.am      | 468 ++++++++++++-----------------
 newlib/libc/stdio/Makefile.in      | 104 ++-----
 newlib/libc/stdio/Makefile.inc     |  80 +++++
 newlib/libc/stdio64/Makefile.am    |  18 +-
 newlib/libc/stdio64/Makefile.in    |  21 +-
 newlib/libc/stdio64/Makefile.inc   |  11 +
 newlib/libc/stdlib/Makefile.am     |  58 +---
 newlib/libc/stdlib/Makefile.in     |  68 +----
 newlib/libc/stdlib/Makefile.inc    |  51 ++++
 newlib/libc/string/Makefile.am     |  27 +-
 newlib/libc/string/Makefile.in     |  48 +--
 newlib/libc/string/Makefile.inc    |  22 ++
 newlib/libc/syscalls/Makefile.am   |   4 -
 newlib/libc/syscalls/Makefile.in   |   3 -
 newlib/libc/time/Makefile.am       |  22 +-
 newlib/libc/time/Makefile.in       |  29 +-
 newlib/libc/time/Makefile.inc      |  15 +
 newlib/libc/unix/Makefile.am       |   4 -
 newlib/libc/unix/Makefile.in       |   3 -
 newlib/libc/xdr/Makefile.am        |   4 -
 newlib/libc/xdr/Makefile.in        |   3 -
 63 files changed, 943 insertions(+), 868 deletions(-)
 create mode 100644 newlib/libc/Makefile.inc
 create mode 100644 newlib/libc/ctype/Makefile.inc
 create mode 100644 newlib/libc/iconv/Makefile.inc
 create mode 100644 newlib/libc/iconv/lib/Makefile.inc
 create mode 100644 newlib/libc/locale/Makefile.inc
 create mode 100644 newlib/libc/misc/Makefile.inc
 create mode 100644 newlib/libc/posix/Makefile.inc
 create mode 100644 newlib/libc/reent/Makefile.inc
 create mode 100644 newlib/libc/search/Makefile.inc
 create mode 100644 newlib/libc/signal/Makefile.inc
 create mode 100644 newlib/libc/ssp/Makefile.inc
 create mode 100644 newlib/libc/stdio/Makefile.inc
 create mode 100644 newlib/libc/stdio64/Makefile.inc
 create mode 100644 newlib/libc/stdlib/Makefile.inc
 create mode 100644 newlib/libc/string/Makefile.inc
 create mode 100644 newlib/libc/time/Makefile.inc

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index a4cb965c2af2..99fa0d77f91f 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -524,6 +524,7 @@ endif
 if HAVE_ICONVDATA
 include iconvdata/Makefile.inc
 endif
+include libc/Makefile.inc
 include libm/Makefile.inc
 
 .PHONY: $(PHONY)
diff --git a/newlib/libc/Makefile.inc b/newlib/libc/Makefile.inc
new file mode 100644
index 000000000000..b1caae828201
--- /dev/null
+++ b/newlib/libc/Makefile.inc
@@ -0,0 +1,32 @@
+info_TEXINFOS += %D%/libc.texi
+%C%_libc_TEXINFOS = %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
+
+LIBC_CHEWOUT_FILES =
+
+LIBC_CHAPTERS = %D%/sys.tex
+
+%D%/libc.dvi: %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
+
+%D%/targetdep.tex: $(LIBC_CHAPTERS)
+	$(AM_V_GEN)cat $^ > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(AM_V_at)touch $@
+
+include %D%/ctype/Makefile.inc
+include %D%/iconv/Makefile.inc
+include %D%/locale/Makefile.inc
+include %D%/misc/Makefile.inc
+include %D%/posix/Makefile.inc
+include %D%/reent/Makefile.inc
+include %D%/search/Makefile.inc
+include %D%/signal/Makefile.inc
+include %D%/ssp/Makefile.inc
+include %D%/stdio64/Makefile.inc
+include %D%/stdio/Makefile.inc
+include %D%/stdlib/Makefile.inc
+include %D%/string/Makefile.inc
+include %D%/time/Makefile.inc
+
+CLEANFILES += \
+	%D%/targetdep.tex \
+	$(LIBC_CHEWOUT_FILES)
diff --git a/newlib/libc/argz/Makefile.am b/newlib/libc/argz/Makefile.am
index 0f73cd2b8cfb..a8351b8e20e4 100644
--- a/newlib/libc/argz/Makefile.am
+++ b/newlib/libc/argz/Makefile.am
@@ -41,8 +41,4 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for argz.
-
 include $(srcdir)/../../Makefile.shared
diff --git a/newlib/libc/ctype/Makefile.am b/newlib/libc/ctype/Makefile.am
index 447b7afde2e0..e074e4d7f80e 100644
--- a/newlib/libc/ctype/Makefile.am
+++ b/newlib/libc/ctype/Makefile.am
@@ -95,41 +95,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES= \
-	isalnum.def	\
-	isalpha.def	\
-	isascii.def	\
-	isblank.def	\
-	iscntrl.def	\
-	isdigit.def	\
-	islower.def	\
-	isprint.def	\
-	ispunct.def	\
-	isspace.def	\
-	isupper.def	\
-	iswalnum.def	\
-	iswalpha.def	\
-	iswblank.def 	\
-	iswcntrl.def 	\
-	iswctype.def 	\
-	iswdigit.def 	\
-	iswgraph.def 	\
-	iswlower.def 	\
-	iswprint.def 	\
-	iswpunct.def 	\
-	iswspace.def 	\
-	iswupper.def 	\
-	iswxdigit.def 	\
-	isxdigit.def	\
-	toascii.def	\
-	tolower.def	\
-	toupper.def	\
-	towctrans.def	\
-	towlower.def	\
-	towupper.def	\
-	wctrans.def	\
-	wctype.def
-
-CHAPTERS = ctype.tex
+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/ctype/Makefile.inc b/newlib/libc/ctype/Makefile.inc
new file mode 100644
index 000000000000..8cef16630ac1
--- /dev/null
+++ b/newlib/libc/ctype/Makefile.inc
@@ -0,0 +1,36 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/isalnum.def \
+	%D%/isalpha.def \
+	%D%/isascii.def \
+	%D%/isblank.def \
+	%D%/iscntrl.def \
+	%D%/isdigit.def \
+	%D%/islower.def \
+	%D%/isprint.def \
+	%D%/ispunct.def \
+	%D%/isspace.def \
+	%D%/isupper.def \
+	%D%/iswalnum.def \
+	%D%/iswalpha.def \
+	%D%/iswblank.def \
+	%D%/iswcntrl.def \
+	%D%/iswctype.def \
+	%D%/iswdigit.def \
+	%D%/iswgraph.def \
+	%D%/iswlower.def \
+	%D%/iswprint.def \
+	%D%/iswpunct.def \
+	%D%/iswspace.def \
+	%D%/iswupper.def \
+	%D%/iswxdigit.def \
+	%D%/isxdigit.def \
+	%D%/toascii.def \
+	%D%/tolower.def \
+	%D%/toupper.def \
+	%D%/towctrans.def \
+	%D%/towlower.def \
+	%D%/towupper.def \
+	%D%/wctrans.def \
+	%D%/wctype.def
+
+LIBC_CHAPTERS += %D%/ctype.tex
diff --git a/newlib/libc/errno/Makefile.am b/newlib/libc/errno/Makefile.am
index 77a0b8b83ad8..3470abd0bc1c 100644
--- a/newlib/libc/errno/Makefile.am
+++ b/newlib/libc/errno/Makefile.am
@@ -18,7 +18,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for errno.
diff --git a/newlib/libc/iconv/Makefile.am b/newlib/libc/iconv/Makefile.am
index 4123c7acbcca..83570986116c 100644
--- a/newlib/libc/iconv/Makefile.am
+++ b/newlib/libc/iconv/Makefile.am
@@ -6,28 +6,10 @@ cct_DATA=encoding.aliases
 
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
 
-SUBDEFS = lib/stmp-def
-
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = iconv.def
-CHAPTERS = iconv.tex
-
-iconv.def: lib/iconv.def
-	cp lib/iconv.def iconv.def
-
-iconv.xml: lib/iconv.xml
-	cp lib/iconv.xml iconv.xml
-
-stmp-def: force
-	(cd lib && $(MAKE) doc)
-	touch $@
-
-.PHONY: force
-force:
-
-$(SUBDEFS): stmp-def
-
-lib/iconv.def: $(SUBDEFS); @true
-
-lib/stmp-def: ; @true
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/iconv/Makefile.inc b/newlib/libc/iconv/Makefile.inc
new file mode 100644
index 000000000000..1c331a5fac5b
--- /dev/null
+++ b/newlib/libc/iconv/Makefile.inc
@@ -0,0 +1,3 @@
+LIBC_CHAPTERS += %D%/iconv.tex
+
+include %D%/lib/Makefile.inc
diff --git a/newlib/libc/iconv/ccs/Makefile.am b/newlib/libc/iconv/ccs/Makefile.am
index f87d072b8e70..071b75b8ef4f 100644
--- a/newlib/libc/iconv/ccs/Makefile.am
+++ b/newlib/libc/iconv/ccs/Makefile.am
@@ -45,7 +45,4 @@ noinst_DATA =
 
 SUBDIRS=binary
 
-CHEWOUT_FILES =
-CHAPTERS =
-
 include $(srcdir)/../../../Makefile.shared
diff --git a/newlib/libc/iconv/ces/Makefile.am b/newlib/libc/iconv/ces/Makefile.am
index 21a37b7b8000..9f129c9978b8 100644
--- a/newlib/libc/iconv/ces/Makefile.am
+++ b/newlib/libc/iconv/ces/Makefile.am
@@ -39,6 +39,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
diff --git a/newlib/libc/iconv/iconv.tex b/newlib/libc/iconv/iconv.tex
index 46ced296b907..42d04c0b616f 100644
--- a/newlib/libc/iconv/iconv.tex
+++ b/newlib/libc/iconv/iconv.tex
@@ -21,7 +21,7 @@ The iconv functions declarations are in
 @end menu
 
 @page
-@include iconv/iconv.def
+@include iconv/lib/iconv.def
 
 @page
 @node Introduction to iconv
diff --git a/newlib/libc/iconv/lib/Makefile.am b/newlib/libc/iconv/lib/Makefile.am
index 4e495573a287..0114b2aa3e96 100644
--- a/newlib/libc/iconv/lib/Makefile.am
+++ b/newlib/libc/iconv/lib/Makefile.am
@@ -30,6 +30,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-CHEWOUT_FILES = iconv.def
-CHAPTER =
diff --git a/newlib/libc/iconv/lib/Makefile.inc b/newlib/libc/iconv/lib/Makefile.inc
new file mode 100644
index 000000000000..62a2be87ba5e
--- /dev/null
+++ b/newlib/libc/iconv/lib/Makefile.inc
@@ -0,0 +1 @@
+LIBC_CHEWOUT_FILES += %D%/iconv.def
diff --git a/newlib/libc/locale/Makefile.am b/newlib/libc/locale/Makefile.am
index 1fd2530f7c43..3055d0ceb2be 100644
--- a/newlib/libc/locale/Makefile.am
+++ b/newlib/libc/locale/Makefile.am
@@ -36,11 +36,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	duplocale.def \
-	freelocale.def \
-	locale.def \
-	newlocale.def \
-	uselocale.def
-
-CHAPTERS = locale.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/locale/Makefile.inc b/newlib/libc/locale/Makefile.inc
new file mode 100644
index 000000000000..7af1534c8f96
--- /dev/null
+++ b/newlib/libc/locale/Makefile.inc
@@ -0,0 +1,8 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/duplocale.def \
+	%D%/freelocale.def \
+	%D%/locale.def \
+	%D%/newlocale.def \
+	%D%/uselocale.def
+
+LIBC_CHAPTERS += %D%/locale.tex
diff --git a/newlib/libc/misc/Makefile.am b/newlib/libc/misc/Makefile.am
index da4f90f46815..6d9fefaec06b 100644
--- a/newlib/libc/misc/Makefile.am
+++ b/newlib/libc/misc/Makefile.am
@@ -24,5 +24,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = unctrl.def lock.def ffs.def
-CHAPTERS = misc.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/misc/Makefile.inc b/newlib/libc/misc/Makefile.inc
new file mode 100644
index 000000000000..54a53efff220
--- /dev/null
+++ b/newlib/libc/misc/Makefile.inc
@@ -0,0 +1,6 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/ffs.def \
+	%D%/lock.def \
+	%D%/unctrl.def
+
+LIBC_CHAPTERS += %D%/misc.tex
diff --git a/newlib/libc/posix/Makefile.am b/newlib/libc/posix/Makefile.am
index 5fb1fa2afa1c..984ae7fb5ac0 100644
--- a/newlib/libc/posix/Makefile.am
+++ b/newlib/libc/posix/Makefile.am
@@ -49,10 +49,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	popen.def \
-	posix_spawn.def
-
-CHAPTERS = posix.tex
+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/posix/Makefile.inc b/newlib/libc/posix/Makefile.inc
new file mode 100644
index 000000000000..74539dddbe72
--- /dev/null
+++ b/newlib/libc/posix/Makefile.inc
@@ -0,0 +1,5 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/popen.def \
+	%D%/posix_spawn.def
+
+LIBC_CHAPTERS += %D%/posix.tex
diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am
index 622a74c82cea..dad7efdbeb41 100644
--- a/newlib/libc/reent/Makefile.am
+++ b/newlib/libc/reent/Makefile.am
@@ -61,30 +61,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	closer.def \
-	reent.def \
-	execr.def \
-	fcntlr.def \
-	fstat64r.def \
-	fstatr.def \
-	gettimeofdayr.def \
-	linkr.def \
-	lseek64r.def \
-	lseekr.def \
-	mkdirr.def \
-	open64r.def \
-	openr.def \
-	readr.def \
-	renamer.def \
-	signalr.def \
-	sbrkr.def \
-	stat64r.def \
-	statr.def \
-	timesr.def \
-	unlinkr.def \
-	writer.def
-
-CHAPTERS = reent.tex
+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/reent/Makefile.inc b/newlib/libc/reent/Makefile.inc
new file mode 100644
index 000000000000..975a8d82a83a
--- /dev/null
+++ b/newlib/libc/reent/Makefile.inc
@@ -0,0 +1,25 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/closer.def \
+	%D%/reent.def \
+	%D%/execr.def \
+	%D%/fcntlr.def \
+	%D%/fstatr.def \
+	%D%/gettimeofdayr.def \
+	%D%/linkr.def \
+	%D%/lseekr.def \
+	%D%/mkdirr.def \
+	%D%/openr.def \
+	%D%/readr.def \
+	%D%/renamer.def \
+	%D%/signalr.def \
+	%D%/sbrkr.def \
+	%D%/statr.def \
+	%D%/timesr.def \
+	%D%/unlinkr.def \
+	%D%/fstat64r.def \
+	%D%/lseek64r.def \
+	%D%/stat64r.def \
+	%D%/open64r.def \
+	%D%/writer.def
+
+LIBC_CHAPTERS += %D%/reent.tex
diff --git a/newlib/libc/search/Makefile.am b/newlib/libc/search/Makefile.am
index 5c5e0dcf6264..eedb2bad6cb2 100644
--- a/newlib/libc/search/Makefile.am
+++ b/newlib/libc/search/Makefile.am
@@ -61,11 +61,10 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES = \
-	bsearch.def \
-	qsort.def \
-	qsort_r.def
-
-CHAPTERS =
-
 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/search/Makefile.inc b/newlib/libc/search/Makefile.inc
new file mode 100644
index 000000000000..a1704539b04c
--- /dev/null
+++ b/newlib/libc/search/Makefile.inc
@@ -0,0 +1,4 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/bsearch.def \
+	%D%/qsort.def \
+	%D%/qsort_r.def
diff --git a/newlib/libc/signal/Makefile.am b/newlib/libc/signal/Makefile.am
index 4b5bc209ca26..fdcd17d7e10b 100644
--- a/newlib/libc/signal/Makefile.am
+++ b/newlib/libc/signal/Makefile.am
@@ -19,6 +19,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = psignal.def raise.def signal.def sig2str.def
-
-CHAPTERS = signal.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/signal/Makefile.inc b/newlib/libc/signal/Makefile.inc
new file mode 100644
index 000000000000..e0da75349a18
--- /dev/null
+++ b/newlib/libc/signal/Makefile.inc
@@ -0,0 +1,7 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/psignal.def \
+	%D%/raise.def \
+	%D%/signal.def \
+	%D%/sig2str.def
+
+LIBC_CHAPTERS += %D%/signal.tex
diff --git a/newlib/libc/ssp/Makefile.am b/newlib/libc/ssp/Makefile.am
index 937741cd62d2..da5573202f04 100644
--- a/newlib/libc/ssp/Makefile.am
+++ b/newlib/libc/ssp/Makefile.am
@@ -61,7 +61,10 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS = ssp.tex
-
 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.inc b/newlib/libc/ssp/Makefile.inc
new file mode 100644
index 000000000000..e87115b50025
--- /dev/null
+++ b/newlib/libc/ssp/Makefile.inc
@@ -0,0 +1,3 @@
+LIBC_CHEWOUT_FILES +=
+
+LIBC_CHAPTERS += %D%/ssp.tex
diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am
index 30339033c8f6..c8d5f010fbe1 100644
--- a/newlib/libc/stdio/Makefile.am
+++ b/newlib/libc/stdio/Makefile.am
@@ -6,91 +6,91 @@ if NEWLIB_NANO_FORMATTED_IO
 GENERAL_INT_FORMATTED_IO_SOURCES =
 else
 GENERAL_INT_FORMATTED_IO_SOURCES = \
-	fiprintf.c			\
-	fiscanf.c			\
-	iprintf.c			\
-	iscanf.c			\
-	siprintf.c			\
-	siscanf.c			\
-	sniprintf.c			\
-	vdiprintf.c			\
-	vfprintf.c			\
-	vfwprintf.c			\
-	viprintf.c			\
-	viscanf.c			\
-	vsiprintf.c			\
-	vsiscanf.c			\
-	vsniprintf.c
+	%D%/fiprintf.c			\
+	%D%/fiscanf.c			\
+	%D%/iprintf.c			\
+	%D%/iscanf.c			\
+	%D%/siprintf.c			\
+	%D%/siscanf.c			\
+	%D%/sniprintf.c			\
+	%D%/vdiprintf.c			\
+	%D%/vfprintf.c			\
+	%D%/vfwprintf.c			\
+	%D%/viprintf.c			\
+	%D%/viscanf.c			\
+	%D%/vsiprintf.c			\
+	%D%/vsiscanf.c			\
+	%D%/vsniprintf.c
 endif
 
 GENERAL_SOURCES = \
-	$(GENERAL_INT_FORMATTED_IO_SOURCES) \
-	clearerr.c			\
-	fclose.c			\
-	fdopen.c			\
-	feof.c				\
-	ferror.c			\
-	fflush.c			\
-	fgetc.c			\
-	fgetpos.c			\
-	fgets.c			\
-	fileno.c			\
-	findfp.c			\
-	flags.c			\
-	fopen.c			\
-	fprintf.c			\
-	fputc.c			\
-	fputs.c			\
-	fread.c			\
-	freopen.c			\
-	fscanf.c			\
-	fseek.c			\
-	fsetpos.c			\
-	ftell.c			\
-	fvwrite.c			\
-	fwalk.c			\
-	fwrite.c			\
-	getc.c				\
-	getchar.c			\
-	getc_u.c			\
-	getchar_u.c			\
-	getdelim.c			\
-	getline.c			\
-	gets.c				\
-	makebuf.c			\
-	perror.c			\
-	printf.c			\
-	putc.c				\
-	putchar.c			\
-	putc_u.c			\
-	putchar_u.c			\
-	puts.c				\
-	refill.c			\
-	remove.c			\
-	rename.c			\
-	rewind.c			\
-	rget.c				\
-	scanf.c			\
-	sccl.c				\
-	setbuf.c			\
-	setbuffer.c			\
-	setlinebuf.c			\
-	setvbuf.c			\
-	snprintf.c			\
-	sprintf.c			\
-	sscanf.c			\
-	stdio.c			\
-	tmpfile.c			\
-	tmpnam.c			\
-	ungetc.c			\
-	vdprintf.c			\
-	vprintf.c			\
-	vscanf.c			\
-	vsnprintf.c			\
-	vsprintf.c			\
-	vsscanf.c			\
-	wbuf.c				\
-	wsetup.c
+	%D%/$(GENERAL_INT_FORMATTED_IO_SOURCES) \
+	%D%/clearerr.c			\
+	%D%/fclose.c			\
+	%D%/fdopen.c			\
+	%D%/feof.c				\
+	%D%/ferror.c			\
+	%D%/fflush.c			\
+	%D%/fgetc.c			\
+	%D%/fgetpos.c			\
+	%D%/fgets.c			\
+	%D%/fileno.c			\
+	%D%/findfp.c			\
+	%D%/flags.c			\
+	%D%/fopen.c			\
+	%D%/fprintf.c			\
+	%D%/fputc.c			\
+	%D%/fputs.c			\
+	%D%/fread.c			\
+	%D%/freopen.c			\
+	%D%/fscanf.c			\
+	%D%/fseek.c			\
+	%D%/fsetpos.c			\
+	%D%/ftell.c			\
+	%D%/fvwrite.c			\
+	%D%/fwalk.c			\
+	%D%/fwrite.c			\
+	%D%/getc.c				\
+	%D%/getchar.c			\
+	%D%/getc_u.c			\
+	%D%/getchar_u.c			\
+	%D%/getdelim.c			\
+	%D%/getline.c			\
+	%D%/gets.c				\
+	%D%/makebuf.c			\
+	%D%/perror.c			\
+	%D%/printf.c			\
+	%D%/putc.c				\
+	%D%/putchar.c			\
+	%D%/putc_u.c			\
+	%D%/putchar_u.c			\
+	%D%/puts.c				\
+	%D%/refill.c			\
+	%D%/remove.c			\
+	%D%/rename.c			\
+	%D%/rewind.c			\
+	%D%/rget.c				\
+	%D%/scanf.c			\
+	%D%/sccl.c				\
+	%D%/setbuf.c			\
+	%D%/setbuffer.c			\
+	%D%/setlinebuf.c			\
+	%D%/setvbuf.c			\
+	%D%/snprintf.c			\
+	%D%/sprintf.c			\
+	%D%/sscanf.c			\
+	%D%/stdio.c			\
+	%D%/tmpfile.c			\
+	%D%/tmpnam.c			\
+	%D%/ungetc.c			\
+	%D%/vdprintf.c			\
+	%D%/vprintf.c			\
+	%D%/vscanf.c			\
+	%D%/vsnprintf.c			\
+	%D%/vsprintf.c			\
+	%D%/vsscanf.c			\
+	%D%/wbuf.c				\
+	%D%/wsetup.c
 
 ## The following are EL/IX level 2 interfaces
 if ELIX_LEVEL_1
@@ -100,20 +100,20 @@ if NEWLIB_NANO_FORMATTED_IO
 ELIX_2_INT_FORMATTED_IO_SOURCES =
 else
 ELIX_2_INT_FORMATTED_IO_SOURCES = \
-	asiprintf.c		\
-	vasiprintf.c
+	%D%/asiprintf.c		\
+	%D%/vasiprintf.c
 
 endif !NEWLIB_NANO_FORMATTED_IO
 ELIX_2_SOURCES = \
-	$(ELIX_2_INT_FORMATTED_IO_SOURCES) \
-	asprintf.c		\
-	fcloseall.c		\
-	fseeko.c		\
-	ftello.c		\
-	getw.c			\
-	mktemp.c		\
-	putw.c			\
-	vasprintf.c
+	%D%/$(ELIX_2_INT_FORMATTED_IO_SOURCES) \
+	%D%/asprintf.c		\
+	%D%/fcloseall.c		\
+	%D%/fseeko.c		\
+	%D%/ftello.c		\
+	%D%/getw.c			\
+	%D%/mktemp.c		\
+	%D%/putw.c			\
+	%D%/vasprintf.c
 endif !ELIX_LEVEL_1
 
 ## The following are EL/IX level 2 interfaces
@@ -130,62 +130,62 @@ if NEWLIB_NANO_FORMATTED_IO
 ELIX_4_INT_FORMATTED_IO_SOURCES =
 else
 ELIX_4_INT_FORMATTED_IO_SOURCES = \
-	asniprintf.c		\
-	diprintf.c		\
-	vasniprintf.c
+	%D%/asniprintf.c		\
+	%D%/diprintf.c		\
+	%D%/vasniprintf.c
 
 endif !NEWLIB_NANO_FORMATTED_IO
 ELIX_4_SOURCES = \
-	$(ELIX_4_INT_FORMATTED_IO_SOURCES) \
-	asnprintf.c		\
-	clearerr_u.c		\
-	dprintf.c		\
-	feof_u.c		\
-	ferror_u.c		\
-	fflush_u.c		\
-	fgetc_u.c		\
-	fgets_u.c		\
-	fgetwc.c		\
-	fgetwc_u.c		\
-	fgetws.c		\
-	fgetws_u.c		\
-	fileno_u.c		\
-	fmemopen.c		\
-	fopencookie.c		\
-	fpurge.c		\
-	fputc_u.c		\
-	fputs_u.c		\
-	fputwc.c		\
-	fputwc_u.c		\
-	fputws.c		\
-	fputws_u.c		\
-	fread_u.c		\
-	fsetlocking.c		\
-	funopen.c		\
-	fwide.c			\
-	fwprintf.c		\
-	fwrite_u.c		\
-	fwscanf.c		\
-	getwc.c			\
-	getwc_u.c		\
-	getwchar.c		\
-	getwchar_u.c		\
-	open_memstream.c	\
-	putwc.c			\
-	putwc_u.c		\
-	putwchar.c		\
-	putwchar_u.c		\
-	stdio_ext.c		\
-	swprintf.c		\
-	swscanf.c		\
-	ungetwc.c		\
-	vasnprintf.c		\
-	vswprintf.c		\
-	vswscanf.c		\
-	vwprintf.c		\
-	vwscanf.c		\
-	wprintf.c		\
-	wscanf.c
+	%D%/$(ELIX_4_INT_FORMATTED_IO_SOURCES) \
+	%D%/asnprintf.c		\
+	%D%/clearerr_u.c		\
+	%D%/dprintf.c		\
+	%D%/feof_u.c		\
+	%D%/ferror_u.c		\
+	%D%/fflush_u.c		\
+	%D%/fgetc_u.c		\
+	%D%/fgets_u.c		\
+	%D%/fgetwc.c		\
+	%D%/fgetwc_u.c		\
+	%D%/fgetws.c		\
+	%D%/fgetws_u.c		\
+	%D%/fileno_u.c		\
+	%D%/fmemopen.c		\
+	%D%/fopencookie.c		\
+	%D%/fpurge.c		\
+	%D%/fputc_u.c		\
+	%D%/fputs_u.c		\
+	%D%/fputwc.c		\
+	%D%/fputwc_u.c		\
+	%D%/fputws.c		\
+	%D%/fputws_u.c		\
+	%D%/fread_u.c		\
+	%D%/fsetlocking.c		\
+	%D%/funopen.c		\
+	%D%/fwide.c			\
+	%D%/fwprintf.c		\
+	%D%/fwrite_u.c		\
+	%D%/fwscanf.c		\
+	%D%/getwc.c			\
+	%D%/getwc_u.c		\
+	%D%/getwchar.c		\
+	%D%/getwchar_u.c		\
+	%D%/open_memstream.c	\
+	%D%/putwc.c			\
+	%D%/putwc_u.c		\
+	%D%/putwchar.c		\
+	%D%/putwchar_u.c		\
+	%D%/stdio_ext.c		\
+	%D%/swprintf.c		\
+	%D%/swscanf.c		\
+	%D%/ungetwc.c		\
+	%D%/vasnprintf.c		\
+	%D%/vswprintf.c		\
+	%D%/vswscanf.c		\
+	%D%/vwprintf.c		\
+	%D%/vwscanf.c		\
+	%D%/wprintf.c		\
+	%D%/wscanf.c
 
 endif !ELIX_LEVEL_3
 endif !ELIX_LEVEL_2
@@ -193,31 +193,31 @@ endif !ELIX_LEVEL_1
 
 if NEWLIB_NANO_FORMATTED_IO
 LIBADD_OBJS = \
-	$(lpfx)nano-vfprintf_float.$(oext)	\
-	$(lpfx)nano-svfprintf.$(oext)		\
-	$(lpfx)nano-svfscanf.$(oext)		\
-	$(lpfx)nano-vfprintf.$(oext)		\
-	$(lpfx)nano-vfprintf_i.$(oext)		\
-	$(lpfx)nano-vfscanf.$(oext)		\
-	$(lpfx)nano-vfscanf_i.$(oext)		\
-	$(lpfx)nano-vfscanf_float.$(oext)	\
-	$(lpfx)svfiwprintf.$(oext)		\
-	$(lpfx)svfwprintf.$(oext)		\
-	$(lpfx)vfiwprintf.$(oext)		\
-	$(lpfx)svfiwscanf.$(oext)		\
-	$(lpfx)svfwscanf.$(oext)		\
-	$(lpfx)vfiwscanf.$(oext)		\
-	$(lpfx)vfwscanf.$(oext)
+	%D%/$(lpfx)nano-vfprintf_float.$(oext)	\
+	%D%/$(lpfx)nano-svfprintf.$(oext)		\
+	%D%/$(lpfx)nano-svfscanf.$(oext)		\
+	%D%/$(lpfx)nano-vfprintf.$(oext)		\
+	%D%/$(lpfx)nano-vfprintf_i.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf_i.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf_float.$(oext)	\
+	%D%/$(lpfx)svfiwprintf.$(oext)		\
+	%D%/$(lpfx)svfwprintf.$(oext)		\
+	%D%/$(lpfx)vfiwprintf.$(oext)		\
+	%D%/$(lpfx)svfiwscanf.$(oext)		\
+	%D%/$(lpfx)svfwscanf.$(oext)		\
+	%D%/$(lpfx)vfiwscanf.$(oext)		\
+	%D%/$(lpfx)vfwscanf.$(oext)
 else
 LIBADD_OBJS = \
-	$(lpfx)svfiprintf.$(oext) $(lpfx)svfprintf.$(oext) \
-	$(lpfx)svfiscanf.$(oext) $(lpfx)svfscanf.$(oext) \
-	$(lpfx)vfiprintf.$(oext) \
-	$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext) \
-	$(lpfx)svfiwprintf.$(oext) $(lpfx)svfwprintf.$(oext) \
-	$(lpfx)vfiwprintf.$(oext) \
-	$(lpfx)svfiwscanf.$(oext) $(lpfx)svfwscanf.$(oext) \
-	$(lpfx)vfiwscanf.$(oext) $(lpfx)vfwscanf.$(oext)
+	%D%/$(lpfx)svfiprintf.$(oext) $(lpfx)svfprintf.$(oext) \
+	%D%/$(lpfx)svfiscanf.$(oext) $(lpfx)svfscanf.$(oext) \
+	%D%/$(lpfx)vfiprintf.$(oext) \
+	%D%/$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext) \
+	%D%/$(lpfx)svfiwprintf.$(oext) $(lpfx)svfwprintf.$(oext) \
+	%D%/$(lpfx)vfiwprintf.$(oext) \
+	%D%/$(lpfx)svfiwscanf.$(oext) $(lpfx)svfwscanf.$(oext) \
+	%D%/$(lpfx)vfiwscanf.$(oext) $(lpfx)vfwscanf.$(oext)
 endif
 
 libstdio_la_LDFLAGS = -Xcompiler -nostdlib
@@ -241,6 +241,11 @@ 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
@@ -252,158 +257,77 @@ include $(srcdir)/../../Makefile.shared
 if NEWLIB_NANO_FORMATTED_IO
 # Rules compiling small-footprint nano-formatted-io implementation.
 $(lpfx)nano-vfprintf.$(oext): nano-vfprintf.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf.c -o $@
 
 $(lpfx)nano-vfprintf_i.$(oext): nano-vfprintf_i.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_i.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_i.c -o $@
 
 $(lpfx)nano-vfprintf_float.$(oext): nano-vfprintf_float.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_float.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_float.c -o $@
 
 $(lpfx)nano-svfprintf.$(oext): nano-vfprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfprintf.c -o $@
 endif
 
 # This rule is needed so that libtool compiles vfiprintf before vfprintf.
 # Otherwise libtool moves vfprintf.o and subsequently can't find it.
 
 $(lpfx)vfiprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)svfprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)svfiprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)vfiwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 $(lpfx)svfwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 $(lpfx)svfiwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 if NEWLIB_NANO_FORMATTED_IO
 # Rules compiling small-footprint nano-formatted-io implementation.
 $(lpfx)nano-vfscanf.$(oext): nano-vfscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf.c -o $@
 
 $(lpfx)nano-vfscanf_i.$(oext): nano-vfscanf_i.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_i.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_i.c -o $@
 
 $(lpfx)nano-vfscanf_float.$(oext): nano-vfscanf_float.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_float.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_float.c -o $@
 
 $(lpfx)nano-svfscanf.$(oext): nano-vfscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfscanf.c -o $@
 endif
 
 $(lpfx)vfscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)vfiscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)svfscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)svfiscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)vfwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)vfiwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)svfwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)svfiwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
-
-CHEWOUT_FILES = \
-	clearerr.def		\
-	diprintf.def		\
-	dprintf.def		\
-	fclose.def		\
-	fcloseall.def		\
-	fdopen.def		\
-	feof.def		\
-	ferror.def		\
-	fflush.def		\
-	fgetc.def		\
-	fgetpos.def		\
-	fgets.def		\
-	fgetwc.def		\
-	fgetws.def		\
-	fileno.def		\
-	fmemopen.def		\
-	fopen.def		\
-	fopencookie.def		\
-	fpurge.def		\
-	fputc.def		\
-	fputs.def		\
-	fputwc.def		\
-	fputws.def		\
-	fread.def		\
-	freopen.def		\
-	fseek.def		\
-	fsetlocking.def		\
-	fsetpos.def		\
-	ftell.def		\
-	funopen.def		\
-	fwide.def		\
-	fwrite.def		\
-	getc.def		\
-	getc_u.def		\
-	getchar.def		\
-	getchar_u.def		\
-	getdelim.def		\
-	getline.def		\
-	gets.def		\
-	getw.def		\
-	getwchar.def		\
-	mktemp.def		\
-	nano-vfprintf.def	\
-	nano-vfscanf.def	\
-	open_memstream.def	\
-	perror.def		\
-	putc.def		\
-	putc_u.def		\
-	putchar.def		\
-	putchar_u.def		\
-	puts.def		\
-	putw.def		\
-	putwchar.def		\
-	remove.def		\
-	rename.def		\
-	rewind.def		\
-	setbuf.def		\
-	setbuffer.def		\
-	setlinebuf.def		\
-	setvbuf.def		\
-	siprintf.def		\
-	siscanf.def		\
-	sprintf.def		\
-	sscanf.def		\
-	stdio_ext.def		\
-	swprintf.def		\
-	swscanf.def		\
-	tmpfile.def		\
-	tmpnam.def		\
-	ungetc.def		\
-	ungetwc.def		\
-	vfprintf.def		\
-	vfscanf.def		\
-	vfwprintf.def		\
-	vfwscanf.def		\
-	viprintf.def		\
-	viscanf.def
-
-CHAPTERS = stdio.tex
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)clearerr.$(oext): local.h
 $(lpfx)clearerr_u.$(oext): local.h
diff --git a/newlib/libc/stdio/Makefile.inc b/newlib/libc/stdio/Makefile.inc
new file mode 100644
index 000000000000..2e1b8c416ddf
--- /dev/null
+++ b/newlib/libc/stdio/Makefile.inc
@@ -0,0 +1,80 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/clearerr.def \
+	%D%/diprintf.def \
+	%D%/dprintf.def \
+	%D%/fcloseall.def \
+	%D%/fclose.def \
+	%D%/fdopen.def \
+	%D%/feof.def \
+	%D%/ferror.def \
+	%D%/fflush.def \
+	%D%/fgetc.def \
+	%D%/fgetpos.def \
+	%D%/fgets.def \
+	%D%/fgetwc.def \
+	%D%/fgetws.def \
+	%D%/fileno.def \
+	%D%/fmemopen.def \
+	%D%/fopen.def \
+	%D%/fopencookie.def \
+	%D%/fpurge.def \
+	%D%/fputc.def \
+	%D%/fputs.def \
+	%D%/fputwc.def \
+	%D%/fputws.def \
+	%D%/fread.def \
+	%D%/freopen.def \
+	%D%/fseek.def \
+	%D%/fsetlocking.def \
+	%D%/fsetpos.def \
+	%D%/ftell.def \
+	%D%/funopen.def \
+	%D%/fwide.def \
+	%D%/fwrite.def \
+	%D%/getc.def \
+	%D%/getc_u.def \
+	%D%/getchar.def \
+	%D%/getchar_u.def \
+	%D%/getdelim.def \
+	%D%/getline.def \
+	%D%/gets.def \
+	%D%/getw.def \
+	%D%/getwchar.def \
+	%D%/mktemp.def \
+	%D%/nano-vfprintf.def \
+	%D%/nano-vfscanf.def \
+	%D%/open_memstream.def \
+	%D%/perror.def \
+	%D%/putc.def \
+	%D%/putc_u.def \
+	%D%/putchar.def \
+	%D%/putchar_u.def \
+	%D%/puts.def \
+	%D%/putw.def \
+	%D%/putwchar.def \
+	%D%/remove.def \
+	%D%/rename.def \
+	%D%/rewind.def \
+	%D%/setbuf.def \
+	%D%/setbuffer.def \
+	%D%/setlinebuf.def \
+	%D%/setvbuf.def \
+	%D%/siprintf.def \
+	%D%/siscanf.def \
+	%D%/sprintf.def \
+	%D%/sscanf.def \
+	%D%/stdio_ext.def \
+	%D%/swprintf.def \
+	%D%/swscanf.def \
+	%D%/tmpfile.def \
+	%D%/tmpnam.def \
+	%D%/ungetc.def \
+	%D%/ungetwc.def \
+	%D%/vfprintf.def \
+	%D%/vfscanf.def \
+	%D%/vfwprintf.def \
+	%D%/vfwscanf.def \
+	%D%/viprintf.def \
+	%D%/viscanf.def
+
+LIBC_CHAPTERS += %D%/stdio.tex
diff --git a/newlib/libc/stdio64/Makefile.am b/newlib/libc/stdio64/Makefile.am
index 074107e0c5ae..56ddbe31f052 100644
--- a/newlib/libc/stdio64/Makefile.am
+++ b/newlib/libc/stdio64/Makefile.am
@@ -38,16 +38,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-AM_CFLAGS = -I $(srcdir)/../stdio
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
-CHEWOUT_FILES = \
-	fdopen64.def		\
-	fgetpos64.def		\
-	fopen64.def		\
-	freopen64.def		\
-	fseeko64.def		\
-	fsetpos64.def		\
-	ftello64.def		\
-	tmpfile64.def
-
-CHAPTERS = stdio64.tex
+AM_CFLAGS = -I $(srcdir)/../stdio
diff --git a/newlib/libc/stdio64/Makefile.inc b/newlib/libc/stdio64/Makefile.inc
new file mode 100644
index 000000000000..bfe252766f81
--- /dev/null
+++ b/newlib/libc/stdio64/Makefile.inc
@@ -0,0 +1,11 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/fdopen64.def \
+	%D%/fgetpos64.def \
+	%D%/fopen64.def \
+	%D%/freopen64.def \
+	%D%/fseeko64.def \
+	%D%/fsetpos64.def \
+	%D%/ftello64.def \
+	%D%/tmpfile64.def
+
+LIBC_CHAPTERS += %D%/stdio64.tex
diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am
index f0e3b0003915..b88aee40b9f9 100644
--- a/newlib/libc/stdlib/Makefile.am
+++ b/newlib/libc/stdlib/Makefile.am
@@ -222,6 +222,12 @@ 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
@@ -260,58 +266,6 @@ $(lpfx)$(MSIZER).$(oext): $(MALLOCR).c
 $(lpfx)$(MALLOPTR).$(oext): $(MALLOCR).c
 	$(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@
 
-CHEWOUT_FILES= \
-	_Exit.def	\
-	a64l.def	\
-	abort.def	\
-	abs.def		\
-	assert.def	\
-	atexit.def	\
-	atof.def 	\
-	atoi.def 	\
-	atoll.def 	\
-	calloc.def	\
-	div.def		\
-	ecvtbuf.def	\
-	efgcvt.def 	\
-	envlock.def	\
-	exit.def	\
-	getenv.def	\
-	itoa.def	\
-	labs.def	\
-	ldiv.def	\
-	llabs.def	\
-	lldiv.def	\
-	malloc.def	\
-	mblen.def	\
-	mbsnrtowcs.def	\
-	mbstowcs.def	\
-	mbtowc.def	\
-	mlock.def	\
-	mstats.def	\
-	on_exit.def	\
-	rand.def	\
-	rand48.def	\
-	random.def	\
-	rpmatch.def	\
-	strtod.def 	\
-	strtol.def 	\
-	strtoll.def 	\
-	strtoul.def 	\
-	strtoull.def 	\
-	utoa.def	\
-	wcsnrtombs.def	\
-	wcstod.def 	\
-	wcstol.def 	\
-	wcstoll.def 	\
-	wcstoul.def 	\
-	wcstoull.def 	\
-	system.def	\
-	wcstombs.def	\
-	wctomb.def	
-
-CHAPTERS = stdlib.tex
-
 $(lpfx)dtoa.$(oext): dtoa.c mprec.h
 $(lpfx)ldtoa.$(oext): ldtoa.c mprec.h gdtoa.h
 $(lpfx)gdtoa-ldtoa.$(oext): gdtoa-ldtoa.c mprec.h gdtoaimp.h gdtoa.h
diff --git a/newlib/libc/stdlib/Makefile.inc b/newlib/libc/stdlib/Makefile.inc
new file mode 100644
index 000000000000..d2f199d8cab3
--- /dev/null
+++ b/newlib/libc/stdlib/Makefile.inc
@@ -0,0 +1,51 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/_Exit.def \
+	%D%/a64l.def \
+	%D%/abort.def \
+	%D%/abs.def \
+	%D%/assert.def \
+	%D%/atexit.def \
+	%D%/atof.def \
+	%D%/atoi.def \
+	%D%/atoll.def \
+	%D%/calloc.def \
+	%D%/div.def \
+	%D%/ecvtbuf.def \
+	%D%/efgcvt.def \
+	%D%/envlock.def \
+	%D%/exit.def \
+	%D%/getenv.def \
+	%D%/itoa.def \
+	%D%/labs.def \
+	%D%/ldiv.def \
+	%D%/llabs.def \
+	%D%/lldiv.def \
+	%D%/malloc.def \
+	%D%/mblen.def \
+	%D%/mbsnrtowcs.def \
+	%D%/mbstowcs.def \
+	%D%/mbtowc.def \
+	%D%/mlock.def \
+	%D%/mstats.def \
+	%D%/on_exit.def \
+	%D%/rand.def \
+	%D%/rand48.def \
+	%D%/random.def \
+	%D%/rpmatch.def \
+	%D%/strtod.def \
+	%D%/strtol.def \
+	%D%/strtoll.def \
+	%D%/strtoul.def \
+	%D%/strtoull.def \
+	%D%/utoa.def \
+	%D%/wcsnrtombs.def \
+	%D%/wcstod.def \
+	%D%/wcstol.def \
+	%D%/wcstoll.def \
+	%D%/wcstoul.def \
+	%D%/wcstoull.def \
+	%D%/system.def \
+	%D%/wcstombs.def \
+	%D%/wctomb.def
+
+LIBC_CHAPTERS += %D%/stdlib.tex
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
index 7eb9fcdbcf6a..d85a51365c34 100644
--- a/newlib/libc/string/Makefile.am
+++ b/newlib/libc/string/Makefile.am
@@ -144,25 +144,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES=\
-bcmp.def	memcpy.def	strcmp.def	strncat.def strstr.def \
-bcopy.def	memmove.def	strcoll.def	strncmp.def strtok.def \
-bzero.def	memset.def	strcpy.def	strncpy.def strxfrm.def \
-index.def	rindex.def	strcspn.def	strpbrk.def swab.def \
-memchr.def	strcat.def	strerror.def	strerror_r.def strrchr.def \
-memcmp.def	strchr.def	strlen.def	strnlen.def strspn.def \
-strcasecmp.def	strncasecmp.def strcasestr.def	strlwr.def  strupr.def \
-memccpy.def 	mempcpy.def	stpcpy.def	stpncpy.def strsignal.def \
-wcscasecmp.def	wcscat.def	wcschr.def	wcscmp.def wcscoll.def \
-wcscpy.def	wcscspn.def	wcpcpy.def	wcpncpy.def wcsdup.def \
-wcslcat.def	wcslcpy.def	wcslen.def	wcsncasecmp.def wcsncat.def \
-wcsncmp.def	wcsncpy.def	wcsnlen.def	wcspbrk.def \
-wcsrchr.def	wcsspn.def	wcsstr.def 	wcstok.def  \
-wcswidth.def	wcsxfrm.def	wcwidth.def	wmemchr.def \
-wmemcmp.def	wmemcpy.def	wmemmove.def	wmemset.def \
-memmem.def	memrchr.def	rawmemchr.def	strchrnul.def \
-strcasecmp_l.def strcoll_l.def	strncasecmp_l.def strxfrm_l.def \
-wcscasecmp_l.def wcscoll_l.def	wcsncasecmp_l.def wcsxfrm_l.def \
-strverscmp.def	strnstr.def	wmempcpy.def
-
-CHAPTERS = strings.tex wcstrings.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/string/Makefile.inc b/newlib/libc/string/Makefile.inc
new file mode 100644
index 000000000000..5bcec8dd4ca6
--- /dev/null
+++ b/newlib/libc/string/Makefile.inc
@@ -0,0 +1,22 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/bcmp.def	%D%/memcpy.def	%D%/strcmp.def	%D%/strncat.def %D%/strstr.def \
+	%D%/bcopy.def	%D%/memmove.def	%D%/strcoll.def	%D%/strncmp.def %D%/strtok.def \
+	%D%/bzero.def	%D%/memset.def	%D%/strcpy.def	%D%/strncpy.def %D%/strxfrm.def \
+	%D%/index.def	%D%/rindex.def	%D%/strcspn.def	%D%/strpbrk.def %D%/swab.def \
+	%D%/memchr.def	%D%/strcat.def	%D%/strerror.def	%D%/strerror_r.def %D%/strrchr.def \
+	%D%/memcmp.def	%D%/strchr.def	%D%/strlen.def	%D%/strnlen.def %D%/strspn.def \
+	%D%/strcasecmp.def	%D%/strncasecmp.def %D%/strcasestr.def	%D%/strlwr.def  %D%/strupr.def \
+	%D%/memccpy.def 	%D%/mempcpy.def	%D%/stpcpy.def	%D%/stpncpy.def %D%/strsignal.def \
+	%D%/wcscasecmp.def	%D%/wcscat.def	%D%/wcschr.def	%D%/wcscmp.def %D%/wcscoll.def \
+	%D%/wcscpy.def	%D%/wcscspn.def	%D%/wcpcpy.def	%D%/wcpncpy.def %D%/wcsdup.def \
+	%D%/wcslcat.def	%D%/wcslcpy.def	%D%/wcslen.def	%D%/wcsncasecmp.def %D%/wcsncat.def \
+	%D%/wcsncmp.def	%D%/wcsncpy.def	%D%/wcsnlen.def	%D%/wcspbrk.def \
+	%D%/wcsrchr.def	%D%/wcsspn.def	%D%/wcsstr.def 	%D%/wcstok.def  \
+	%D%/wcswidth.def	%D%/wcsxfrm.def	%D%/wcwidth.def	%D%/wmemchr.def \
+	%D%/wmemcmp.def	%D%/wmemcpy.def	%D%/wmemmove.def	%D%/wmemset.def \
+	%D%/memmem.def	%D%/memrchr.def	%D%/rawmemchr.def	%D%/strchrnul.def \
+	%D%/strcasecmp_l.def %D%/strcoll_l.def	%D%/strncasecmp_l.def %D%/strxfrm_l.def \
+	%D%/wcscasecmp_l.def %D%/wcscoll_l.def	%D%/wcsncasecmp_l.def %D%/wcsxfrm_l.def \
+	%D%/strverscmp.def	%D%/strnstr.def	%D%/wmempcpy.def
+
+LIBC_CHAPTERS += %D%/strings.tex %D%/wcstrings.tex
diff --git a/newlib/libc/syscalls/Makefile.am b/newlib/libc/syscalls/Makefile.am
index 5895be430929..ada372a7aa1c 100644
--- a/newlib/libc/syscalls/Makefile.am
+++ b/newlib/libc/syscalls/Makefile.am
@@ -49,7 +49,3 @@ noinst_DATA =
 endif
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for syscalls.
diff --git a/newlib/libc/time/Makefile.am b/newlib/libc/time/Makefile.am
index 8871d1afb41f..e9dcee44c4c7 100644
--- a/newlib/libc/time/Makefile.am
+++ b/newlib/libc/time/Makefile.am
@@ -42,20 +42,10 @@ endif # USE_LIBTOOL
 # This rule is needed so that wcsftime.o is rebuilt when strftime.c changes.
 include $(srcdir)/../../Makefile.shared
 
-$(lpfx)wcsftime.$(oext): strftime.c
-
-CHEWOUT_FILES = \
-	asctime.def	\
-	clock.def 	\
-	ctime.def	\
-	difftime.def	\
-	gmtime.def	\
-	lcltime.def	\
-	mktime.def	\
-	strftime.def	\
-	time.def	\
-	tzlock.def	\
-	tzset.def	\
-	wcsftime.def
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
-CHAPTERS = time.tex
+$(lpfx)wcsftime.$(oext): strftime.c
diff --git a/newlib/libc/time/Makefile.inc b/newlib/libc/time/Makefile.inc
new file mode 100644
index 000000000000..3e7ba4157ea1
--- /dev/null
+++ b/newlib/libc/time/Makefile.inc
@@ -0,0 +1,15 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/asctime.def \
+	%D%/clock.def \
+	%D%/ctime.def \
+	%D%/difftime.def \
+	%D%/gmtime.def \
+	%D%/lcltime.def \
+	%D%/mktime.def \
+	%D%/strftime.def \
+	%D%/time.def \
+	%D%/tzlock.def \
+	%D%/tzset.def \
+	%D%/wcsftime.def
+
+LIBC_CHAPTERS += %D%/time.tex
diff --git a/newlib/libc/unix/Makefile.am b/newlib/libc/unix/Makefile.am
index a2d830f1adb3..a74738d74ca0 100644
--- a/newlib/libc/unix/Makefile.am
+++ b/newlib/libc/unix/Makefile.am
@@ -49,7 +49,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for unix.
diff --git a/newlib/libc/xdr/Makefile.am b/newlib/libc/xdr/Makefile.am
index ad9968c9acf0..8f4ac7d04a33 100644
--- a/newlib/libc/xdr/Makefile.am
+++ b/newlib/libc/xdr/Makefile.am
@@ -56,8 +56,4 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for xdr.
-
 include $(srcdir)/../../Makefile.shared
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 4/5 v2] newlib: move man page generation into top-level build
  2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
  2022-01-28  7:58   ` [PATCH 2/5 v2] newlib: libc: include all chapters all the time in the manual Mike Frysinger
  2022-01-28  7:58   ` [PATCH 3/5 v2] newlib: libc: move manual into top-level build Mike Frysinger
@ 2022-01-28  7:58   ` Mike Frysinger
  2022-01-28  7:58   ` [PATCH 5/5 v2] newlib: drop shared documentation rules Mike Frysinger
  2022-01-31 14:58   ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Jon Turney
  4 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-28  7:58 UTC (permalink / raw)
  To: newlib

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 $@.tmp $@
 	$(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 $< > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(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 $@.tmp $@
 	$(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 $< > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 5/5 v2] newlib: drop shared documentation rules
  2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
                     ` (2 preceding siblings ...)
  2022-01-28  7:58   ` [PATCH 4/5 v2] newlib: move man page generation " Mike Frysinger
@ 2022-01-28  7:58   ` Mike Frysinger
  2022-01-31 14:58   ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Jon Turney
  4 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-01-28  7:58 UTC (permalink / raw)
  To: newlib

Now that the top-level makefile handles these, don't need to copy
these into every single subdir.
---
 newlib/Makefile.shared                        | 36 -------------------
 newlib/libc/argz/Makefile.in                  | 35 +-----------------
 newlib/libc/ctype/Makefile.in                 | 35 +-----------------
 newlib/libc/errno/Makefile.in                 | 35 +-----------------
 newlib/libc/iconv/Makefile.in                 | 34 ------------------
 newlib/libc/iconv/ccs/Makefile.in             | 35 +-----------------
 newlib/libc/iconv/ccs/binary/Makefile.in      | 34 ------------------
 newlib/libc/iconv/ces/Makefile.in             | 35 +-----------------
 newlib/libc/iconv/lib/Makefile.in             | 35 +-----------------
 newlib/libc/locale/Makefile.in                | 35 +-----------------
 newlib/libc/machine/i386/Makefile.in          | 35 +-----------------
 newlib/libc/misc/Makefile.in                  | 35 +-----------------
 newlib/libc/posix/Makefile.in                 | 35 +-----------------
 newlib/libc/reent/Makefile.in                 | 35 +-----------------
 newlib/libc/search/Makefile.in                | 35 +-----------------
 newlib/libc/signal/Makefile.in                | 35 +-----------------
 newlib/libc/ssp/Makefile.in                   | 35 +-----------------
 newlib/libc/stdio/Makefile.in                 | 35 +-----------------
 newlib/libc/stdio64/Makefile.in               | 35 +-----------------
 newlib/libc/stdlib/Makefile.in                | 35 +-----------------
 newlib/libc/string/Makefile.in                | 35 +-----------------
 newlib/libc/sys/linux/argp/Makefile.in        | 35 +-----------------
 newlib/libc/sys/linux/cmath/Makefile.in       | 35 +-----------------
 newlib/libc/sys/linux/dl/Makefile.in          | 35 +-----------------
 newlib/libc/sys/linux/iconv/Makefile.in       | 35 +-----------------
 newlib/libc/sys/linux/intl/Makefile.in        | 35 +-----------------
 .../libc/sys/linux/linuxthreads/Makefile.in   | 35 +-----------------
 .../linuxthreads/machine/i386/Makefile.in     | 35 +-----------------
 .../libc/sys/linux/machine/i386/Makefile.in   | 35 +-----------------
 newlib/libc/sys/linux/net/Makefile.in         | 35 +-----------------
 newlib/libc/syscalls/Makefile.in              | 35 +-----------------
 newlib/libc/time/Makefile.in                  | 35 +-----------------
 newlib/libc/unix/Makefile.in                  | 35 +-----------------
 newlib/libc/xdr/Makefile.in                   | 35 +-----------------
 newlib/libm/common/Makefile.in                | 35 +-----------------
 newlib/libm/complex/Makefile.in               | 35 +-----------------
 newlib/libm/fenv/Makefile.in                  | 35 +-----------------
 newlib/libm/machine/aarch64/Makefile.in       | 35 +-----------------
 newlib/libm/machine/arm/Makefile.in           | 35 +-----------------
 newlib/libm/machine/i386/Makefile.in          | 35 +-----------------
 newlib/libm/machine/mips/Makefile.in          | 35 +-----------------
 newlib/libm/machine/nds32/Makefile.in         | 35 +-----------------
 newlib/libm/machine/powerpc/Makefile.in       | 35 +-----------------
 newlib/libm/machine/pru/Makefile.in           | 35 +-----------------
 newlib/libm/machine/riscv/Makefile.in         | 35 +-----------------
 newlib/libm/machine/sparc/Makefile.in         | 35 +-----------------
 newlib/libm/machine/spu/Makefile.in           | 35 +-----------------
 newlib/libm/machine/x86_64/Makefile.in        | 35 +-----------------
 newlib/libm/math/Makefile.in                  | 35 +-----------------
 newlib/libm/mathfp/Makefile.in                | 35 +-----------------
 50 files changed, 47 insertions(+), 1702 deletions(-)

diff --git a/newlib/Makefile.shared b/newlib/Makefile.shared
index f1152fc627cf..00ea8533581c 100644
--- a/newlib/Makefile.shared
+++ b/newlib/Makefile.shared
@@ -4,39 +4,3 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	do \
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
-
-#
-# documentation rules
-#
-
-SUFFIXES = .def .xml
-
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/5 v2] newlib: libm: move manual into top-level build
  2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
                     ` (3 preceding siblings ...)
  2022-01-28  7:58   ` [PATCH 5/5 v2] newlib: drop shared documentation rules Mike Frysinger
@ 2022-01-31 14:58   ` Jon Turney
  2022-02-01  3:40     ` Mike Frysinger
  4 siblings, 1 reply; 25+ messages in thread
From: Jon Turney @ 2022-01-31 14:58 UTC (permalink / raw)
  To: Mike Frysinger, newlib

On 28/01/2022 07:58, Mike Frysinger wrote:
> This doesn't migrate all the docs, just the libm's manual (pdf/info).
> This is to show the basic form of migrating the chew files.
[...]
> diff --git a/newlib/libm/Makefile.inc b/newlib/libm/Makefile.inc
> new file mode 100644
> index 000000000000..9aa5a5c93519
> --- /dev/null
> +++ b/newlib/libm/Makefile.inc
> @@ -0,0 +1,26 @@
> +info_TEXINFOS += %D%/libm.texi
> +%C%_libm_TEXINFOS = %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
> +
> +LIBM_CHEWOUT_FILES =
> +
> +LIBM_CHAPTERS =
> +
> +%D%/libm.dvi: %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
> +
> +%D%/targetdep.tex: $(LIBM_CHAPTERS)
> +	$(AM_V_GEN)cat $^ > $@.tmp
> +	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
> +	$(AM_V_at)touch $@

We carefully only update $@ if it's changed, then touch it anyhow?

This seems like a transcription error, since originally we were touching 
a timestamp file, or perhaps leftover from testing?

The same pattern occurs later, as well.

> --- a/newlib/libm/common/Makefile.am
> +++ b/newlib/libm/common/Makefile.am
> @@ -59,15 +59,11 @@ endif # USE_LIBTOOL
>   
>   include $(srcdir)/../../Makefile.shared
>   
> -CHEWOUT_FILES =	s_cbrt.def s_copysign.def s_exp10.def s_expm1.def s_ilogb.def \
> -	s_infinity.def s_isnan.def s_log1p.def s_modf.def \
> -	s_nan.def s_nextafter.def s_pow10.def s_scalbn.def \
> -	s_fdim.def s_fma.def s_fmax.def s_fmin.def \
> -	s_logb.def s_log2.def s_lrint.def s_lround.def s_nearbyint.def \
> -	s_remquo.def s_rint.def s_round.def s_signbit.def s_trunc.def \
> -	isgreater.def
> -
> -CHAPTERS =
> +LIBM_CHEWOUT_FILES =
> +LIBM_CHAPTERS =
> +include ./Makefile.inc

Is this boilerplate really needed before including the makefile 
fragment, since '+=' should work even if the variable isn't already defined?

> +CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
> +CHAPTERS = $(LIBM_CHAPTERS)
>   
>   # A partial dependency list.
>   


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/5 v2] newlib: libm: move manual into top-level build
  2022-01-31 14:58   ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Jon Turney
@ 2022-02-01  3:40     ` Mike Frysinger
  2022-02-01 14:37       ` Jon Turney
  0 siblings, 1 reply; 25+ messages in thread
From: Mike Frysinger @ 2022-02-01  3:40 UTC (permalink / raw)
  To: Jon Turney; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 1939 bytes --]

On 31 Jan 2022 14:58, Jon Turney wrote:
> On 28/01/2022 07:58, Mike Frysinger wrote:
> > --- /dev/null
> > +++ b/newlib/libm/Makefile.inc
> > @@ -0,0 +1,26 @@
> > +info_TEXINFOS += %D%/libm.texi
> > +%C%_libm_TEXINFOS = %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
> > +
> > +LIBM_CHEWOUT_FILES =
> > +
> > +LIBM_CHAPTERS =
> > +
> > +%D%/libm.dvi: %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
> > +
> > +%D%/targetdep.tex: $(LIBM_CHAPTERS)
> > +	$(AM_V_GEN)cat $^ > $@.tmp
> > +	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
> > +	$(AM_V_at)touch $@
> 
> We carefully only update $@ if it's changed, then touch it anyhow?
> 
> This seems like a transcription error, since originally we were touching 
> a timestamp file, or perhaps leftover from testing?

you're right of course.  i saw other places that weren't using the stamp
idiom, and then when rewriting these rules i remembered those places and
thought i wouldn't bother deploying the stamp pattern here since it was
already doing it wrong.  but i misremembered which ones were wrong.

> The same pattern occurs later, as well.

which one do you mean ?  the .xml ones ?  those currently aren't using the
stamp idiom.  or do you just mean the multiple places where targetdep.tex
is generated ?

> > --- a/newlib/libm/common/Makefile.am
> > +++ b/newlib/libm/common/Makefile.am
> >   
> > -CHAPTERS =
> > +LIBM_CHEWOUT_FILES =
> > +LIBM_CHAPTERS =
> > +include ./Makefile.inc
> 
> Is this boilerplate really needed before including the makefile 
> fragment, since '+=' should work even if the variable isn't already defined?

yes, automake enforces it

ideally we'll kill all libm/*/Makefile.am files at which point this boiler
plate isn't needed since there will just be the one set in the top-level
libm/Makefile.am.  i'm holding off on doing that clean up until i can finish
landing my current batch of changes.
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/5 v3] newlib: libm: move manual into top-level build
  2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
                   ` (5 preceding siblings ...)
  2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
@ 2022-02-01  6:21 ` Mike Frysinger
  2022-02-01  6:21   ` [PATCH 2/5 v3] newlib: libc: include all chapters all the time in the manual Mike Frysinger
                     ` (4 more replies)
  6 siblings, 5 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-02-01  6:21 UTC (permalink / raw)
  To: newlib

This doesn't migrate all the docs, just the libm's manual (pdf/info).
This is to show the basic form of migrating the chew files.
---
v3: fix .stamp handling with tex generation

 newlib/Makefile.am               |   9 +
 newlib/Makefile.in               | 443 ++++++++++++++++++++++++++++---
 newlib/doc/local.mk              |  11 +
 newlib/libm/Makefile.am          |  27 +-
 newlib/libm/Makefile.in          | 398 +++------------------------
 newlib/libm/Makefile.inc         |  28 ++
 newlib/libm/common/Makefile.am   |  14 +-
 newlib/libm/common/Makefile.in   |  22 +-
 newlib/libm/common/Makefile.inc  |  10 +
 newlib/libm/complex/Makefile.am  |  12 +-
 newlib/libm/complex/Makefile.in  |  18 +-
 newlib/libm/complex/Makefile.inc |   8 +
 newlib/libm/fenv/Makefile.am     |  11 +-
 newlib/libm/fenv/Makefile.in     |  15 +-
 newlib/libm/fenv/Makefile.inc    |   7 +
 newlib/libm/math/Makefile.am     |  15 +-
 newlib/libm/math/Makefile.in     |  23 +-
 newlib/libm/math/Makefile.inc    |  11 +
 newlib/libm/mathfp/Makefile.am   |  35 +--
 newlib/libm/mathfp/Makefile.in   |  42 +--
 newlib/libm/mathfp/Makefile.inc  |  31 +++
 21 files changed, 634 insertions(+), 556 deletions(-)
 create mode 100644 newlib/libm/Makefile.inc
 create mode 100644 newlib/libm/common/Makefile.inc
 create mode 100644 newlib/libm/complex/Makefile.inc
 create mode 100644 newlib/libm/fenv/Makefile.inc
 create mode 100644 newlib/libm/math/Makefile.inc
 create mode 100644 newlib/libm/mathfp/Makefile.inc

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 718002535c78..a4cb965c2af2 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -5,6 +5,8 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 
 # Variables that will accumulate in subdirs.
 PHONY =
+SUFFIXES =
+info_TEXINFOS =
 noinst_DATA =
 pkglib_LTLIBRARIES =
 
@@ -510,11 +512,18 @@ check-DEJAGNU: site.exp
 clean-local:
 	-rm -rf targ-include newlib.h _newlib_version.h stamp-*
 
+# Workaround bad automake/texinfo interactions.
+# https://bugs.gnu.org/23599
+TEXI2DVI = texi2dvi -E
+
+TEXINFO_TEX = ../texinfo/texinfo.tex
+
 if HAVE_DOC
 include doc/local.mk
 endif
 if HAVE_ICONVDATA
 include iconvdata/Makefile.inc
 endif
+include libm/Makefile.inc
 
 .PHONY: $(PHONY)
diff --git a/newlib/doc/local.mk b/newlib/doc/local.mk
index 64083c3dd600..5c867c998251 100644
--- a/newlib/doc/local.mk
+++ b/newlib/doc/local.mk
@@ -18,3 +18,14 @@ man-cache:
 	${srcdir}/doc/makedocbook.py --cache
 
 PHONY += man-cache
+
+#
+# Subdir documentation rules.
+#
+
+SUFFIXES += .def
+
+CHEW = $(MKDOC) -f $(srcdir)/%D%/doc.str
+
+.c.def:
+	$(AM_V_GEN)$(CHEW) < $< > $*.def || ( rm $*.def && false )
diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
index 5165ff34b9c0..1070af011ddd 100644
--- a/newlib/libm/Makefile.am
+++ b/newlib/libm/Makefile.am
@@ -36,31 +36,6 @@ endif
 
 $(SUBLIBS):
 
-TEXINFO_TEX = ../../texinfo/texinfo.tex
-info_TEXINFOS = libm.texi
-libm_TEXINFOS = targetdep.tex
-
-libm.dvi: targetdep.tex math/stmp-def complex/stmp-def fenv/stmp-def
-
-stmp-targetdep: force
-	rm -f tmp.texi
-	targetdoc=`pwd`/tmp.texi; \
-	for d in $(SUBDIRS); do \
-	  if test "$$d" != "."; then \
-	    (cd $$d && $(MAKE) doc) || exit 1; \
-	  fi; \
-	done
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp.texi targetdep.tex
-	touch $@
-
-targetdep.tex: stmp-targetdep ; @true
-
-math/stmp-def: stmp-targetdep ; @true
-
-complex/stmp-def: stmp-targetdep ; @true
-
-fenv/stmp-def: stmp-targetdep ; @true
-
 docbook-recursive: force
 	for d in $(SUBDIRS); do \
 	  if test "$$d" != "."; then \
@@ -81,7 +56,7 @@ install-man: man
 .PHONY: force
 force:
 
-CLEANFILES = tmp.texi targetdep.tex stmp-targetdep *.xml *.3
+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
new file mode 100644
index 000000000000..39418cc79ef8
--- /dev/null
+++ b/newlib/libm/Makefile.inc
@@ -0,0 +1,28 @@
+info_TEXINFOS += %D%/libm.texi
+%C%_libm_TEXINFOS = %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
+
+LIBM_CHEWOUT_FILES =
+
+LIBM_CHAPTERS =
+
+%D%/libm.dvi: %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
+
+%D%/targetdep.tex.stamp: $(LIBM_CHAPTERS)
+	$(AM_V_GEN)cat $^ > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $(@:.stamp=)
+	$(AM_V_at)touch $@
+%D%/targetdep.tex: %D%/targetdep.tex.stamp; @true
+
+include %D%/common/Makefile.inc
+include %D%/complex/Makefile.inc
+include %D%/fenv/Makefile.inc
+if NEWLIB_HW_FP
+include %D%/mathfp/Makefile.inc
+else
+include %D%/math/Makefile.inc
+endif
+
+CLEANFILES += \
+	%D%/targetdep.tex \
+	%D%/targetdep.tex.stamp \
+	$(LIBM_CHEWOUT_FILES)
diff --git a/newlib/libm/common/Makefile.am b/newlib/libm/common/Makefile.am
index ef55e90ea462..29597d6031a9 100644
--- a/newlib/libm/common/Makefile.am
+++ b/newlib/libm/common/Makefile.am
@@ -59,15 +59,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	s_cbrt.def s_copysign.def s_exp10.def s_expm1.def s_ilogb.def \
-	s_infinity.def s_isnan.def s_log1p.def s_modf.def \
-	s_nan.def s_nextafter.def s_pow10.def s_scalbn.def \
-	s_fdim.def s_fma.def s_fmax.def s_fmin.def \
-	s_logb.def s_log2.def s_lrint.def s_lround.def s_nearbyint.def \
-	s_remquo.def s_rint.def s_round.def s_signbit.def s_trunc.def \
-	isgreater.def
-
-CHAPTERS =
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/common/Makefile.inc b/newlib/libm/common/Makefile.inc
new file mode 100644
index 000000000000..b0d3013c522b
--- /dev/null
+++ b/newlib/libm/common/Makefile.inc
@@ -0,0 +1,10 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/s_cbrt.def %D%/s_copysign.def %D%/s_exp10.def %D%/s_expm1.def %D%/s_ilogb.def \
+	%D%/s_infinity.def %D%/s_isnan.def %D%/s_log1p.def %D%/s_modf.def \
+	%D%/s_nan.def %D%/s_nextafter.def %D%/s_pow10.def %D%/s_scalbn.def \
+	%D%/s_fdim.def %D%/s_fma.def %D%/s_fmax.def %D%/s_fmin.def \
+	%D%/s_logb.def %D%/s_log2.def %D%/s_lrint.def %D%/s_lround.def %D%/s_nearbyint.def \
+	%D%/s_remquo.def %D%/s_rint.def %D%/s_round.def %D%/s_signbit.def %D%/s_trunc.def \
+	%D%/isgreater.def
+
+LIBM_CHAPTERS +=
diff --git a/newlib/libm/complex/Makefile.am b/newlib/libm/complex/Makefile.am
index 73fa19045754..0f27fff19ff6 100644
--- a/newlib/libm/complex/Makefile.am
+++ b/newlib/libm/complex/Makefile.am
@@ -35,13 +35,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	cabs.def cacos.def cacosh.def carg.def \
-        casin.def casinh.def catan.def catanh.def \
-        ccos.def ccosh.def cexp.def cimag.def clog.def \
-        clog10.def conj.def cpow.def cproj.def creal.def \
-        csin.def csinh.def csqrt.def ctan.def ctanh.def
-
-CHAPTERS = complex.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/complex/Makefile.inc b/newlib/libm/complex/Makefile.inc
new file mode 100644
index 000000000000..94288082ea32
--- /dev/null
+++ b/newlib/libm/complex/Makefile.inc
@@ -0,0 +1,8 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/cabs.def %D%/cacos.def %D%/cacosh.def %D%/carg.def \
+	%D%/casin.def %D%/casinh.def %D%/catan.def %D%/catanh.def \
+	%D%/ccos.def %D%/ccosh.def %D%/cexp.def %D%/cimag.def %D%/clog.def \
+	%D%/clog10.def %D%/conj.def %D%/cpow.def %D%/cproj.def %D%/creal.def \
+	%D%/csin.def %D%/csinh.def %D%/csqrt.def %D%/ctan.def %D%/ctanh.def
+
+LIBM_CHAPTERS += %D%/complex.tex
diff --git a/newlib/libm/fenv/Makefile.am b/newlib/libm/fenv/Makefile.am
index db59c8048490..00c55d03898d 100644
--- a/newlib/libm/fenv/Makefile.am
+++ b/newlib/libm/fenv/Makefile.am
@@ -22,12 +22,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES =	feclearexcept.def fegetenv.def \
-	fegetexceptflag.def fegetround.def feholdexcept.def \
-	feraiseexcept.def fesetenv.def fesetexceptflag.def fesetround.def \
-	fetestexcept.def feupdateenv.def
-
-CHAPTERS = fenv.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/fenv/Makefile.inc b/newlib/libm/fenv/Makefile.inc
new file mode 100644
index 000000000000..0399638ad603
--- /dev/null
+++ b/newlib/libm/fenv/Makefile.inc
@@ -0,0 +1,7 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/feclearexcept.def %D%/fegetenv.def \
+	%D%/fegetexceptflag.def %D%/fegetround.def %D%/feholdexcept.def \
+	%D%/feraiseexcept.def %D%/fesetenv.def %D%/fesetexceptflag.def %D%/fesetround.def \
+	%D%/fetestexcept.def %D%/feupdateenv.def
+
+LIBM_CHAPTERS += %D%/fenv.tex
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am
index 5529c358a80e..3d23a46a15e6 100644
--- a/newlib/libm/math/Makefile.am
+++ b/newlib/libm/math/Makefile.am
@@ -66,16 +66,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = w_acos.def w_acosh.def w_asin.def s_asinh.def \
-	s_atan.def w_atan2.def w_atanh.def w_j0.def \
-	w_cosh.def s_erf.def w_exp.def w_exp2.def \
-	s_fabs.def s_floor.def w_fmod.def s_frexp.def \
-	w_gamma.def w_hypot.def s_ldexp.def w_log.def \
-	w_log10.def \
-	w_pow.def w_remainder.def s_sin.def w_sinh.def \
-	w_sqrt.def s_tan.def s_tanh.def
-
-CHAPTERS = math.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/math/Makefile.inc b/newlib/libm/math/Makefile.inc
new file mode 100644
index 000000000000..bc3205e0b156
--- /dev/null
+++ b/newlib/libm/math/Makefile.inc
@@ -0,0 +1,11 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/w_acos.def %D%/w_acosh.def %D%/w_asin.def %D%/s_asinh.def \
+	%D%/s_atan.def %D%/w_atan2.def %D%/w_atanh.def %D%/w_j0.def \
+	%D%/w_cosh.def %D%/s_erf.def %D%/w_exp.def %D%/w_exp2.def \
+	%D%/s_fabs.def %D%/s_floor.def %D%/w_fmod.def %D%/s_frexp.def \
+	%D%/w_gamma.def %D%/w_hypot.def %D%/s_ldexp.def %D%/w_log.def \
+	%D%/w_log10.def \
+	%D%/w_pow.def %D%/w_remainder.def %D%/s_sin.def %D%/w_sinh.def \
+	%D%/w_sqrt.def %D%/s_tan.def %D%/s_tanh.def
+
+LIBM_CHAPTERS += %D%/math.tex
diff --git a/newlib/libm/mathfp/Makefile.am b/newlib/libm/mathfp/Makefile.am
index 39fb8b1db69e..44d0e8f28026 100644
--- a/newlib/libm/mathfp/Makefile.am
+++ b/newlib/libm/mathfp/Makefile.am
@@ -56,36 +56,11 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = e_acosh.def \
-	e_atanh.def \
-	e_hypot.def \
-	e_remainder.def \
-	er_lgamma.def \
-	s_acos.def \
-	s_asine.def \
-	s_asinh.def \
-	s_atan.def \
-	s_atan2.def \
-	s_atangent.def \
-	s_cosh.def \
-	s_erf.def \
-	s_exp.def \
-	s_fabs.def \
-	s_floor.def \
-	s_fmod.def \
-	s_frexp.def \
-	s_ldexp.def \
-	s_log10.def \
-	s_logarithm.def \
-	s_pow.def \
-	s_sine.def \
-	s_sineh.def \
-	s_sqrt.def \
-	s_tan.def \
-	s_tanh.def \
-	w_jn.def
-
-CHAPTERS = mathfp.tex
+LIBM_CHEWOUT_FILES =
+LIBM_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBM_CHEWOUT_FILES)
+CHAPTERS = $(LIBM_CHAPTERS)
 
 # A partial dependency list.
 
diff --git a/newlib/libm/mathfp/Makefile.inc b/newlib/libm/mathfp/Makefile.inc
new file mode 100644
index 000000000000..739e41f16d0b
--- /dev/null
+++ b/newlib/libm/mathfp/Makefile.inc
@@ -0,0 +1,31 @@
+LIBM_CHEWOUT_FILES += \
+	%D%/e_acosh.def \
+	%D%/e_atanh.def \
+	%D%/e_hypot.def \
+	%D%/e_remainder.def \
+	%D%/er_lgamma.def \
+	%D%/s_acos.def \
+	%D%/s_asine.def \
+	%D%/s_asinh.def \
+	%D%/s_atan.def \
+	%D%/s_atan2.def \
+	%D%/s_atangent.def \
+	%D%/s_cosh.def \
+	%D%/s_erf.def \
+	%D%/s_exp.def \
+	%D%/s_fabs.def \
+	%D%/s_floor.def \
+	%D%/s_fmod.def \
+	%D%/s_frexp.def \
+	%D%/s_ldexp.def \
+	%D%/s_log10.def \
+	%D%/s_logarithm.def \
+	%D%/s_pow.def \
+	%D%/s_sine.def \
+	%D%/s_sineh.def \
+	%D%/s_sqrt.def \
+	%D%/s_tan.def \
+	%D%/s_tanh.def \
+	%D%/w_jn.def
+
+LIBM_CHAPTERS += %D%/mathfp.tex
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 2/5 v3] newlib: libc: include all chapters all the time in the manual
  2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
@ 2022-02-01  6:21   ` Mike Frysinger
  2022-02-01  6:21   ` [PATCH 3/5 v3] newlib: libc: move manual into top-level build Mike Frysinger
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-02-01  6:21 UTC (permalink / raw)
  To: newlib

THe stdio subdir is actually required by the documentation.  The
stdio/def is handled dynamically, but libc.texi always expects it
to be included, and fails if it isn't.  So making it required when
building docs is safe.

The xdr subdir is handled dynamically, but it doesn't include any
docs, so the dynamic logic isn't (currently) adding any value.  So
making it required when building docs is safe.

That leaves: iconv, stdio64, posix, and signal subdirs.  The chapters
have a little disclaimer saying they are system-dependent, but even
then, imo having stable manuals regardless of the target is preferable,
and we can add more disclaimer language to these chapters if we want.

This doesn't touch the man page codepaths, just the info/pdf.
---
 newlib/libc/Makefile.am                    | 63 +++-----------------
 newlib/libc/Makefile.in                    | 69 +++-------------------
 newlib/libc/argz/Makefile.in               |  5 --
 newlib/libc/configure                      | 24 +-------
 newlib/libc/configure.ac                   | 15 -----
 newlib/libc/ctype/Makefile.in              |  5 --
 newlib/libc/errno/Makefile.in              |  5 --
 newlib/libc/iconv/Makefile.in              |  5 --
 newlib/libc/iconv/ccs/Makefile.in          |  5 --
 newlib/libc/iconv/ccs/binary/Makefile.in   |  5 --
 newlib/libc/iconv/ces/Makefile.in          |  5 --
 newlib/libc/iconv/lib/Makefile.in          |  5 --
 newlib/libc/libc.texi                      | 18 ------
 newlib/libc/locale/Makefile.in             |  5 --
 newlib/libc/machine/a29k/Makefile.in       |  5 --
 newlib/libc/machine/aarch64/Makefile.in    |  5 --
 newlib/libc/machine/amdgcn/Makefile.in     |  5 --
 newlib/libc/machine/arc/Makefile.in        |  5 --
 newlib/libc/machine/arm/Makefile.in        |  5 --
 newlib/libc/machine/bfin/Makefile.in       |  5 --
 newlib/libc/machine/cr16/Makefile.in       |  5 --
 newlib/libc/machine/cris/Makefile.in       |  5 --
 newlib/libc/machine/crx/Makefile.in        |  5 --
 newlib/libc/machine/csky/Makefile.in       |  5 --
 newlib/libc/machine/d10v/Makefile.in       |  5 --
 newlib/libc/machine/d30v/Makefile.in       |  5 --
 newlib/libc/machine/epiphany/Makefile.in   |  5 --
 newlib/libc/machine/fr30/Makefile.in       |  5 --
 newlib/libc/machine/frv/Makefile.in        |  5 --
 newlib/libc/machine/ft32/Makefile.in       |  5 --
 newlib/libc/machine/h8300/Makefile.in      |  5 --
 newlib/libc/machine/h8500/Makefile.in      |  5 --
 newlib/libc/machine/hppa/Makefile.in       |  5 --
 newlib/libc/machine/i386/Makefile.in       |  5 --
 newlib/libc/machine/i960/Makefile.in       |  5 --
 newlib/libc/machine/iq2000/Makefile.in     |  5 --
 newlib/libc/machine/lm32/Makefile.in       |  5 --
 newlib/libc/machine/m32c/Makefile.in       |  5 --
 newlib/libc/machine/m32r/Makefile.in       |  5 --
 newlib/libc/machine/m68hc11/Makefile.in    |  5 --
 newlib/libc/machine/m68k/Makefile.in       |  5 --
 newlib/libc/machine/m88k/Makefile.in       |  5 --
 newlib/libc/machine/mep/Makefile.in        |  5 --
 newlib/libc/machine/microblaze/Makefile.in |  5 --
 newlib/libc/machine/mips/Makefile.in       |  5 --
 newlib/libc/machine/mn10200/Makefile.in    |  5 --
 newlib/libc/machine/mn10300/Makefile.in    |  5 --
 newlib/libc/machine/moxie/Makefile.in      |  5 --
 newlib/libc/machine/msp430/Makefile.in     |  5 --
 newlib/libc/machine/mt/Makefile.in         |  5 --
 newlib/libc/machine/nds32/Makefile.in      |  5 --
 newlib/libc/machine/necv70/Makefile.in     |  5 --
 newlib/libc/machine/nios2/Makefile.in      |  5 --
 newlib/libc/machine/nvptx/Makefile.in      |  5 --
 newlib/libc/machine/or1k/Makefile.in       |  5 --
 newlib/libc/machine/powerpc/Makefile.in    |  5 --
 newlib/libc/machine/pru/Makefile.in        |  5 --
 newlib/libc/machine/riscv/Makefile.in      |  5 --
 newlib/libc/machine/rl78/Makefile.in       |  5 --
 newlib/libc/machine/rx/Makefile.in         |  5 --
 newlib/libc/machine/sh/Makefile.in         |  5 --
 newlib/libc/machine/sparc/Makefile.in      |  5 --
 newlib/libc/machine/spu/Makefile.in        |  5 --
 newlib/libc/machine/tic4x/Makefile.in      |  5 --
 newlib/libc/machine/tic6x/Makefile.in      |  5 --
 newlib/libc/machine/tic80/Makefile.in      |  5 --
 newlib/libc/machine/v850/Makefile.in       |  5 --
 newlib/libc/machine/visium/Makefile.in     |  5 --
 newlib/libc/machine/w65/Makefile.in        |  5 --
 newlib/libc/machine/x86_64/Makefile.in     |  5 --
 newlib/libc/machine/xc16x/Makefile.in      |  5 --
 newlib/libc/machine/xstormy16/Makefile.in  |  5 --
 newlib/libc/machine/z8k/Makefile.in        |  5 --
 newlib/libc/misc/Makefile.in               |  5 --
 newlib/libc/posix/Makefile.in              |  5 --
 newlib/libc/reent/Makefile.in              |  5 --
 newlib/libc/search/Makefile.in             |  5 --
 newlib/libc/signal/Makefile.in             |  5 --
 newlib/libc/ssp/Makefile.in                |  5 --
 newlib/libc/stdio/Makefile.in              |  5 --
 newlib/libc/stdio64/Makefile.in            |  5 --
 newlib/libc/stdlib/Makefile.in             |  5 --
 newlib/libc/string/Makefile.in             |  5 --
 newlib/libc/sys/a29khif/Makefile.in        |  5 --
 newlib/libc/sys/amdgcn/Makefile.in         |  5 --
 newlib/libc/sys/arm/Makefile.in            |  5 --
 newlib/libc/sys/d10v/Makefile.in           |  5 --
 newlib/libc/sys/decstation/Makefile.in     |  5 --
 newlib/libc/sys/epiphany/Makefile.in       |  5 --
 newlib/libc/sys/h8300hms/Makefile.in       |  5 --
 newlib/libc/sys/h8500hms/Makefile.in       |  5 --
 newlib/libc/sys/m88kbug/Makefile.in        |  5 --
 newlib/libc/sys/mmixware/Makefile.in       |  5 --
 newlib/libc/sys/netware/Makefile.in        |  5 --
 newlib/libc/sys/or1k/Makefile.in           |  5 --
 newlib/libc/sys/rdos/Makefile.in           |  5 --
 newlib/libc/sys/rtems/Makefile.in          |  5 --
 newlib/libc/sys/sh/Makefile.in             |  5 --
 newlib/libc/sys/sparc64/Makefile.in        |  5 --
 newlib/libc/sys/sun4/Makefile.in           |  5 --
 newlib/libc/sys/sysmec/Makefile.in         |  5 --
 newlib/libc/sys/sysnec810/Makefile.in      |  5 --
 newlib/libc/sys/sysnecv850/Makefile.in     |  5 --
 newlib/libc/sys/sysvi386/Makefile.in       |  5 --
 newlib/libc/sys/sysvnecv70/Makefile.in     |  5 --
 newlib/libc/sys/tic80/Makefile.in          |  5 --
 newlib/libc/sys/tirtos/Makefile.in         |  5 --
 newlib/libc/sys/w65/Makefile.in            |  5 --
 newlib/libc/sys/z8ksim/Makefile.in         |  5 --
 newlib/libc/syscalls/Makefile.in           |  5 --
 newlib/libc/time/Makefile.in               |  5 --
 newlib/libc/unix/Makefile.in               |  5 --
 newlib/libc/xdr/Makefile.in                |  5 --
 113 files changed, 18 insertions(+), 711 deletions(-)

diff --git a/newlib/libc/Makefile.am b/newlib/libc/Makefile.am
index 5151e00daed7..4e0b8fdf24ea 100644
--- a/newlib/libc/Makefile.am
+++ b/newlib/libc/Makefile.am
@@ -131,12 +131,12 @@ $(SUBLIBS): ; @true
 SUBDEFS = \
 	stdlib/stmp-def \
 	ctype/stmp-def \
-	$(LIBC_STDIO_DEF) \
-	$(LIBC_STDIO64_DEF) \
-	$(LIBC_POSIX_DEF) \
-	$(LIBC_XDR_DEF) \
+	stdio/stmp-def \
+	stdio64/stmp-def \
+	posix/stmp-def \
+	xdr/stmp-def \
 	string/stmp-def \
-	$(LIBC_SIGNAL_DEF) \
+	signal/stmp-def \
 	time/stmp-def \
 	locale/stmp-def \
 	reent/stmp-def \
@@ -145,55 +145,9 @@ SUBDEFS = \
 # ditto for stmp-xml files in each subdirectory which builds .xml files
 SUBXMLS = $(SUBDEFS:stmp-def=stmp-xml)
 
-libc.info: sigset.texi stdio64.texi posix.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
+libc.info: targetdep.tex $(SUBDEFS)
 
-libc.dvi: sigset.texi stdio64.texi posix.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
-
-stmp-sigset: config.status
-	if test -n "$(LIBC_SIGNAL_LIB)"; then \
-	  echo "@set SIGNALS" >tmp-sigset.texi; \
-	else \
-	  echo "@clear SIGNALS" >tmp-sigset.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-sigset.texi sigset.texi
-	touch $@
-
-sigset.texi: stmp-sigset ; @true
-
-stmp-iconvset: config.status
-	if test -n "$(NEWLIB_ICONV_LIBS)"; then \
-	  echo "@set ICONV" >tmp-iconvset.texi; \
-	else \
-	  echo "@clear ICONV" >tmp-iconvset.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-iconvset.texi iconvset.texi
-	touch $@
-
-iconvset.texi: stmp-iconvset ; @true
-
-stmp-stdio64: config.status
-	if test -n "$(LIBC_STDIO64_LIB)"; then \
-	  echo "@set STDIO64" >tmp-stdio64.texi; \
-	else \
-	  echo "@clear STDIO64" >tmp-stdio64.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-stdio64.texi stdio64.texi
-	touch $@
-
-stdio64.texi: stmp-stdio64 ; @true
-
-stmp-posix: config.status
-	if test -n "$(LIBC_POSIX_LIB)"; then \
-	  echo "@set POSIX" >tmp-posix.texi; \
-	else \
-	  echo "@clear POSIX" >tmp-posix.texi; \
-	fi
-	$(SHELL) $(newlib_basedir)/../move-if-change tmp-posix.texi posix.texi
-	touch $@
-
-posix.texi: stmp-posix ; @true
+libc.dvi: targetdep.tex $(SUBDEFS)
 
 stmp-targetdep: force
 	rm -f tmp-targetdep.texi
@@ -213,8 +167,7 @@ $(SUBDEFS): stmp-targetdep ; @true
 
 TEXINFO_TEX = ../../texinfo/texinfo.tex
 info_TEXINFOS = libc.texi
-libc_TEXINFOS = sigset.texi posix.texi stdio64.texi iconvset.texi \
-	targetdep.tex $(SUBDEFS)
+libc_TEXINFOS = targetdep.tex $(SUBDEFS)
 
 docbook-recursive: force
 	for d in $(SUBDIRS); do \
diff --git a/newlib/libc/configure.ac b/newlib/libc/configure.ac
index 4a0160a57d80..14b6aa466cd3 100644
--- a/newlib/libc/configure.ac
+++ b/newlib/libc/configure.ac
@@ -71,73 +71,58 @@ dnl for the library and an automake conditional for whether we should
 dnl build the library.
 
 LIBC_SIGNAL_LIB=
-LIBC_SIGNAL_DEF=
 if test -n "${signal_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_SIGNAL_LIB=${signal_dir}/lib${signal_dir}.${aext}
   else
     LIBC_SIGNAL_LIB=${signal_dir}/lib.${aext}
   fi
-  LIBC_SIGNAL_DEF=${signal_dir}/stmp-def
 fi
 AC_SUBST(LIBC_SIGNAL_LIB)
-AC_SUBST(LIBC_SIGNAL_DEF)
 AM_CONDITIONAL(HAVE_SIGNAL_DIR, test x${signal_dir} != x)
 
 LIBC_STDIO_LIB=
-LIBC_STDIO_DEF=
 if test -n "${stdio_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_STDIO_LIB=${stdio_dir}/lib${stdio_dir}.${aext}
   else
     LIBC_STDIO_LIB=${stdio_dir}/lib.${aext}
   fi
-  LIBC_STDIO_DEF=${stdio_dir}/stmp-def
 fi
 AC_SUBST(LIBC_STDIO_LIB)
-AC_SUBST(LIBC_STDIO_DEF)
 AM_CONDITIONAL(HAVE_STDIO_DIR, test x${stdio_dir} != x)
 
 LIBC_STDIO64_LIB=
-LIBC_STDIO64_DEF=
 if test -n "${stdio64_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_STDIO64_LIB=${stdio64_dir}/lib${stdio64_dir}.${aext}
   else
     LIBC_STDIO64_LIB=${stdio64_dir}/lib.${aext}
   fi
-  LIBC_STDIO64_DEF=${stdio64_dir}/stmp-def
 fi
 AC_SUBST(LIBC_STDIO64_LIB)
-AC_SUBST(LIBC_STDIO64_DEF)
 AM_CONDITIONAL(HAVE_STDIO64_DIR, test x${stdio64_dir} != x)
 
 LIBC_POSIX_LIB=
-LIBC_POSIX_DEF=
 if test -n "${posix_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_POSIX_LIB=${posix_dir}/lib${posix_dir}.${aext}
   else
     LIBC_POSIX_LIB=${posix_dir}/lib.${aext}
   fi
-  LIBC_POSIX_DEF=${posix_dir}/stmp-def
 fi
 AC_SUBST(LIBC_POSIX_LIB)
-AC_SUBST(LIBC_POSIX_DEF)
 AM_CONDITIONAL(HAVE_POSIX_DIR, test x${posix_dir} != x)
 
 LIBC_XDR_LIB=
-LIBC_XDR_DEF=
 if test -n "${xdr_dir}"; then
   if test "${use_libtool}" = "yes"; then
     LIBC_XDR_LIB=${xdr_dir}/lib${xdr_dir}.${aext}
   else
     LIBC_XDR_LIB=${xdr_dir}/lib.${aext}
   fi
-  LIBC_XDR_DEF=${xdr_dir}/stmp-def
 fi
 AC_SUBST(LIBC_XDR_LIB)
-AC_SUBST(LIBC_XDR_DEF)
 AM_CONDITIONAL(HAVE_XDR_DIR, test x${xdr_dir} != x)
 
 LIBC_SYSCALL_LIB=
diff --git a/newlib/libc/libc.texi b/newlib/libc/libc.texi
index 0cab22036dee..d217d8118277 100644
--- a/newlib/libc/libc.texi
+++ b/newlib/libc/libc.texi
@@ -132,44 +132,26 @@ into another language, under the above conditions for modified versions.
 @node Top
 @top The Red Hat newlib C Library
 
-@c The menu contents depend on the configuration, so we include them
-@c as a separate file
-
-@c switch to set SIGNALS on or off, according to whether config picks up
-@c signal subdirectory:
-@include sigset.texi
-@include posix.texi
-@include stdio64.texi
-@include iconvset.texi
-
 @menu
 * Introduction::
 * Stdlib::
 * Ctype::
 * Stdio::
-@ifset STDIO64
 * Stdio64::
-@end ifset
 
 * Strings::
 * Wchar strings::
-@ifset SIGNALS
 * Signals::
-@end ifset
 
 * Timefns::
 * Locale::
 * Reentrancy::
 
 * Misc::
-@ifset POSIX
 * Posix::
-@end ifset
 * Syscalls::
 * Arglists::
-@ifset ICONV
 * Iconv::
-@end ifset
 * Overflow Protection::
 
 * Document Index::
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 3/5 v3] newlib: libc: move manual into top-level build
  2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
  2022-02-01  6:21   ` [PATCH 2/5 v3] newlib: libc: include all chapters all the time in the manual Mike Frysinger
@ 2022-02-01  6:21   ` Mike Frysinger
  2022-02-01  6:21   ` [PATCH 4/5 v3] newlib: move man page generation " Mike Frysinger
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-02-01  6:21 UTC (permalink / raw)
  To: newlib

This doesn't migrate all the docs, just the libc's manual (pdf/info).
This is to show the basic form of migrating the chew files.

For subdirs that didn't have any docs, I've stripped their settings
for clarity.  If someone wanted to suddenly add docs, they can add
the corresponding local.mk files easily.
---
v3: fix .stamp handling with tex generation

 newlib/Makefile.am                 |   1 +
 newlib/Makefile.in                 | 238 ++++++++++++++-
 newlib/libc/Makefile.inc           |  34 +++
 newlib/libc/argz/Makefile.am       |   4 -
 newlib/libc/argz/Makefile.in       |   3 -
 newlib/libc/ctype/Makefile.am      |  41 +--
 newlib/libc/ctype/Makefile.in      |  51 +---
 newlib/libc/ctype/Makefile.inc     |  36 +++
 newlib/libc/errno/Makefile.am      |   4 -
 newlib/libc/errno/Makefile.in      |   3 -
 newlib/libc/iconv/Makefile.am      |  28 +-
 newlib/libc/iconv/Makefile.in      |  30 +-
 newlib/libc/iconv/Makefile.inc     |   3 +
 newlib/libc/iconv/ccs/Makefile.am  |   3 -
 newlib/libc/iconv/ccs/Makefile.in  |   2 -
 newlib/libc/iconv/ces/Makefile.am  |   3 -
 newlib/libc/iconv/ces/Makefile.in  |   2 -
 newlib/libc/iconv/iconv.tex        |   2 +-
 newlib/libc/iconv/lib/Makefile.am  |   3 -
 newlib/libc/iconv/lib/Makefile.in  |   2 -
 newlib/libc/iconv/lib/Makefile.inc |   1 +
 newlib/libc/locale/Makefile.am     |  13 +-
 newlib/libc/locale/Makefile.in     |  17 +-
 newlib/libc/locale/Makefile.inc    |   8 +
 newlib/libc/misc/Makefile.am       |   7 +-
 newlib/libc/misc/Makefile.in       |  10 +-
 newlib/libc/misc/Makefile.inc      |   6 +
 newlib/libc/posix/Makefile.am      |  10 +-
 newlib/libc/posix/Makefile.in      |  13 +-
 newlib/libc/posix/Makefile.inc     |   5 +
 newlib/libc/reent/Makefile.am      |  30 +-
 newlib/libc/reent/Makefile.in      |  37 +--
 newlib/libc/reent/Makefile.inc     |  25 ++
 newlib/libc/search/Makefile.am     |  13 +-
 newlib/libc/search/Makefile.in     |  14 +-
 newlib/libc/search/Makefile.inc    |   4 +
 newlib/libc/signal/Makefile.am     |   8 +-
 newlib/libc/signal/Makefile.in     |  10 +-
 newlib/libc/signal/Makefile.inc    |   7 +
 newlib/libc/ssp/Makefile.am        |   9 +-
 newlib/libc/ssp/Makefile.in        |  10 +-
 newlib/libc/ssp/Makefile.inc       |   3 +
 newlib/libc/stdio/Makefile.am      | 468 ++++++++++++-----------------
 newlib/libc/stdio/Makefile.in      | 104 ++-----
 newlib/libc/stdio/Makefile.inc     |  80 +++++
 newlib/libc/stdio64/Makefile.am    |  18 +-
 newlib/libc/stdio64/Makefile.in    |  21 +-
 newlib/libc/stdio64/Makefile.inc   |  11 +
 newlib/libc/stdlib/Makefile.am     |  58 +---
 newlib/libc/stdlib/Makefile.in     |  68 +----
 newlib/libc/stdlib/Makefile.inc    |  51 ++++
 newlib/libc/string/Makefile.am     |  27 +-
 newlib/libc/string/Makefile.in     |  48 +--
 newlib/libc/string/Makefile.inc    |  22 ++
 newlib/libc/syscalls/Makefile.am   |   4 -
 newlib/libc/syscalls/Makefile.in   |   3 -
 newlib/libc/time/Makefile.am       |  22 +-
 newlib/libc/time/Makefile.in       |  29 +-
 newlib/libc/time/Makefile.inc      |  15 +
 newlib/libc/unix/Makefile.am       |   4 -
 newlib/libc/unix/Makefile.in       |   3 -
 newlib/libc/xdr/Makefile.am        |   4 -
 newlib/libc/xdr/Makefile.in        |   3 -
 63 files changed, 948 insertions(+), 868 deletions(-)
 create mode 100644 newlib/libc/Makefile.inc
 create mode 100644 newlib/libc/ctype/Makefile.inc
 create mode 100644 newlib/libc/iconv/Makefile.inc
 create mode 100644 newlib/libc/iconv/lib/Makefile.inc
 create mode 100644 newlib/libc/locale/Makefile.inc
 create mode 100644 newlib/libc/misc/Makefile.inc
 create mode 100644 newlib/libc/posix/Makefile.inc
 create mode 100644 newlib/libc/reent/Makefile.inc
 create mode 100644 newlib/libc/search/Makefile.inc
 create mode 100644 newlib/libc/signal/Makefile.inc
 create mode 100644 newlib/libc/ssp/Makefile.inc
 create mode 100644 newlib/libc/stdio/Makefile.inc
 create mode 100644 newlib/libc/stdio64/Makefile.inc
 create mode 100644 newlib/libc/stdlib/Makefile.inc
 create mode 100644 newlib/libc/string/Makefile.inc
 create mode 100644 newlib/libc/time/Makefile.inc

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index a4cb965c2af2..99fa0d77f91f 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -524,6 +524,7 @@ endif
 if HAVE_ICONVDATA
 include iconvdata/Makefile.inc
 endif
+include libc/Makefile.inc
 include libm/Makefile.inc
 
 .PHONY: $(PHONY)
diff --git a/newlib/libc/Makefile.inc b/newlib/libc/Makefile.inc
new file mode 100644
index 000000000000..afd016b9d74f
--- /dev/null
+++ b/newlib/libc/Makefile.inc
@@ -0,0 +1,34 @@
+info_TEXINFOS += %D%/libc.texi
+%C%_libc_TEXINFOS = %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
+
+LIBC_CHEWOUT_FILES =
+
+LIBC_CHAPTERS = %D%/sys.tex
+
+%D%/libc.dvi: %D%/targetdep.tex $(LIBC_CHEWOUT_FILES)
+
+%D%/targetdep.tex.stamp: $(LIBC_CHAPTERS)
+	$(AM_V_GEN)cat $^ > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $(@:.stamp=)
+	$(AM_V_at)touch $@
+%D%/targetdep.tex: %D%/targetdep.tex.stamp; @true
+
+include %D%/ctype/Makefile.inc
+include %D%/iconv/Makefile.inc
+include %D%/locale/Makefile.inc
+include %D%/misc/Makefile.inc
+include %D%/posix/Makefile.inc
+include %D%/reent/Makefile.inc
+include %D%/search/Makefile.inc
+include %D%/signal/Makefile.inc
+include %D%/ssp/Makefile.inc
+include %D%/stdio64/Makefile.inc
+include %D%/stdio/Makefile.inc
+include %D%/stdlib/Makefile.inc
+include %D%/string/Makefile.inc
+include %D%/time/Makefile.inc
+
+CLEANFILES += \
+	%D%/targetdep.tex \
+	%D%/targetdep.tex.stamp \
+	$(LIBC_CHEWOUT_FILES)
diff --git a/newlib/libc/argz/Makefile.am b/newlib/libc/argz/Makefile.am
index 0f73cd2b8cfb..a8351b8e20e4 100644
--- a/newlib/libc/argz/Makefile.am
+++ b/newlib/libc/argz/Makefile.am
@@ -41,8 +41,4 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for argz.
-
 include $(srcdir)/../../Makefile.shared
diff --git a/newlib/libc/ctype/Makefile.am b/newlib/libc/ctype/Makefile.am
index 447b7afde2e0..e074e4d7f80e 100644
--- a/newlib/libc/ctype/Makefile.am
+++ b/newlib/libc/ctype/Makefile.am
@@ -95,41 +95,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES= \
-	isalnum.def	\
-	isalpha.def	\
-	isascii.def	\
-	isblank.def	\
-	iscntrl.def	\
-	isdigit.def	\
-	islower.def	\
-	isprint.def	\
-	ispunct.def	\
-	isspace.def	\
-	isupper.def	\
-	iswalnum.def	\
-	iswalpha.def	\
-	iswblank.def 	\
-	iswcntrl.def 	\
-	iswctype.def 	\
-	iswdigit.def 	\
-	iswgraph.def 	\
-	iswlower.def 	\
-	iswprint.def 	\
-	iswpunct.def 	\
-	iswspace.def 	\
-	iswupper.def 	\
-	iswxdigit.def 	\
-	isxdigit.def	\
-	toascii.def	\
-	tolower.def	\
-	toupper.def	\
-	towctrans.def	\
-	towlower.def	\
-	towupper.def	\
-	wctrans.def	\
-	wctype.def
-
-CHAPTERS = ctype.tex
+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/ctype/Makefile.inc b/newlib/libc/ctype/Makefile.inc
new file mode 100644
index 000000000000..8cef16630ac1
--- /dev/null
+++ b/newlib/libc/ctype/Makefile.inc
@@ -0,0 +1,36 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/isalnum.def \
+	%D%/isalpha.def \
+	%D%/isascii.def \
+	%D%/isblank.def \
+	%D%/iscntrl.def \
+	%D%/isdigit.def \
+	%D%/islower.def \
+	%D%/isprint.def \
+	%D%/ispunct.def \
+	%D%/isspace.def \
+	%D%/isupper.def \
+	%D%/iswalnum.def \
+	%D%/iswalpha.def \
+	%D%/iswblank.def \
+	%D%/iswcntrl.def \
+	%D%/iswctype.def \
+	%D%/iswdigit.def \
+	%D%/iswgraph.def \
+	%D%/iswlower.def \
+	%D%/iswprint.def \
+	%D%/iswpunct.def \
+	%D%/iswspace.def \
+	%D%/iswupper.def \
+	%D%/iswxdigit.def \
+	%D%/isxdigit.def \
+	%D%/toascii.def \
+	%D%/tolower.def \
+	%D%/toupper.def \
+	%D%/towctrans.def \
+	%D%/towlower.def \
+	%D%/towupper.def \
+	%D%/wctrans.def \
+	%D%/wctype.def
+
+LIBC_CHAPTERS += %D%/ctype.tex
diff --git a/newlib/libc/errno/Makefile.am b/newlib/libc/errno/Makefile.am
index 77a0b8b83ad8..3470abd0bc1c 100644
--- a/newlib/libc/errno/Makefile.am
+++ b/newlib/libc/errno/Makefile.am
@@ -18,7 +18,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for errno.
diff --git a/newlib/libc/iconv/Makefile.am b/newlib/libc/iconv/Makefile.am
index 4123c7acbcca..83570986116c 100644
--- a/newlib/libc/iconv/Makefile.am
+++ b/newlib/libc/iconv/Makefile.am
@@ -6,28 +6,10 @@ cct_DATA=encoding.aliases
 
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
 
-SUBDEFS = lib/stmp-def
-
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = iconv.def
-CHAPTERS = iconv.tex
-
-iconv.def: lib/iconv.def
-	cp lib/iconv.def iconv.def
-
-iconv.xml: lib/iconv.xml
-	cp lib/iconv.xml iconv.xml
-
-stmp-def: force
-	(cd lib && $(MAKE) doc)
-	touch $@
-
-.PHONY: force
-force:
-
-$(SUBDEFS): stmp-def
-
-lib/iconv.def: $(SUBDEFS); @true
-
-lib/stmp-def: ; @true
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/iconv/Makefile.inc b/newlib/libc/iconv/Makefile.inc
new file mode 100644
index 000000000000..1c331a5fac5b
--- /dev/null
+++ b/newlib/libc/iconv/Makefile.inc
@@ -0,0 +1,3 @@
+LIBC_CHAPTERS += %D%/iconv.tex
+
+include %D%/lib/Makefile.inc
diff --git a/newlib/libc/iconv/ccs/Makefile.am b/newlib/libc/iconv/ccs/Makefile.am
index f87d072b8e70..071b75b8ef4f 100644
--- a/newlib/libc/iconv/ccs/Makefile.am
+++ b/newlib/libc/iconv/ccs/Makefile.am
@@ -45,7 +45,4 @@ noinst_DATA =
 
 SUBDIRS=binary
 
-CHEWOUT_FILES =
-CHAPTERS =
-
 include $(srcdir)/../../../Makefile.shared
diff --git a/newlib/libc/iconv/ces/Makefile.am b/newlib/libc/iconv/ces/Makefile.am
index 21a37b7b8000..9f129c9978b8 100644
--- a/newlib/libc/iconv/ces/Makefile.am
+++ b/newlib/libc/iconv/ces/Makefile.am
@@ -39,6 +39,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
diff --git a/newlib/libc/iconv/iconv.tex b/newlib/libc/iconv/iconv.tex
index 46ced296b907..42d04c0b616f 100644
--- a/newlib/libc/iconv/iconv.tex
+++ b/newlib/libc/iconv/iconv.tex
@@ -21,7 +21,7 @@ The iconv functions declarations are in
 @end menu
 
 @page
-@include iconv/iconv.def
+@include iconv/lib/iconv.def
 
 @page
 @node Introduction to iconv
diff --git a/newlib/libc/iconv/lib/Makefile.am b/newlib/libc/iconv/lib/Makefile.am
index 4e495573a287..0114b2aa3e96 100644
--- a/newlib/libc/iconv/lib/Makefile.am
+++ b/newlib/libc/iconv/lib/Makefile.am
@@ -30,6 +30,3 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
 include $(srcdir)/../../../Makefile.shared
-
-CHEWOUT_FILES = iconv.def
-CHAPTER =
diff --git a/newlib/libc/iconv/lib/Makefile.inc b/newlib/libc/iconv/lib/Makefile.inc
new file mode 100644
index 000000000000..62a2be87ba5e
--- /dev/null
+++ b/newlib/libc/iconv/lib/Makefile.inc
@@ -0,0 +1 @@
+LIBC_CHEWOUT_FILES += %D%/iconv.def
diff --git a/newlib/libc/locale/Makefile.am b/newlib/libc/locale/Makefile.am
index 1fd2530f7c43..3055d0ceb2be 100644
--- a/newlib/libc/locale/Makefile.am
+++ b/newlib/libc/locale/Makefile.am
@@ -36,11 +36,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	duplocale.def \
-	freelocale.def \
-	locale.def \
-	newlocale.def \
-	uselocale.def
-
-CHAPTERS = locale.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/locale/Makefile.inc b/newlib/libc/locale/Makefile.inc
new file mode 100644
index 000000000000..7af1534c8f96
--- /dev/null
+++ b/newlib/libc/locale/Makefile.inc
@@ -0,0 +1,8 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/duplocale.def \
+	%D%/freelocale.def \
+	%D%/locale.def \
+	%D%/newlocale.def \
+	%D%/uselocale.def
+
+LIBC_CHAPTERS += %D%/locale.tex
diff --git a/newlib/libc/misc/Makefile.am b/newlib/libc/misc/Makefile.am
index da4f90f46815..6d9fefaec06b 100644
--- a/newlib/libc/misc/Makefile.am
+++ b/newlib/libc/misc/Makefile.am
@@ -24,5 +24,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = unctrl.def lock.def ffs.def
-CHAPTERS = misc.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/misc/Makefile.inc b/newlib/libc/misc/Makefile.inc
new file mode 100644
index 000000000000..54a53efff220
--- /dev/null
+++ b/newlib/libc/misc/Makefile.inc
@@ -0,0 +1,6 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/ffs.def \
+	%D%/lock.def \
+	%D%/unctrl.def
+
+LIBC_CHAPTERS += %D%/misc.tex
diff --git a/newlib/libc/posix/Makefile.am b/newlib/libc/posix/Makefile.am
index 5fb1fa2afa1c..984ae7fb5ac0 100644
--- a/newlib/libc/posix/Makefile.am
+++ b/newlib/libc/posix/Makefile.am
@@ -49,10 +49,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	popen.def \
-	posix_spawn.def
-
-CHAPTERS = posix.tex
+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/posix/Makefile.inc b/newlib/libc/posix/Makefile.inc
new file mode 100644
index 000000000000..74539dddbe72
--- /dev/null
+++ b/newlib/libc/posix/Makefile.inc
@@ -0,0 +1,5 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/popen.def \
+	%D%/posix_spawn.def
+
+LIBC_CHAPTERS += %D%/posix.tex
diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am
index 622a74c82cea..dad7efdbeb41 100644
--- a/newlib/libc/reent/Makefile.am
+++ b/newlib/libc/reent/Makefile.am
@@ -61,30 +61,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = \
-	closer.def \
-	reent.def \
-	execr.def \
-	fcntlr.def \
-	fstat64r.def \
-	fstatr.def \
-	gettimeofdayr.def \
-	linkr.def \
-	lseek64r.def \
-	lseekr.def \
-	mkdirr.def \
-	open64r.def \
-	openr.def \
-	readr.def \
-	renamer.def \
-	signalr.def \
-	sbrkr.def \
-	stat64r.def \
-	statr.def \
-	timesr.def \
-	unlinkr.def \
-	writer.def
-
-CHAPTERS = reent.tex
+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/reent/Makefile.inc b/newlib/libc/reent/Makefile.inc
new file mode 100644
index 000000000000..975a8d82a83a
--- /dev/null
+++ b/newlib/libc/reent/Makefile.inc
@@ -0,0 +1,25 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/closer.def \
+	%D%/reent.def \
+	%D%/execr.def \
+	%D%/fcntlr.def \
+	%D%/fstatr.def \
+	%D%/gettimeofdayr.def \
+	%D%/linkr.def \
+	%D%/lseekr.def \
+	%D%/mkdirr.def \
+	%D%/openr.def \
+	%D%/readr.def \
+	%D%/renamer.def \
+	%D%/signalr.def \
+	%D%/sbrkr.def \
+	%D%/statr.def \
+	%D%/timesr.def \
+	%D%/unlinkr.def \
+	%D%/fstat64r.def \
+	%D%/lseek64r.def \
+	%D%/stat64r.def \
+	%D%/open64r.def \
+	%D%/writer.def
+
+LIBC_CHAPTERS += %D%/reent.tex
diff --git a/newlib/libc/search/Makefile.am b/newlib/libc/search/Makefile.am
index 5c5e0dcf6264..eedb2bad6cb2 100644
--- a/newlib/libc/search/Makefile.am
+++ b/newlib/libc/search/Makefile.am
@@ -61,11 +61,10 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES = \
-	bsearch.def \
-	qsort.def \
-	qsort_r.def
-
-CHAPTERS =
-
 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/search/Makefile.inc b/newlib/libc/search/Makefile.inc
new file mode 100644
index 000000000000..a1704539b04c
--- /dev/null
+++ b/newlib/libc/search/Makefile.inc
@@ -0,0 +1,4 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/bsearch.def \
+	%D%/qsort.def \
+	%D%/qsort_r.def
diff --git a/newlib/libc/signal/Makefile.am b/newlib/libc/signal/Makefile.am
index 4b5bc209ca26..fdcd17d7e10b 100644
--- a/newlib/libc/signal/Makefile.am
+++ b/newlib/libc/signal/Makefile.am
@@ -19,6 +19,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES = psignal.def raise.def signal.def sig2str.def
-
-CHAPTERS = signal.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/signal/Makefile.inc b/newlib/libc/signal/Makefile.inc
new file mode 100644
index 000000000000..e0da75349a18
--- /dev/null
+++ b/newlib/libc/signal/Makefile.inc
@@ -0,0 +1,7 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/psignal.def \
+	%D%/raise.def \
+	%D%/signal.def \
+	%D%/sig2str.def
+
+LIBC_CHAPTERS += %D%/signal.tex
diff --git a/newlib/libc/ssp/Makefile.am b/newlib/libc/ssp/Makefile.am
index 937741cd62d2..da5573202f04 100644
--- a/newlib/libc/ssp/Makefile.am
+++ b/newlib/libc/ssp/Makefile.am
@@ -61,7 +61,10 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS = ssp.tex
-
 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.inc b/newlib/libc/ssp/Makefile.inc
new file mode 100644
index 000000000000..e87115b50025
--- /dev/null
+++ b/newlib/libc/ssp/Makefile.inc
@@ -0,0 +1,3 @@
+LIBC_CHEWOUT_FILES +=
+
+LIBC_CHAPTERS += %D%/ssp.tex
diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am
index 30339033c8f6..c8d5f010fbe1 100644
--- a/newlib/libc/stdio/Makefile.am
+++ b/newlib/libc/stdio/Makefile.am
@@ -6,91 +6,91 @@ if NEWLIB_NANO_FORMATTED_IO
 GENERAL_INT_FORMATTED_IO_SOURCES =
 else
 GENERAL_INT_FORMATTED_IO_SOURCES = \
-	fiprintf.c			\
-	fiscanf.c			\
-	iprintf.c			\
-	iscanf.c			\
-	siprintf.c			\
-	siscanf.c			\
-	sniprintf.c			\
-	vdiprintf.c			\
-	vfprintf.c			\
-	vfwprintf.c			\
-	viprintf.c			\
-	viscanf.c			\
-	vsiprintf.c			\
-	vsiscanf.c			\
-	vsniprintf.c
+	%D%/fiprintf.c			\
+	%D%/fiscanf.c			\
+	%D%/iprintf.c			\
+	%D%/iscanf.c			\
+	%D%/siprintf.c			\
+	%D%/siscanf.c			\
+	%D%/sniprintf.c			\
+	%D%/vdiprintf.c			\
+	%D%/vfprintf.c			\
+	%D%/vfwprintf.c			\
+	%D%/viprintf.c			\
+	%D%/viscanf.c			\
+	%D%/vsiprintf.c			\
+	%D%/vsiscanf.c			\
+	%D%/vsniprintf.c
 endif
 
 GENERAL_SOURCES = \
-	$(GENERAL_INT_FORMATTED_IO_SOURCES) \
-	clearerr.c			\
-	fclose.c			\
-	fdopen.c			\
-	feof.c				\
-	ferror.c			\
-	fflush.c			\
-	fgetc.c			\
-	fgetpos.c			\
-	fgets.c			\
-	fileno.c			\
-	findfp.c			\
-	flags.c			\
-	fopen.c			\
-	fprintf.c			\
-	fputc.c			\
-	fputs.c			\
-	fread.c			\
-	freopen.c			\
-	fscanf.c			\
-	fseek.c			\
-	fsetpos.c			\
-	ftell.c			\
-	fvwrite.c			\
-	fwalk.c			\
-	fwrite.c			\
-	getc.c				\
-	getchar.c			\
-	getc_u.c			\
-	getchar_u.c			\
-	getdelim.c			\
-	getline.c			\
-	gets.c				\
-	makebuf.c			\
-	perror.c			\
-	printf.c			\
-	putc.c				\
-	putchar.c			\
-	putc_u.c			\
-	putchar_u.c			\
-	puts.c				\
-	refill.c			\
-	remove.c			\
-	rename.c			\
-	rewind.c			\
-	rget.c				\
-	scanf.c			\
-	sccl.c				\
-	setbuf.c			\
-	setbuffer.c			\
-	setlinebuf.c			\
-	setvbuf.c			\
-	snprintf.c			\
-	sprintf.c			\
-	sscanf.c			\
-	stdio.c			\
-	tmpfile.c			\
-	tmpnam.c			\
-	ungetc.c			\
-	vdprintf.c			\
-	vprintf.c			\
-	vscanf.c			\
-	vsnprintf.c			\
-	vsprintf.c			\
-	vsscanf.c			\
-	wbuf.c				\
-	wsetup.c
+	%D%/$(GENERAL_INT_FORMATTED_IO_SOURCES) \
+	%D%/clearerr.c			\
+	%D%/fclose.c			\
+	%D%/fdopen.c			\
+	%D%/feof.c				\
+	%D%/ferror.c			\
+	%D%/fflush.c			\
+	%D%/fgetc.c			\
+	%D%/fgetpos.c			\
+	%D%/fgets.c			\
+	%D%/fileno.c			\
+	%D%/findfp.c			\
+	%D%/flags.c			\
+	%D%/fopen.c			\
+	%D%/fprintf.c			\
+	%D%/fputc.c			\
+	%D%/fputs.c			\
+	%D%/fread.c			\
+	%D%/freopen.c			\
+	%D%/fscanf.c			\
+	%D%/fseek.c			\
+	%D%/fsetpos.c			\
+	%D%/ftell.c			\
+	%D%/fvwrite.c			\
+	%D%/fwalk.c			\
+	%D%/fwrite.c			\
+	%D%/getc.c				\
+	%D%/getchar.c			\
+	%D%/getc_u.c			\
+	%D%/getchar_u.c			\
+	%D%/getdelim.c			\
+	%D%/getline.c			\
+	%D%/gets.c				\
+	%D%/makebuf.c			\
+	%D%/perror.c			\
+	%D%/printf.c			\
+	%D%/putc.c				\
+	%D%/putchar.c			\
+	%D%/putc_u.c			\
+	%D%/putchar_u.c			\
+	%D%/puts.c				\
+	%D%/refill.c			\
+	%D%/remove.c			\
+	%D%/rename.c			\
+	%D%/rewind.c			\
+	%D%/rget.c				\
+	%D%/scanf.c			\
+	%D%/sccl.c				\
+	%D%/setbuf.c			\
+	%D%/setbuffer.c			\
+	%D%/setlinebuf.c			\
+	%D%/setvbuf.c			\
+	%D%/snprintf.c			\
+	%D%/sprintf.c			\
+	%D%/sscanf.c			\
+	%D%/stdio.c			\
+	%D%/tmpfile.c			\
+	%D%/tmpnam.c			\
+	%D%/ungetc.c			\
+	%D%/vdprintf.c			\
+	%D%/vprintf.c			\
+	%D%/vscanf.c			\
+	%D%/vsnprintf.c			\
+	%D%/vsprintf.c			\
+	%D%/vsscanf.c			\
+	%D%/wbuf.c				\
+	%D%/wsetup.c
 
 ## The following are EL/IX level 2 interfaces
 if ELIX_LEVEL_1
@@ -100,20 +100,20 @@ if NEWLIB_NANO_FORMATTED_IO
 ELIX_2_INT_FORMATTED_IO_SOURCES =
 else
 ELIX_2_INT_FORMATTED_IO_SOURCES = \
-	asiprintf.c		\
-	vasiprintf.c
+	%D%/asiprintf.c		\
+	%D%/vasiprintf.c
 
 endif !NEWLIB_NANO_FORMATTED_IO
 ELIX_2_SOURCES = \
-	$(ELIX_2_INT_FORMATTED_IO_SOURCES) \
-	asprintf.c		\
-	fcloseall.c		\
-	fseeko.c		\
-	ftello.c		\
-	getw.c			\
-	mktemp.c		\
-	putw.c			\
-	vasprintf.c
+	%D%/$(ELIX_2_INT_FORMATTED_IO_SOURCES) \
+	%D%/asprintf.c		\
+	%D%/fcloseall.c		\
+	%D%/fseeko.c		\
+	%D%/ftello.c		\
+	%D%/getw.c			\
+	%D%/mktemp.c		\
+	%D%/putw.c			\
+	%D%/vasprintf.c
 endif !ELIX_LEVEL_1
 
 ## The following are EL/IX level 2 interfaces
@@ -130,62 +130,62 @@ if NEWLIB_NANO_FORMATTED_IO
 ELIX_4_INT_FORMATTED_IO_SOURCES =
 else
 ELIX_4_INT_FORMATTED_IO_SOURCES = \
-	asniprintf.c		\
-	diprintf.c		\
-	vasniprintf.c
+	%D%/asniprintf.c		\
+	%D%/diprintf.c		\
+	%D%/vasniprintf.c
 
 endif !NEWLIB_NANO_FORMATTED_IO
 ELIX_4_SOURCES = \
-	$(ELIX_4_INT_FORMATTED_IO_SOURCES) \
-	asnprintf.c		\
-	clearerr_u.c		\
-	dprintf.c		\
-	feof_u.c		\
-	ferror_u.c		\
-	fflush_u.c		\
-	fgetc_u.c		\
-	fgets_u.c		\
-	fgetwc.c		\
-	fgetwc_u.c		\
-	fgetws.c		\
-	fgetws_u.c		\
-	fileno_u.c		\
-	fmemopen.c		\
-	fopencookie.c		\
-	fpurge.c		\
-	fputc_u.c		\
-	fputs_u.c		\
-	fputwc.c		\
-	fputwc_u.c		\
-	fputws.c		\
-	fputws_u.c		\
-	fread_u.c		\
-	fsetlocking.c		\
-	funopen.c		\
-	fwide.c			\
-	fwprintf.c		\
-	fwrite_u.c		\
-	fwscanf.c		\
-	getwc.c			\
-	getwc_u.c		\
-	getwchar.c		\
-	getwchar_u.c		\
-	open_memstream.c	\
-	putwc.c			\
-	putwc_u.c		\
-	putwchar.c		\
-	putwchar_u.c		\
-	stdio_ext.c		\
-	swprintf.c		\
-	swscanf.c		\
-	ungetwc.c		\
-	vasnprintf.c		\
-	vswprintf.c		\
-	vswscanf.c		\
-	vwprintf.c		\
-	vwscanf.c		\
-	wprintf.c		\
-	wscanf.c
+	%D%/$(ELIX_4_INT_FORMATTED_IO_SOURCES) \
+	%D%/asnprintf.c		\
+	%D%/clearerr_u.c		\
+	%D%/dprintf.c		\
+	%D%/feof_u.c		\
+	%D%/ferror_u.c		\
+	%D%/fflush_u.c		\
+	%D%/fgetc_u.c		\
+	%D%/fgets_u.c		\
+	%D%/fgetwc.c		\
+	%D%/fgetwc_u.c		\
+	%D%/fgetws.c		\
+	%D%/fgetws_u.c		\
+	%D%/fileno_u.c		\
+	%D%/fmemopen.c		\
+	%D%/fopencookie.c		\
+	%D%/fpurge.c		\
+	%D%/fputc_u.c		\
+	%D%/fputs_u.c		\
+	%D%/fputwc.c		\
+	%D%/fputwc_u.c		\
+	%D%/fputws.c		\
+	%D%/fputws_u.c		\
+	%D%/fread_u.c		\
+	%D%/fsetlocking.c		\
+	%D%/funopen.c		\
+	%D%/fwide.c			\
+	%D%/fwprintf.c		\
+	%D%/fwrite_u.c		\
+	%D%/fwscanf.c		\
+	%D%/getwc.c			\
+	%D%/getwc_u.c		\
+	%D%/getwchar.c		\
+	%D%/getwchar_u.c		\
+	%D%/open_memstream.c	\
+	%D%/putwc.c			\
+	%D%/putwc_u.c		\
+	%D%/putwchar.c		\
+	%D%/putwchar_u.c		\
+	%D%/stdio_ext.c		\
+	%D%/swprintf.c		\
+	%D%/swscanf.c		\
+	%D%/ungetwc.c		\
+	%D%/vasnprintf.c		\
+	%D%/vswprintf.c		\
+	%D%/vswscanf.c		\
+	%D%/vwprintf.c		\
+	%D%/vwscanf.c		\
+	%D%/wprintf.c		\
+	%D%/wscanf.c
 
 endif !ELIX_LEVEL_3
 endif !ELIX_LEVEL_2
@@ -193,31 +193,31 @@ endif !ELIX_LEVEL_1
 
 if NEWLIB_NANO_FORMATTED_IO
 LIBADD_OBJS = \
-	$(lpfx)nano-vfprintf_float.$(oext)	\
-	$(lpfx)nano-svfprintf.$(oext)		\
-	$(lpfx)nano-svfscanf.$(oext)		\
-	$(lpfx)nano-vfprintf.$(oext)		\
-	$(lpfx)nano-vfprintf_i.$(oext)		\
-	$(lpfx)nano-vfscanf.$(oext)		\
-	$(lpfx)nano-vfscanf_i.$(oext)		\
-	$(lpfx)nano-vfscanf_float.$(oext)	\
-	$(lpfx)svfiwprintf.$(oext)		\
-	$(lpfx)svfwprintf.$(oext)		\
-	$(lpfx)vfiwprintf.$(oext)		\
-	$(lpfx)svfiwscanf.$(oext)		\
-	$(lpfx)svfwscanf.$(oext)		\
-	$(lpfx)vfiwscanf.$(oext)		\
-	$(lpfx)vfwscanf.$(oext)
+	%D%/$(lpfx)nano-vfprintf_float.$(oext)	\
+	%D%/$(lpfx)nano-svfprintf.$(oext)		\
+	%D%/$(lpfx)nano-svfscanf.$(oext)		\
+	%D%/$(lpfx)nano-vfprintf.$(oext)		\
+	%D%/$(lpfx)nano-vfprintf_i.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf_i.$(oext)		\
+	%D%/$(lpfx)nano-vfscanf_float.$(oext)	\
+	%D%/$(lpfx)svfiwprintf.$(oext)		\
+	%D%/$(lpfx)svfwprintf.$(oext)		\
+	%D%/$(lpfx)vfiwprintf.$(oext)		\
+	%D%/$(lpfx)svfiwscanf.$(oext)		\
+	%D%/$(lpfx)svfwscanf.$(oext)		\
+	%D%/$(lpfx)vfiwscanf.$(oext)		\
+	%D%/$(lpfx)vfwscanf.$(oext)
 else
 LIBADD_OBJS = \
-	$(lpfx)svfiprintf.$(oext) $(lpfx)svfprintf.$(oext) \
-	$(lpfx)svfiscanf.$(oext) $(lpfx)svfscanf.$(oext) \
-	$(lpfx)vfiprintf.$(oext) \
-	$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext) \
-	$(lpfx)svfiwprintf.$(oext) $(lpfx)svfwprintf.$(oext) \
-	$(lpfx)vfiwprintf.$(oext) \
-	$(lpfx)svfiwscanf.$(oext) $(lpfx)svfwscanf.$(oext) \
-	$(lpfx)vfiwscanf.$(oext) $(lpfx)vfwscanf.$(oext)
+	%D%/$(lpfx)svfiprintf.$(oext) $(lpfx)svfprintf.$(oext) \
+	%D%/$(lpfx)svfiscanf.$(oext) $(lpfx)svfscanf.$(oext) \
+	%D%/$(lpfx)vfiprintf.$(oext) \
+	%D%/$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext) \
+	%D%/$(lpfx)svfiwprintf.$(oext) $(lpfx)svfwprintf.$(oext) \
+	%D%/$(lpfx)vfiwprintf.$(oext) \
+	%D%/$(lpfx)svfiwscanf.$(oext) $(lpfx)svfwscanf.$(oext) \
+	%D%/$(lpfx)vfiwscanf.$(oext) $(lpfx)vfwscanf.$(oext)
 endif
 
 libstdio_la_LDFLAGS = -Xcompiler -nostdlib
@@ -241,6 +241,11 @@ 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
@@ -252,158 +257,77 @@ include $(srcdir)/../../Makefile.shared
 if NEWLIB_NANO_FORMATTED_IO
 # Rules compiling small-footprint nano-formatted-io implementation.
 $(lpfx)nano-vfprintf.$(oext): nano-vfprintf.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf.c -o $@
 
 $(lpfx)nano-vfprintf_i.$(oext): nano-vfprintf_i.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_i.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_i.c -o $@
 
 $(lpfx)nano-vfprintf_float.$(oext): nano-vfprintf_float.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_float.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfprintf_float.c -o $@
 
 $(lpfx)nano-svfprintf.$(oext): nano-vfprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfprintf.c -o $@
 endif
 
 # This rule is needed so that libtool compiles vfiprintf before vfprintf.
 # Otherwise libtool moves vfprintf.o and subsequently can't find it.
 
 $(lpfx)vfiprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)svfprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)svfiprintf.$(oext): vfprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
 
 $(lpfx)vfiwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 $(lpfx)svfwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 $(lpfx)svfiwprintf.$(oext): vfwprintf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwprintf.c -o $@
 
 if NEWLIB_NANO_FORMATTED_IO
 # Rules compiling small-footprint nano-formatted-io implementation.
 $(lpfx)nano-vfscanf.$(oext): nano-vfscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf.c -o $@
 
 $(lpfx)nano-vfscanf_i.$(oext): nano-vfscanf_i.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_i.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_i.c -o $@
 
 $(lpfx)nano-vfscanf_float.$(oext): nano-vfscanf_float.c
-	$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_float.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/nano-vfscanf_float.c -o $@
 
 $(lpfx)nano-svfscanf.$(oext): nano-vfscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/nano-vfscanf.c -o $@
 endif
 
 $(lpfx)vfscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)vfiscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)svfscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)svfiscanf.$(oext): vfscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
 
 $(lpfx)vfwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)vfiwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)svfwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
+	%D%/$(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)svfiwscanf.$(oext): vfwscanf.c
-	$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
-
-CHEWOUT_FILES = \
-	clearerr.def		\
-	diprintf.def		\
-	dprintf.def		\
-	fclose.def		\
-	fcloseall.def		\
-	fdopen.def		\
-	feof.def		\
-	ferror.def		\
-	fflush.def		\
-	fgetc.def		\
-	fgetpos.def		\
-	fgets.def		\
-	fgetwc.def		\
-	fgetws.def		\
-	fileno.def		\
-	fmemopen.def		\
-	fopen.def		\
-	fopencookie.def		\
-	fpurge.def		\
-	fputc.def		\
-	fputs.def		\
-	fputwc.def		\
-	fputws.def		\
-	fread.def		\
-	freopen.def		\
-	fseek.def		\
-	fsetlocking.def		\
-	fsetpos.def		\
-	ftell.def		\
-	funopen.def		\
-	fwide.def		\
-	fwrite.def		\
-	getc.def		\
-	getc_u.def		\
-	getchar.def		\
-	getchar_u.def		\
-	getdelim.def		\
-	getline.def		\
-	gets.def		\
-	getw.def		\
-	getwchar.def		\
-	mktemp.def		\
-	nano-vfprintf.def	\
-	nano-vfscanf.def	\
-	open_memstream.def	\
-	perror.def		\
-	putc.def		\
-	putc_u.def		\
-	putchar.def		\
-	putchar_u.def		\
-	puts.def		\
-	putw.def		\
-	putwchar.def		\
-	remove.def		\
-	rename.def		\
-	rewind.def		\
-	setbuf.def		\
-	setbuffer.def		\
-	setlinebuf.def		\
-	setvbuf.def		\
-	siprintf.def		\
-	siscanf.def		\
-	sprintf.def		\
-	sscanf.def		\
-	stdio_ext.def		\
-	swprintf.def		\
-	swscanf.def		\
-	tmpfile.def		\
-	tmpnam.def		\
-	ungetc.def		\
-	ungetwc.def		\
-	vfprintf.def		\
-	vfscanf.def		\
-	vfwprintf.def		\
-	vfwscanf.def		\
-	viprintf.def		\
-	viscanf.def
-
-CHAPTERS = stdio.tex
+	%D%/$(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfwscanf.c -o $@
 
 $(lpfx)clearerr.$(oext): local.h
 $(lpfx)clearerr_u.$(oext): local.h
diff --git a/newlib/libc/stdio/Makefile.inc b/newlib/libc/stdio/Makefile.inc
new file mode 100644
index 000000000000..2e1b8c416ddf
--- /dev/null
+++ b/newlib/libc/stdio/Makefile.inc
@@ -0,0 +1,80 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/clearerr.def \
+	%D%/diprintf.def \
+	%D%/dprintf.def \
+	%D%/fcloseall.def \
+	%D%/fclose.def \
+	%D%/fdopen.def \
+	%D%/feof.def \
+	%D%/ferror.def \
+	%D%/fflush.def \
+	%D%/fgetc.def \
+	%D%/fgetpos.def \
+	%D%/fgets.def \
+	%D%/fgetwc.def \
+	%D%/fgetws.def \
+	%D%/fileno.def \
+	%D%/fmemopen.def \
+	%D%/fopen.def \
+	%D%/fopencookie.def \
+	%D%/fpurge.def \
+	%D%/fputc.def \
+	%D%/fputs.def \
+	%D%/fputwc.def \
+	%D%/fputws.def \
+	%D%/fread.def \
+	%D%/freopen.def \
+	%D%/fseek.def \
+	%D%/fsetlocking.def \
+	%D%/fsetpos.def \
+	%D%/ftell.def \
+	%D%/funopen.def \
+	%D%/fwide.def \
+	%D%/fwrite.def \
+	%D%/getc.def \
+	%D%/getc_u.def \
+	%D%/getchar.def \
+	%D%/getchar_u.def \
+	%D%/getdelim.def \
+	%D%/getline.def \
+	%D%/gets.def \
+	%D%/getw.def \
+	%D%/getwchar.def \
+	%D%/mktemp.def \
+	%D%/nano-vfprintf.def \
+	%D%/nano-vfscanf.def \
+	%D%/open_memstream.def \
+	%D%/perror.def \
+	%D%/putc.def \
+	%D%/putc_u.def \
+	%D%/putchar.def \
+	%D%/putchar_u.def \
+	%D%/puts.def \
+	%D%/putw.def \
+	%D%/putwchar.def \
+	%D%/remove.def \
+	%D%/rename.def \
+	%D%/rewind.def \
+	%D%/setbuf.def \
+	%D%/setbuffer.def \
+	%D%/setlinebuf.def \
+	%D%/setvbuf.def \
+	%D%/siprintf.def \
+	%D%/siscanf.def \
+	%D%/sprintf.def \
+	%D%/sscanf.def \
+	%D%/stdio_ext.def \
+	%D%/swprintf.def \
+	%D%/swscanf.def \
+	%D%/tmpfile.def \
+	%D%/tmpnam.def \
+	%D%/ungetc.def \
+	%D%/ungetwc.def \
+	%D%/vfprintf.def \
+	%D%/vfscanf.def \
+	%D%/vfwprintf.def \
+	%D%/vfwscanf.def \
+	%D%/viprintf.def \
+	%D%/viscanf.def
+
+LIBC_CHAPTERS += %D%/stdio.tex
diff --git a/newlib/libc/stdio64/Makefile.am b/newlib/libc/stdio64/Makefile.am
index 074107e0c5ae..56ddbe31f052 100644
--- a/newlib/libc/stdio64/Makefile.am
+++ b/newlib/libc/stdio64/Makefile.am
@@ -38,16 +38,10 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-AM_CFLAGS = -I $(srcdir)/../stdio
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
-CHEWOUT_FILES = \
-	fdopen64.def		\
-	fgetpos64.def		\
-	fopen64.def		\
-	freopen64.def		\
-	fseeko64.def		\
-	fsetpos64.def		\
-	ftello64.def		\
-	tmpfile64.def
-
-CHAPTERS = stdio64.tex
+AM_CFLAGS = -I $(srcdir)/../stdio
diff --git a/newlib/libc/stdio64/Makefile.inc b/newlib/libc/stdio64/Makefile.inc
new file mode 100644
index 000000000000..bfe252766f81
--- /dev/null
+++ b/newlib/libc/stdio64/Makefile.inc
@@ -0,0 +1,11 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/fdopen64.def \
+	%D%/fgetpos64.def \
+	%D%/fopen64.def \
+	%D%/freopen64.def \
+	%D%/fseeko64.def \
+	%D%/fsetpos64.def \
+	%D%/ftello64.def \
+	%D%/tmpfile64.def
+
+LIBC_CHAPTERS += %D%/stdio64.tex
diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am
index f0e3b0003915..b88aee40b9f9 100644
--- a/newlib/libc/stdlib/Makefile.am
+++ b/newlib/libc/stdlib/Makefile.am
@@ -222,6 +222,12 @@ 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
@@ -260,58 +266,6 @@ $(lpfx)$(MSIZER).$(oext): $(MALLOCR).c
 $(lpfx)$(MALLOPTR).$(oext): $(MALLOCR).c
 	$(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@
 
-CHEWOUT_FILES= \
-	_Exit.def	\
-	a64l.def	\
-	abort.def	\
-	abs.def		\
-	assert.def	\
-	atexit.def	\
-	atof.def 	\
-	atoi.def 	\
-	atoll.def 	\
-	calloc.def	\
-	div.def		\
-	ecvtbuf.def	\
-	efgcvt.def 	\
-	envlock.def	\
-	exit.def	\
-	getenv.def	\
-	itoa.def	\
-	labs.def	\
-	ldiv.def	\
-	llabs.def	\
-	lldiv.def	\
-	malloc.def	\
-	mblen.def	\
-	mbsnrtowcs.def	\
-	mbstowcs.def	\
-	mbtowc.def	\
-	mlock.def	\
-	mstats.def	\
-	on_exit.def	\
-	rand.def	\
-	rand48.def	\
-	random.def	\
-	rpmatch.def	\
-	strtod.def 	\
-	strtol.def 	\
-	strtoll.def 	\
-	strtoul.def 	\
-	strtoull.def 	\
-	utoa.def	\
-	wcsnrtombs.def	\
-	wcstod.def 	\
-	wcstol.def 	\
-	wcstoll.def 	\
-	wcstoul.def 	\
-	wcstoull.def 	\
-	system.def	\
-	wcstombs.def	\
-	wctomb.def	
-
-CHAPTERS = stdlib.tex
-
 $(lpfx)dtoa.$(oext): dtoa.c mprec.h
 $(lpfx)ldtoa.$(oext): ldtoa.c mprec.h gdtoa.h
 $(lpfx)gdtoa-ldtoa.$(oext): gdtoa-ldtoa.c mprec.h gdtoaimp.h gdtoa.h
diff --git a/newlib/libc/stdlib/Makefile.inc b/newlib/libc/stdlib/Makefile.inc
new file mode 100644
index 000000000000..d2f199d8cab3
--- /dev/null
+++ b/newlib/libc/stdlib/Makefile.inc
@@ -0,0 +1,51 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/_Exit.def \
+	%D%/a64l.def \
+	%D%/abort.def \
+	%D%/abs.def \
+	%D%/assert.def \
+	%D%/atexit.def \
+	%D%/atof.def \
+	%D%/atoi.def \
+	%D%/atoll.def \
+	%D%/calloc.def \
+	%D%/div.def \
+	%D%/ecvtbuf.def \
+	%D%/efgcvt.def \
+	%D%/envlock.def \
+	%D%/exit.def \
+	%D%/getenv.def \
+	%D%/itoa.def \
+	%D%/labs.def \
+	%D%/ldiv.def \
+	%D%/llabs.def \
+	%D%/lldiv.def \
+	%D%/malloc.def \
+	%D%/mblen.def \
+	%D%/mbsnrtowcs.def \
+	%D%/mbstowcs.def \
+	%D%/mbtowc.def \
+	%D%/mlock.def \
+	%D%/mstats.def \
+	%D%/on_exit.def \
+	%D%/rand.def \
+	%D%/rand48.def \
+	%D%/random.def \
+	%D%/rpmatch.def \
+	%D%/strtod.def \
+	%D%/strtol.def \
+	%D%/strtoll.def \
+	%D%/strtoul.def \
+	%D%/strtoull.def \
+	%D%/utoa.def \
+	%D%/wcsnrtombs.def \
+	%D%/wcstod.def \
+	%D%/wcstol.def \
+	%D%/wcstoll.def \
+	%D%/wcstoul.def \
+	%D%/wcstoull.def \
+	%D%/system.def \
+	%D%/wcstombs.def \
+	%D%/wctomb.def
+
+LIBC_CHAPTERS += %D%/stdlib.tex
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
index 7eb9fcdbcf6a..d85a51365c34 100644
--- a/newlib/libc/string/Makefile.am
+++ b/newlib/libc/string/Makefile.am
@@ -144,25 +144,8 @@ endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
 
-CHEWOUT_FILES=\
-bcmp.def	memcpy.def	strcmp.def	strncat.def strstr.def \
-bcopy.def	memmove.def	strcoll.def	strncmp.def strtok.def \
-bzero.def	memset.def	strcpy.def	strncpy.def strxfrm.def \
-index.def	rindex.def	strcspn.def	strpbrk.def swab.def \
-memchr.def	strcat.def	strerror.def	strerror_r.def strrchr.def \
-memcmp.def	strchr.def	strlen.def	strnlen.def strspn.def \
-strcasecmp.def	strncasecmp.def strcasestr.def	strlwr.def  strupr.def \
-memccpy.def 	mempcpy.def	stpcpy.def	stpncpy.def strsignal.def \
-wcscasecmp.def	wcscat.def	wcschr.def	wcscmp.def wcscoll.def \
-wcscpy.def	wcscspn.def	wcpcpy.def	wcpncpy.def wcsdup.def \
-wcslcat.def	wcslcpy.def	wcslen.def	wcsncasecmp.def wcsncat.def \
-wcsncmp.def	wcsncpy.def	wcsnlen.def	wcspbrk.def \
-wcsrchr.def	wcsspn.def	wcsstr.def 	wcstok.def  \
-wcswidth.def	wcsxfrm.def	wcwidth.def	wmemchr.def \
-wmemcmp.def	wmemcpy.def	wmemmove.def	wmemset.def \
-memmem.def	memrchr.def	rawmemchr.def	strchrnul.def \
-strcasecmp_l.def strcoll_l.def	strncasecmp_l.def strxfrm_l.def \
-wcscasecmp_l.def wcscoll_l.def	wcsncasecmp_l.def wcsxfrm_l.def \
-strverscmp.def	strnstr.def	wmempcpy.def
-
-CHAPTERS = strings.tex wcstrings.tex
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
diff --git a/newlib/libc/string/Makefile.inc b/newlib/libc/string/Makefile.inc
new file mode 100644
index 000000000000..5bcec8dd4ca6
--- /dev/null
+++ b/newlib/libc/string/Makefile.inc
@@ -0,0 +1,22 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/bcmp.def	%D%/memcpy.def	%D%/strcmp.def	%D%/strncat.def %D%/strstr.def \
+	%D%/bcopy.def	%D%/memmove.def	%D%/strcoll.def	%D%/strncmp.def %D%/strtok.def \
+	%D%/bzero.def	%D%/memset.def	%D%/strcpy.def	%D%/strncpy.def %D%/strxfrm.def \
+	%D%/index.def	%D%/rindex.def	%D%/strcspn.def	%D%/strpbrk.def %D%/swab.def \
+	%D%/memchr.def	%D%/strcat.def	%D%/strerror.def	%D%/strerror_r.def %D%/strrchr.def \
+	%D%/memcmp.def	%D%/strchr.def	%D%/strlen.def	%D%/strnlen.def %D%/strspn.def \
+	%D%/strcasecmp.def	%D%/strncasecmp.def %D%/strcasestr.def	%D%/strlwr.def  %D%/strupr.def \
+	%D%/memccpy.def 	%D%/mempcpy.def	%D%/stpcpy.def	%D%/stpncpy.def %D%/strsignal.def \
+	%D%/wcscasecmp.def	%D%/wcscat.def	%D%/wcschr.def	%D%/wcscmp.def %D%/wcscoll.def \
+	%D%/wcscpy.def	%D%/wcscspn.def	%D%/wcpcpy.def	%D%/wcpncpy.def %D%/wcsdup.def \
+	%D%/wcslcat.def	%D%/wcslcpy.def	%D%/wcslen.def	%D%/wcsncasecmp.def %D%/wcsncat.def \
+	%D%/wcsncmp.def	%D%/wcsncpy.def	%D%/wcsnlen.def	%D%/wcspbrk.def \
+	%D%/wcsrchr.def	%D%/wcsspn.def	%D%/wcsstr.def 	%D%/wcstok.def  \
+	%D%/wcswidth.def	%D%/wcsxfrm.def	%D%/wcwidth.def	%D%/wmemchr.def \
+	%D%/wmemcmp.def	%D%/wmemcpy.def	%D%/wmemmove.def	%D%/wmemset.def \
+	%D%/memmem.def	%D%/memrchr.def	%D%/rawmemchr.def	%D%/strchrnul.def \
+	%D%/strcasecmp_l.def %D%/strcoll_l.def	%D%/strncasecmp_l.def %D%/strxfrm_l.def \
+	%D%/wcscasecmp_l.def %D%/wcscoll_l.def	%D%/wcsncasecmp_l.def %D%/wcsxfrm_l.def \
+	%D%/strverscmp.def	%D%/strnstr.def	%D%/wmempcpy.def
+
+LIBC_CHAPTERS += %D%/strings.tex %D%/wcstrings.tex
diff --git a/newlib/libc/syscalls/Makefile.am b/newlib/libc/syscalls/Makefile.am
index 5895be430929..ada372a7aa1c 100644
--- a/newlib/libc/syscalls/Makefile.am
+++ b/newlib/libc/syscalls/Makefile.am
@@ -49,7 +49,3 @@ noinst_DATA =
 endif
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for syscalls.
diff --git a/newlib/libc/time/Makefile.am b/newlib/libc/time/Makefile.am
index 8871d1afb41f..e9dcee44c4c7 100644
--- a/newlib/libc/time/Makefile.am
+++ b/newlib/libc/time/Makefile.am
@@ -42,20 +42,10 @@ endif # USE_LIBTOOL
 # This rule is needed so that wcsftime.o is rebuilt when strftime.c changes.
 include $(srcdir)/../../Makefile.shared
 
-$(lpfx)wcsftime.$(oext): strftime.c
-
-CHEWOUT_FILES = \
-	asctime.def	\
-	clock.def 	\
-	ctime.def	\
-	difftime.def	\
-	gmtime.def	\
-	lcltime.def	\
-	mktime.def	\
-	strftime.def	\
-	time.def	\
-	tzlock.def	\
-	tzset.def	\
-	wcsftime.def
+LIBC_CHEWOUT_FILES =
+LIBC_CHAPTERS =
+include ./Makefile.inc
+CHEWOUT_FILES = $(LIBC_CHEWOUT_FILES)
+CHAPTERS = $(LIBC_CHAPTERS)
 
-CHAPTERS = time.tex
+$(lpfx)wcsftime.$(oext): strftime.c
diff --git a/newlib/libc/time/Makefile.inc b/newlib/libc/time/Makefile.inc
new file mode 100644
index 000000000000..3e7ba4157ea1
--- /dev/null
+++ b/newlib/libc/time/Makefile.inc
@@ -0,0 +1,15 @@
+LIBC_CHEWOUT_FILES += \
+	%D%/asctime.def \
+	%D%/clock.def \
+	%D%/ctime.def \
+	%D%/difftime.def \
+	%D%/gmtime.def \
+	%D%/lcltime.def \
+	%D%/mktime.def \
+	%D%/strftime.def \
+	%D%/time.def \
+	%D%/tzlock.def \
+	%D%/tzset.def \
+	%D%/wcsftime.def
+
+LIBC_CHAPTERS += %D%/time.tex
diff --git a/newlib/libc/unix/Makefile.am b/newlib/libc/unix/Makefile.am
index a2d830f1adb3..a74738d74ca0 100644
--- a/newlib/libc/unix/Makefile.am
+++ b/newlib/libc/unix/Makefile.am
@@ -49,7 +49,3 @@ noinst_DATA =
 endif # USE_LIBTOOL
 
 include $(srcdir)/../../Makefile.shared
-
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for unix.
diff --git a/newlib/libc/xdr/Makefile.am b/newlib/libc/xdr/Makefile.am
index ad9968c9acf0..8f4ac7d04a33 100644
--- a/newlib/libc/xdr/Makefile.am
+++ b/newlib/libc/xdr/Makefile.am
@@ -56,8 +56,4 @@ lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 endif # USE_LIBTOOL
 
-CHEWOUT_FILES =
-CHAPTERS =
-# No doc for xdr.
-
 include $(srcdir)/../../Makefile.shared
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 4/5 v3] newlib: move man page generation into top-level build
  2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
  2022-02-01  6:21   ` [PATCH 2/5 v3] newlib: libc: include all chapters all the time in the manual Mike Frysinger
  2022-02-01  6:21   ` [PATCH 3/5 v3] newlib: libc: move manual into top-level build Mike Frysinger
@ 2022-02-01  6:21   ` Mike Frysinger
  2022-02-01 14:37     ` Jon Turney
  2022-02-01  6:21   ` [PATCH 5/5 v3] newlib: drop shared documentation rules Mike Frysinger
  2022-02-05 12:13   ` [PATCH 1/5 v3] newlib: libm: move manual into top-level build Corinna Vinschen
  4 siblings, 1 reply; 25+ messages in thread
From: Mike Frysinger @ 2022-02-01  6:21 UTC (permalink / raw)
  To: newlib

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.
---
v3: use .stamp files for xml generation

 newlib/Makefile.am              |  16 --
 newlib/Makefile.in              |  75 ++++--
 newlib/doc/local.mk             |  12 +
 newlib/libc/Makefile.am         |  78 +-----
 newlib/libc/Makefile.in         | 449 +++-----------------------------
 newlib/libc/Makefile.inc        |  24 +-
 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        |  24 +-
 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, 204 insertions(+), 871 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 afd016b9d74f..955910c9e09f 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)
 
@@ -13,6 +14,25 @@ LIBC_CHAPTERS = %D%/sys.tex
 	$(AM_V_at)touch $@
 %D%/targetdep.tex: %D%/targetdep.tex.stamp; @true
 
+%D%/libc.xml.stamp: %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 $< > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $(@:.stamp=)
+	$(AM_V_at)touch $@
+%D%/libc.xml: %D%/libc.xml.stamp; @true
+
+%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
@@ -31,4 +51,6 @@ include %D%/time/Makefile.inc
 CLEANFILES += \
 	%D%/targetdep.tex \
 	%D%/targetdep.tex.stamp \
-	$(LIBC_CHEWOUT_FILES)
+	$(LIBC_CHEWOUT_FILES) \
+	$(LIBC_DOCBOOK_OUT_FILES) \
+	%D%/*.xml %D%/*.xml.stammp %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 39418cc79ef8..2d591ff97154 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)
 
@@ -13,6 +14,25 @@ LIBM_CHAPTERS =
 	$(AM_V_at)touch $@
 %D%/targetdep.tex: %D%/targetdep.tex.stamp; @true
 
+%D%/libm.xml.stamp: %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 $< > $@.tmp
+	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
+	$(AM_V_at)touch $@
+%D%/libm.xml: %D%/libm.xml.stamp; @true
+
+%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
@@ -25,4 +45,6 @@ endif
 CLEANFILES += \
 	%D%/targetdep.tex \
 	%D%/targetdep.tex.stamp \
-	$(LIBM_CHEWOUT_FILES)
+	$(LIBM_CHEWOUT_FILES) \
+	$(LIBM_DOCBOOK_OUT_FILES) \
+	%D%/*.xml %D%/*.xml.stammp %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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 5/5 v3] newlib: drop shared documentation rules
  2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
                     ` (2 preceding siblings ...)
  2022-02-01  6:21   ` [PATCH 4/5 v3] newlib: move man page generation " Mike Frysinger
@ 2022-02-01  6:21   ` Mike Frysinger
  2022-02-05 12:13   ` [PATCH 1/5 v3] newlib: libm: move manual into top-level build Corinna Vinschen
  4 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-02-01  6:21 UTC (permalink / raw)
  To: newlib

Now that the top-level makefile handles these, don't need to copy
these into every single subdir.
---
 newlib/Makefile.shared                        | 36 -------------------
 newlib/libc/argz/Makefile.in                  | 35 +-----------------
 newlib/libc/ctype/Makefile.in                 | 35 +-----------------
 newlib/libc/errno/Makefile.in                 | 35 +-----------------
 newlib/libc/iconv/Makefile.in                 | 34 ------------------
 newlib/libc/iconv/ccs/Makefile.in             | 35 +-----------------
 newlib/libc/iconv/ccs/binary/Makefile.in      | 34 ------------------
 newlib/libc/iconv/ces/Makefile.in             | 35 +-----------------
 newlib/libc/iconv/lib/Makefile.in             | 35 +-----------------
 newlib/libc/locale/Makefile.in                | 35 +-----------------
 newlib/libc/machine/i386/Makefile.in          | 35 +-----------------
 newlib/libc/misc/Makefile.in                  | 35 +-----------------
 newlib/libc/posix/Makefile.in                 | 35 +-----------------
 newlib/libc/reent/Makefile.in                 | 35 +-----------------
 newlib/libc/search/Makefile.in                | 35 +-----------------
 newlib/libc/signal/Makefile.in                | 35 +-----------------
 newlib/libc/ssp/Makefile.in                   | 35 +-----------------
 newlib/libc/stdio/Makefile.in                 | 35 +-----------------
 newlib/libc/stdio64/Makefile.in               | 35 +-----------------
 newlib/libc/stdlib/Makefile.in                | 35 +-----------------
 newlib/libc/string/Makefile.in                | 35 +-----------------
 newlib/libc/sys/linux/argp/Makefile.in        | 35 +-----------------
 newlib/libc/sys/linux/cmath/Makefile.in       | 35 +-----------------
 newlib/libc/sys/linux/dl/Makefile.in          | 35 +-----------------
 newlib/libc/sys/linux/iconv/Makefile.in       | 35 +-----------------
 newlib/libc/sys/linux/intl/Makefile.in        | 35 +-----------------
 .../libc/sys/linux/linuxthreads/Makefile.in   | 35 +-----------------
 .../linuxthreads/machine/i386/Makefile.in     | 35 +-----------------
 .../libc/sys/linux/machine/i386/Makefile.in   | 35 +-----------------
 newlib/libc/sys/linux/net/Makefile.in         | 35 +-----------------
 newlib/libc/syscalls/Makefile.in              | 35 +-----------------
 newlib/libc/time/Makefile.in                  | 35 +-----------------
 newlib/libc/unix/Makefile.in                  | 35 +-----------------
 newlib/libc/xdr/Makefile.in                   | 35 +-----------------
 newlib/libm/common/Makefile.in                | 35 +-----------------
 newlib/libm/complex/Makefile.in               | 35 +-----------------
 newlib/libm/fenv/Makefile.in                  | 35 +-----------------
 newlib/libm/machine/aarch64/Makefile.in       | 35 +-----------------
 newlib/libm/machine/arm/Makefile.in           | 35 +-----------------
 newlib/libm/machine/i386/Makefile.in          | 35 +-----------------
 newlib/libm/machine/mips/Makefile.in          | 35 +-----------------
 newlib/libm/machine/nds32/Makefile.in         | 35 +-----------------
 newlib/libm/machine/powerpc/Makefile.in       | 35 +-----------------
 newlib/libm/machine/pru/Makefile.in           | 35 +-----------------
 newlib/libm/machine/riscv/Makefile.in         | 35 +-----------------
 newlib/libm/machine/sparc/Makefile.in         | 35 +-----------------
 newlib/libm/machine/spu/Makefile.in           | 35 +-----------------
 newlib/libm/machine/x86_64/Makefile.in        | 35 +-----------------
 newlib/libm/math/Makefile.in                  | 35 +-----------------
 newlib/libm/mathfp/Makefile.in                | 35 +-----------------
 50 files changed, 47 insertions(+), 1702 deletions(-)

diff --git a/newlib/Makefile.shared b/newlib/Makefile.shared
index f1152fc627cf..00ea8533581c 100644
--- a/newlib/Makefile.shared
+++ b/newlib/Makefile.shared
@@ -4,39 +4,3 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
 	do \
 	  echo $$i `pwd`/$$i >> objectlist.awk.in ; \
 	done
-
-#
-# documentation rules
-#
-
-SUFFIXES = .def .xml
-
-CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
-
-.c.def:
-	$(CHEW) < $< > $*.def || ( rm $*.def && false )
-	@touch stmp-def
-
-TARGETDOC ?= ../tmp.texi
-
-doc: $(CHEWOUT_FILES)
-	for chapter in $(CHAPTERS) ; \
-	do \
-	  cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
-	done
-
-DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
-DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
-DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
-
-.c.xml:
-	$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
-	@touch stmp-xml
-
-docbook: $(DOCBOOK_OUT_FILES)
-	for chapter in $(DOCBOOK_CHAPTERS) ; \
-	do \
-	  ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
-	done
-
-CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES)
-- 
2.34.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/5 v2] newlib: libm: move manual into top-level build
  2022-02-01  3:40     ` Mike Frysinger
@ 2022-02-01 14:37       ` Jon Turney
  0 siblings, 0 replies; 25+ messages in thread
From: Jon Turney @ 2022-02-01 14:37 UTC (permalink / raw)
  To: Mike Frysinger, newlib

On 01/02/2022 03:40, Mike Frysinger wrote:
> On 31 Jan 2022 14:58, Jon Turney wrote:
>> On 28/01/2022 07:58, Mike Frysinger wrote:
>>> --- /dev/null
>>> +++ b/newlib/libm/Makefile.inc
>>> @@ -0,0 +1,26 @@
>>> +info_TEXINFOS += %D%/libm.texi
>>> +%C%_libm_TEXINFOS = %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
>>> +
>>> +LIBM_CHEWOUT_FILES =
>>> +
>>> +LIBM_CHAPTERS =
>>> +
>>> +%D%/libm.dvi: %D%/targetdep.tex $(LIBM_CHEWOUT_FILES)
>>> +
>>> +%D%/targetdep.tex: $(LIBM_CHAPTERS)
>>> +	$(AM_V_GEN)cat $^ > $@.tmp
>>> +	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
>>> +	$(AM_V_at)touch $@
>>
>> We carefully only update $@ if it's changed, then touch it anyhow?
>>
>> This seems like a transcription error, since originally we were touching
>> a timestamp file, or perhaps leftover from testing?
> 
> you're right of course.  i saw other places that weren't using the stamp
> idiom, and then when rewriting these rules i remembered those places and
> thought i wouldn't bother deploying the stamp pattern here since it was
> already doing it wrong.  but i misremembered which ones were wrong.
> 
>> The same pattern occurs later, as well.
> 
> which one do you mean ?  the .xml ones ?  those currently aren't using the
> stamp idiom.  or do you just mean the multiple places where targetdep.tex
> is generated ?

%D%/targetdep.tex rule in 3/5
%D%/libc.xml rule in 4/5
%D%/libm.xml rule in 4/5

> 
>>> --- a/newlib/libm/common/Makefile.am
>>> +++ b/newlib/libm/common/Makefile.am
>>>    
>>> -CHAPTERS =
>>> +LIBM_CHEWOUT_FILES =
>>> +LIBM_CHAPTERS =
>>> +include ./Makefile.inc
>>
>> Is this boilerplate really needed before including the makefile
>> fragment, since '+=' should work even if the variable isn't already defined?
> 
> yes, automake enforces it

Fair enough.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/5 v3] newlib: move man page generation into top-level build
  2022-02-01  6:21   ` [PATCH 4/5 v3] newlib: move man page generation " Mike Frysinger
@ 2022-02-01 14:37     ` Jon Turney
  2022-02-01 23:12       ` Mike Frysinger
  0 siblings, 1 reply; 25+ messages in thread
From: Jon Turney @ 2022-02-01 14:37 UTC (permalink / raw)
  To: Mike Frysinger, newlib

On 01/02/2022 06:21, Mike Frysinger wrote:
> +%D%/libc.xml.stamp: %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 $< > $@.tmp
> +	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $(@:.stamp=)
> +	$(AM_V_at)touch $@
> +%D%/libc.xml: %D%/libc.xml.stamp; @true

This doesn't seem right.

This rule produces a single output with a definite name 'lib.xml', so 
there's no need for a timestamp file?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/5 v3] newlib: move man page generation into top-level build
  2022-02-01 14:37     ` Jon Turney
@ 2022-02-01 23:12       ` Mike Frysinger
  0 siblings, 0 replies; 25+ messages in thread
From: Mike Frysinger @ 2022-02-01 23:12 UTC (permalink / raw)
  To: Jon Turney; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 3471 bytes --]

On 01 Feb 2022 14:37, Jon Turney wrote:
> On 01/02/2022 06:21, Mike Frysinger wrote:
> > +%D%/libc.xml.stamp: %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 $< > $@.tmp
> > +	$(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $(@:.stamp=)
> > +	$(AM_V_at)touch $@
> > +%D%/libc.xml: %D%/libc.xml.stamp; @true
> 
> This doesn't seem right.
> 
> This rule produces a single output with a definite name 'lib.xml', so 
> there's no need for a timestamp file?

you can use this exact same argument for targetdep.tex.  i don't see why we'd
use the stamp idiom for one but not the other.  they both gather multiple
inputs and produce a single output.  i'm fine killing off the stamp logic
entirely and changing move-if-change to a plain mv, and skipping the minor
timestamp optimization altogether.  we obviously don't write directly to $@
in order to avoid an interrupt producing an incomplete file that the build
cannot recover itself.

the older rules that i'm replacing had more expensive checks for their inputs
(using recursive makes and recursive stamps), but by merging the Makefiles
all into one, we have full direct visibility into all the inputs.  but that
aspect doesn't matter to what these specific stamp files are saving: keeping
timestamp shifts from forcing info & pdf & html & man regens.

afaict, the only arguments for this are (1) dev time optimization (building
from git) and (2) release time requirements (toolchain builders don't need
full texinfo stack as the dist tarball includes the info/pdf/etc...).  the
stamp files gets us (1) but not (2) because the newlib dists have never had
the docs included.  i think it's just a tarball of the git state.

old rules:

targetdep.tex: stmp-targetdep ; @true
stmp-targetdep: force
    rm -f tmp.texi
    targetdoc=`pwd`/tmp.texi; \
    for d in $(SUBDIRS); do \
      if test "$$d" != "."; then \
        (cd $$d && $(MAKE) doc) || exit 1; \
      fi; \
    done
    $(SHELL) $(newlib_basedir)/../move-if-change tmp.texi targetdep.tex
    touch $@

man: math/stmp-xml complex/stmp-xml libm.in.xml
    xsltproc --xinclude --path ${builddir} --nonet ${srcdir}/../refcontainers.xslt ${srcdir}/libm.in.xml >libm.xml
    ...
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

new rules don't have any recursive makes:

LIBM_CHAPTERS = <complete list of source .tex files>
%D%/targetdep.tex: $(LIBM_CHAPTERS)
    $(AM_V_GEN)cat $^ > $@.tmp
    $(AM_V_at)mv $@.tmp $@

LIBM_DOCBOOK_OUT_FILES = <complete list of generated .c -> .def -> .xml files>
%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 $< > $@.tmp
    $(AM_V_at)$(SHELL) $(newlib_basedir)/../move-if-change $@.tmp $@
    $(AM_V_at)touch $@
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/5 v3] newlib: libm: move manual into top-level build
  2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
                     ` (3 preceding siblings ...)
  2022-02-01  6:21   ` [PATCH 5/5 v3] newlib: drop shared documentation rules Mike Frysinger
@ 2022-02-05 12:13   ` Corinna Vinschen
  2022-02-05 18:04     ` Mike Frysinger
  4 siblings, 1 reply; 25+ messages in thread
From: Corinna Vinschen @ 2022-02-05 12:13 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: newlib

On Feb  1 01:21, Mike Frysinger wrote:
> This doesn't migrate all the docs, just the libm's manual (pdf/info).
> This is to show the basic form of migrating the chew files.
> ---
> v3: fix .stamp handling with tex generation
> 
>  newlib/Makefile.am               |   9 +
>  newlib/Makefile.in               | 443 ++++++++++++++++++++++++++++---
>  newlib/doc/local.mk              |  11 +
>  newlib/libm/Makefile.am          |  27 +-
>  newlib/libm/Makefile.in          | 398 +++------------------------
>  newlib/libm/Makefile.inc         |  28 ++
>  newlib/libm/common/Makefile.am   |  14 +-
>  newlib/libm/common/Makefile.in   |  22 +-
>  newlib/libm/common/Makefile.inc  |  10 +
>  newlib/libm/complex/Makefile.am  |  12 +-
>  newlib/libm/complex/Makefile.in  |  18 +-
>  newlib/libm/complex/Makefile.inc |   8 +
>  newlib/libm/fenv/Makefile.am     |  11 +-
>  newlib/libm/fenv/Makefile.in     |  15 +-
>  newlib/libm/fenv/Makefile.inc    |   7 +
>  newlib/libm/math/Makefile.am     |  15 +-
>  newlib/libm/math/Makefile.in     |  23 +-
>  newlib/libm/math/Makefile.inc    |  11 +
>  newlib/libm/mathfp/Makefile.am   |  35 +--
>  newlib/libm/mathfp/Makefile.in   |  42 +--
>  newlib/libm/mathfp/Makefile.inc  |  31 +++
>  21 files changed, 634 insertions(+), 556 deletions(-)
>  create mode 100644 newlib/libm/Makefile.inc
>  create mode 100644 newlib/libm/common/Makefile.inc
>  create mode 100644 newlib/libm/complex/Makefile.inc
>  create mode 100644 newlib/libm/fenv/Makefile.inc
>  create mode 100644 newlib/libm/math/Makefile.inc
>  create mode 100644 newlib/libm/mathfp/Makefile.inc

Did I miss a GTG somewhere or why is this patchset already applied?


Corinna


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/5 v3] newlib: libm: move manual into top-level build
  2022-02-05 12:13   ` [PATCH 1/5 v3] newlib: libm: move manual into top-level build Corinna Vinschen
@ 2022-02-05 18:04     ` Mike Frysinger
  2022-02-07 10:30       ` Corinna Vinschen
  0 siblings, 1 reply; 25+ messages in thread
From: Mike Frysinger @ 2022-02-05 18:04 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 2053 bytes --]

On 05 Feb 2022 13:13, Corinna Vinschen wrote:
> On Feb  1 01:21, Mike Frysinger wrote:
> > This doesn't migrate all the docs, just the libm's manual (pdf/info).
> > This is to show the basic form of migrating the chew files.
> > ---
> > v3: fix .stamp handling with tex generation
> > 
> >  newlib/Makefile.am               |   9 +
> >  newlib/Makefile.in               | 443 ++++++++++++++++++++++++++++---
> >  newlib/doc/local.mk              |  11 +
> >  newlib/libm/Makefile.am          |  27 +-
> >  newlib/libm/Makefile.in          | 398 +++------------------------
> >  newlib/libm/Makefile.inc         |  28 ++
> >  newlib/libm/common/Makefile.am   |  14 +-
> >  newlib/libm/common/Makefile.in   |  22 +-
> >  newlib/libm/common/Makefile.inc  |  10 +
> >  newlib/libm/complex/Makefile.am  |  12 +-
> >  newlib/libm/complex/Makefile.in  |  18 +-
> >  newlib/libm/complex/Makefile.inc |   8 +
> >  newlib/libm/fenv/Makefile.am     |  11 +-
> >  newlib/libm/fenv/Makefile.in     |  15 +-
> >  newlib/libm/fenv/Makefile.inc    |   7 +
> >  newlib/libm/math/Makefile.am     |  15 +-
> >  newlib/libm/math/Makefile.in     |  23 +-
> >  newlib/libm/math/Makefile.inc    |  11 +
> >  newlib/libm/mathfp/Makefile.am   |  35 +--
> >  newlib/libm/mathfp/Makefile.in   |  42 +--
> >  newlib/libm/mathfp/Makefile.inc  |  31 +++
> >  21 files changed, 634 insertions(+), 556 deletions(-)
> >  create mode 100644 newlib/libm/Makefile.inc
> >  create mode 100644 newlib/libm/common/Makefile.inc
> >  create mode 100644 newlib/libm/complex/Makefile.inc
> >  create mode 100644 newlib/libm/fenv/Makefile.inc
> >  create mode 100644 newlib/libm/math/Makefile.inc
> >  create mode 100644 newlib/libm/mathfp/Makefile.inc
> 
> Did I miss a GTG somewhere or why is this patchset already applied?

sorry, i thought when you said early you were "fine with this change" (other
than local.mk which i addressed), it meant you were fine with merging it.  i
can pull it back out if there's something about it you didn't like.
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/5 v3] newlib: libm: move manual into top-level build
  2022-02-05 18:04     ` Mike Frysinger
@ 2022-02-07 10:30       ` Corinna Vinschen
  0 siblings, 0 replies; 25+ messages in thread
From: Corinna Vinschen @ 2022-02-07 10:30 UTC (permalink / raw)
  To: newlib; +Cc: Jon TURNEY

On Feb  5 13:04, Mike Frysinger wrote:
> On 05 Feb 2022 13:13, Corinna Vinschen wrote:
> > On Feb  1 01:21, Mike Frysinger wrote:
> > > This doesn't migrate all the docs, just the libm's manual (pdf/info).
> > > This is to show the basic form of migrating the chew files.
> > > ---
> > 
> > Did I miss a GTG somewhere or why is this patchset already applied?
> 
> sorry, i thought when you said early you were "fine with this change" (other
> than local.mk which i addressed), it meant you were fine with merging it.

Understood.  I was still waiting for the result of your discussion
with jturney.  Jon, anything you'd still like to discuss?

> i can pull it back out if there's something about it you didn't like.

No, it's ok, we can change or fix details in subsequent patches.


Thanks,
Corinna


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2022-02-07 10:30 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22  4:32 [PATCH 0/5] migrate documentation into top-level Mike Frysinger
2022-01-22  4:32 ` [PATCH 1/5] newlib: libm: move manual into top-level build Mike Frysinger
2022-01-22  4:32 ` [PATCH 2/5] newlib: libc: include all chapters all the time in the manual Mike Frysinger
2022-01-22  4:32 ` [PATCH 3/5] newlib: libc: move manual into top-level build Mike Frysinger
2022-01-24 14:30   ` Corinna Vinschen
2022-01-22  4:32 ` [PATCH 4/5] newlib: move man page generation " Mike Frysinger
2022-01-22  4:32 ` [PATCH 5/5] newlib: drop shared documentation rules Mike Frysinger
2022-01-28  7:58 ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Mike Frysinger
2022-01-28  7:58   ` [PATCH 2/5 v2] newlib: libc: include all chapters all the time in the manual Mike Frysinger
2022-01-28  7:58   ` [PATCH 3/5 v2] newlib: libc: move manual into top-level build Mike Frysinger
2022-01-28  7:58   ` [PATCH 4/5 v2] newlib: move man page generation " Mike Frysinger
2022-01-28  7:58   ` [PATCH 5/5 v2] newlib: drop shared documentation rules Mike Frysinger
2022-01-31 14:58   ` [PATCH 1/5 v2] newlib: libm: move manual into top-level build Jon Turney
2022-02-01  3:40     ` Mike Frysinger
2022-02-01 14:37       ` Jon Turney
2022-02-01  6:21 ` [PATCH 1/5 v3] " Mike Frysinger
2022-02-01  6:21   ` [PATCH 2/5 v3] newlib: libc: include all chapters all the time in the manual Mike Frysinger
2022-02-01  6:21   ` [PATCH 3/5 v3] newlib: libc: move manual into top-level build Mike Frysinger
2022-02-01  6:21   ` [PATCH 4/5 v3] newlib: move man page generation " Mike Frysinger
2022-02-01 14:37     ` Jon Turney
2022-02-01 23:12       ` Mike Frysinger
2022-02-01  6:21   ` [PATCH 5/5 v3] newlib: drop shared documentation rules Mike Frysinger
2022-02-05 12:13   ` [PATCH 1/5 v3] newlib: libm: move manual into top-level build Corinna Vinschen
2022-02-05 18:04     ` Mike Frysinger
2022-02-07 10:30       ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).