[PATCH 3/5 v2] newlib: libc: move manual into top-level build

Mike Frysinger vapier@gentoo.org
Fri Jan 28 07:58:24 GMT 2022


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



More information about the Newlib mailing list