public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: newlib@sourceware.org
Subject: [PATCH] newlib: libc: merge build up a directory
Date: Tue,  1 Mar 2022 20:39:59 -0500	[thread overview]
Message-ID: <20220302013959.511-1-vapier@gentoo.org> (raw)

Convert all the libc/ subdir makes into the top-level Makefile.  This
allows us to build all of libc from the top Makefile without using any
recursive make calls.  This is faster and avoids the funky lib.a logic
where we unpack subdir archives to repack into a single libc.a.  The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libc_a_SOURCES.

There's a few dummy.c files that are no longer necessary since we aren't
doing the lib.a accumulating, so punt them.
---
 newlib/Makefile.am                            |    47 +-
 newlib/Makefile.in                            | 15674 +++++++++++++++-
 newlib/configure                              |  1441 +-
 newlib/doc/Makefile.inc                       |     2 +
 newlib/libc/Makefile.am                       |    90 -
 newlib/libc/Makefile.in                       |   652 -
 newlib/libc/Makefile.inc                      |     4 +
 newlib/libc/acinclude.m4                      |   191 +-
 newlib/libc/argz/Makefile.am                  |    33 -
 newlib/libc/argz/Makefile.in                  |   699 -
 newlib/libc/argz/Makefile.inc                 |    23 +
 newlib/libc/argz/dummy.c                      |     1 -
 newlib/libc/ctype/Makefile.am                 |    87 -
 newlib/libc/ctype/Makefile.in                 |  1091 --
 newlib/libc/ctype/Makefile.inc                |    76 +
 newlib/libc/errno/Makefile.am                 |     9 -
 newlib/libc/errno/Makefile.in                 |   546 -
 newlib/libc/errno/Makefile.inc                |     1 +
 newlib/libc/iconv/Makefile.am                 |     7 -
 newlib/libc/iconv/Makefile.in                 |   606 -
 newlib/libc/iconv/Makefile.inc                |     7 +
 newlib/libc/iconv/ccs/Makefile.am             |    46 -
 newlib/libc/iconv/ccs/Makefile.in             |   951 -
 newlib/libc/iconv/ccs/Makefile.inc            |    24 +
 newlib/libc/iconv/ccs/binary/Makefile.am      |    20 -
 newlib/libc/iconv/ccs/binary/Makefile.in      |   489 -
 newlib/libc/iconv/ccs/binary/Makefile.inc     |    14 +
 newlib/libc/iconv/ces/Makefile.am             |    38 -
 newlib/libc/iconv/ces/Makefile.in             |   647 -
 newlib/libc/iconv/ces/Makefile.inc            |    19 +
 newlib/libc/iconv/lib/Makefile.am             |    29 -
 newlib/libc/iconv/lib/Makefile.in             |   600 -
 newlib/libc/iconv/lib/Makefile.inc            |    23 +
 newlib/libc/locale/Makefile.am                |    26 -
 newlib/libc/locale/Makefile.in                |   635 -
 newlib/libc/locale/Makefile.inc               |    20 +
 newlib/libc/machine/Makefile.inc              |   174 +
 newlib/libc/machine/a29k/Makefile.am          |     9 -
 newlib/libc/machine/a29k/Makefile.in          |   461 -
 newlib/libc/machine/aarch64/Makefile.am       |    42 -
 newlib/libc/machine/aarch64/Makefile.in       |   661 -
 newlib/libc/machine/aarch64/Makefile.inc      |    32 +
 newlib/libc/machine/amdgcn/Makefile.am        |    10 -
 newlib/libc/machine/amdgcn/Makefile.in        |   577 -
 newlib/libc/machine/amdgcn/Makefile.inc       |     7 +
 newlib/libc/machine/arc/Makefile.am           |    42 -
 newlib/libc/machine/arc/Makefile.in           |   641 -
 newlib/libc/machine/arc/Makefile.inc          |    31 +
 newlib/libc/machine/arm/Makefile.am           |    48 -
 newlib/libc/machine/arm/Makefile.in           |   640 -
 newlib/libc/machine/arm/Makefile.inc          |    11 +
 newlib/libc/machine/bfin/Makefile.am          |    10 -
 newlib/libc/machine/bfin/Makefile.in          |   541 -
 newlib/libc/machine/bfin/Makefile.inc         |     1 +
 newlib/libc/machine/cr16/Makefile.am          |    10 -
 newlib/libc/machine/cr16/Makefile.in          |   557 -
 newlib/libc/machine/cr16/Makefile.inc         |     1 +
 newlib/libc/machine/cris/Makefile.am          |    21 -
 newlib/libc/machine/cris/Makefile.in          |   686 -
 newlib/libc/machine/cris/Makefile.inc         |    13 +
 newlib/libc/machine/crx/Makefile.am           |    10 -
 newlib/libc/machine/crx/Makefile.in           |   557 -
 newlib/libc/machine/crx/Makefile.inc          |     1 +
 newlib/libc/machine/csky/Makefile.am          |    10 -
 newlib/libc/machine/csky/Makefile.in          |   541 -
 newlib/libc/machine/csky/Makefile.inc         |     1 +
 newlib/libc/machine/d10v/Makefile.am          |    10 -
 newlib/libc/machine/d10v/Makefile.in          |   541 -
 newlib/libc/machine/d10v/Makefile.inc         |     1 +
 newlib/libc/machine/d30v/Makefile.am          |    10 -
 newlib/libc/machine/d30v/Makefile.in          |   541 -
 newlib/libc/machine/d30v/Makefile.inc         |     1 +
 newlib/libc/machine/epiphany/Makefile.am      |    36 -
 newlib/libc/machine/epiphany/Makefile.in      |   541 -
 newlib/libc/machine/epiphany/Makefile.inc     |     1 +
 newlib/libc/machine/fr30/Makefile.am          |    10 -
 newlib/libc/machine/fr30/Makefile.in          |   541 -
 newlib/libc/machine/fr30/Makefile.inc         |     1 +
 newlib/libc/machine/frv/Makefile.am           |    10 -
 newlib/libc/machine/frv/Makefile.in           |   541 -
 newlib/libc/machine/frv/Makefile.inc          |     1 +
 newlib/libc/machine/ft32/Makefile.am          |    10 -
 newlib/libc/machine/ft32/Makefile.in          |   542 -
 newlib/libc/machine/ft32/Makefile.inc         |     1 +
 newlib/libc/machine/h8300/Makefile.am         |    13 -
 newlib/libc/machine/h8300/Makefile.in         |   546 -
 newlib/libc/machine/h8300/Makefile.inc        |     3 +
 newlib/libc/machine/h8500/Makefile.am         |    10 -
 newlib/libc/machine/h8500/Makefile.in         |   577 -
 newlib/libc/machine/h8500/Makefile.inc        |     1 +
 newlib/libc/machine/hppa/Makefile.am          |    12 -
 newlib/libc/machine/hppa/Makefile.in          |   547 -
 newlib/libc/machine/hppa/Makefile.inc         |     5 +
 newlib/libc/machine/i386/Makefile.am          |    22 -
 newlib/libc/machine/i386/Makefile.in          |   605 -
 newlib/libc/machine/i386/Makefile.inc         |     7 +
 newlib/libc/machine/i960/Makefile.am          |    10 -
 newlib/libc/machine/i960/Makefile.in          |   462 -
 newlib/libc/machine/i960/Makefile.inc         |    29 +
 newlib/libc/machine/iq2000/Makefile.am        |    10 -
 newlib/libc/machine/iq2000/Makefile.in        |   541 -
 newlib/libc/machine/iq2000/Makefile.inc       |     1 +
 newlib/libc/machine/lm32/Makefile.am          |    10 -
 newlib/libc/machine/lm32/Makefile.in          |   541 -
 newlib/libc/machine/lm32/Makefile.inc         |     1 +
 newlib/libc/machine/m32c/Makefile.am          |    10 -
 newlib/libc/machine/m32c/Makefile.in          |   541 -
 newlib/libc/machine/m32c/Makefile.inc         |     1 +
 newlib/libc/machine/m32r/Makefile.am          |    10 -
 newlib/libc/machine/m32r/Makefile.in          |   541 -
 newlib/libc/machine/m32r/Makefile.inc         |     1 +
 newlib/libc/machine/m68hc11/Makefile.am       |    10 -
 newlib/libc/machine/m68hc11/Makefile.in       |   541 -
 newlib/libc/machine/m68hc11/Makefile.inc      |     1 +
 newlib/libc/machine/m68k/Makefile.am          |    10 -
 newlib/libc/machine/m68k/Makefile.in          |   564 -
 newlib/libc/machine/m68k/Makefile.inc         |     1 +
 newlib/libc/machine/m88k/Makefile.am          |    10 -
 newlib/libc/machine/m88k/Makefile.in          |   541 -
 newlib/libc/machine/m88k/Makefile.inc         |     1 +
 newlib/libc/machine/mep/Makefile.am           |    10 -
 newlib/libc/machine/mep/Makefile.in           |   541 -
 newlib/libc/machine/mep/Makefile.inc          |     1 +
 newlib/libc/machine/microblaze/Makefile.am    |    10 -
 newlib/libc/machine/microblaze/Makefile.in    |   570 -
 newlib/libc/machine/microblaze/Makefile.inc   |     1 +
 newlib/libc/machine/mips/Makefile.am          |     9 -
 newlib/libc/machine/mips/Makefile.in          |   547 -
 newlib/libc/machine/mips/Makefile.inc         |     1 +
 newlib/libc/machine/mn10200/Makefile.am       |    10 -
 newlib/libc/machine/mn10200/Makefile.in       |   541 -
 newlib/libc/machine/mn10200/Makefile.inc      |     1 +
 newlib/libc/machine/mn10300/Makefile.am       |    11 -
 newlib/libc/machine/mn10300/Makefile.in       |   545 -
 newlib/libc/machine/mn10300/Makefile.inc      |     5 +
 newlib/libc/machine/moxie/Makefile.am         |    10 -
 newlib/libc/machine/moxie/Makefile.in         |   541 -
 newlib/libc/machine/moxie/Makefile.inc        |     1 +
 newlib/libc/machine/msp430/Makefile.am        |    30 -
 newlib/libc/machine/msp430/Makefile.in        |   584 -
 newlib/libc/machine/msp430/Makefile.inc       |     8 +
 newlib/libc/machine/mt/Makefile.am            |    10 -
 newlib/libc/machine/mt/Makefile.in            |   541 -
 newlib/libc/machine/mt/Makefile.inc           |     1 +
 newlib/libc/machine/nds32/Makefile.am         |    14 -
 newlib/libc/machine/nds32/Makefile.in         |   564 -
 newlib/libc/machine/nds32/Makefile.inc        |     8 +
 newlib/libc/machine/necv70/Makefile.am        |    10 -
 newlib/libc/machine/necv70/Makefile.in        |   541 -
 newlib/libc/machine/necv70/Makefile.inc       |     1 +
 newlib/libc/machine/nios2/Makefile.am         |    10 -
 newlib/libc/machine/nios2/Makefile.in         |   540 -
 newlib/libc/machine/nios2/Makefile.inc        |     1 +
 newlib/libc/machine/nvptx/Makefile.am         |    12 -
 newlib/libc/machine/nvptx/Makefile.in         |   645 -
 newlib/libc/machine/nvptx/Makefile.inc        |     4 +
 newlib/libc/machine/or1k/Makefile.am          |    10 -
 newlib/libc/machine/or1k/Makefile.in          |   541 -
 newlib/libc/machine/or1k/Makefile.inc         |     1 +
 newlib/libc/machine/powerpc/Makefile.am       |    43 -
 newlib/libc/machine/powerpc/Makefile.in       |   744 -
 newlib/libc/machine/powerpc/Makefile.inc      |    35 +
 newlib/libc/machine/pru/Makefile.am           |    10 -
 newlib/libc/machine/pru/Makefile.in           |   540 -
 newlib/libc/machine/pru/Makefile.inc          |     1 +
 newlib/libc/machine/riscv/Makefile.am         |    11 -
 newlib/libc/machine/riscv/Makefile.in         |   592 -
 newlib/libc/machine/riscv/Makefile.inc        |     3 +
 newlib/libc/machine/rl78/Makefile.am          |    10 -
 newlib/libc/machine/rl78/Makefile.in          |   541 -
 newlib/libc/machine/rl78/Makefile.inc         |     1 +
 newlib/libc/machine/rx/Makefile.am            |    12 -
 newlib/libc/machine/rx/Makefile.in            |   548 -
 newlib/libc/machine/rx/Makefile.inc           |     4 +
 newlib/libc/machine/sh/Makefile.am            |    22 -
 newlib/libc/machine/sh/Makefile.in            |   554 -
 newlib/libc/machine/sh/Makefile.inc           |     5 +
 newlib/libc/machine/sparc/Makefile.am         |    10 -
 newlib/libc/machine/sparc/Makefile.in         |   564 -
 newlib/libc/machine/sparc/Makefile.inc        |     1 +
 newlib/libc/machine/spu/Makefile.am           |    36 -
 newlib/libc/machine/spu/Makefile.in           |  1332 --
 newlib/libc/machine/spu/Makefile.inc          |    28 +
 newlib/libc/machine/tic4x/Makefile.am         |    10 -
 newlib/libc/machine/tic4x/Makefile.in         |   541 -
 newlib/libc/machine/tic4x/Makefile.inc        |     1 +
 newlib/libc/machine/tic6x/Makefile.am         |    10 -
 newlib/libc/machine/tic6x/Makefile.in         |   541 -
 newlib/libc/machine/tic6x/Makefile.inc        |     1 +
 newlib/libc/machine/tic80/Makefile.am         |    10 -
 newlib/libc/machine/tic80/Makefile.in         |   541 -
 newlib/libc/machine/tic80/Makefile.inc        |     1 +
 newlib/libc/machine/v850/Makefile.am          |    10 -
 newlib/libc/machine/v850/Makefile.in          |   541 -
 newlib/libc/machine/v850/Makefile.inc         |     1 +
 newlib/libc/machine/visium/Makefile.am        |    10 -
 newlib/libc/machine/visium/Makefile.in        |   570 -
 newlib/libc/machine/visium/Makefile.inc       |     1 +
 newlib/libc/machine/w65/Makefile.am           |    11 -
 newlib/libc/machine/w65/Makefile.in           |   574 -
 newlib/libc/machine/w65/Makefile.inc          |     3 +
 newlib/libc/machine/x86_64/Makefile.am        |    10 -
 newlib/libc/machine/x86_64/Makefile.in        |   541 -
 newlib/libc/machine/x86_64/Makefile.inc       |     1 +
 newlib/libc/machine/xc16x/Makefile.am         |    10 -
 newlib/libc/machine/xc16x/Makefile.in         |   564 -
 newlib/libc/machine/xc16x/Makefile.inc        |     1 +
 newlib/libc/machine/xstormy16/Makefile.am     |    22 -
 newlib/libc/machine/xstormy16/Makefile.in     |   642 -
 newlib/libc/machine/xstormy16/Makefile.inc    |    14 +
 newlib/libc/machine/z8k/Makefile.am           |    10 -
 newlib/libc/machine/z8k/Makefile.in           |   542 -
 newlib/libc/machine/z8k/Makefile.inc          |     1 +
 newlib/libc/misc/Makefile.am                  |    14 -
 newlib/libc/misc/Makefile.in                  |   583 -
 newlib/libc/misc/Makefile.inc                 |    12 +
 newlib/libc/posix/Makefile.am                 |    41 -
 newlib/libc/posix/Makefile.in                 |   789 -
 newlib/libc/posix/Makefile.inc                |    38 +
 newlib/libc/reent/Makefile.am                 |    53 -
 newlib/libc/reent/Makefile.in                 |   752 -
 newlib/libc/reent/Makefile.inc                |    43 +
 newlib/libc/search/Makefile.am                |    53 -
 newlib/libc/search/Makefile.in                |   695 -
 newlib/libc/search/Makefile.inc               |    41 +
 newlib/libc/signal/Makefile.am                |     9 -
 newlib/libc/signal/Makefile.in                |   565 -
 newlib/libc/signal/Makefile.inc               |     7 +
 newlib/libc/ssp/Makefile.am                   |    53 -
 newlib/libc/ssp/Makefile.in                   |   684 -
 newlib/libc/ssp/Makefile.inc                  |    43 +
 newlib/libc/stdio/Makefile.am                 |   228 -
 newlib/libc/stdio/Makefile.in                 |  1793 --
 newlib/libc/stdio/Makefile.inc                |   205 +
 newlib/libc/stdio64/Makefile.am               |    29 -
 newlib/libc/stdio64/Makefile.in               |   625 -
 newlib/libc/stdio64/Makefile.inc              |    22 +
 newlib/libc/stdio64/dummy.c                   |     1 -
 newlib/libc/stdlib/Makefile.am                |   175 -
 newlib/libc/stdlib/Makefile.in                |  1542 --
 newlib/libc/stdlib/Makefile.inc               |   196 +
 newlib/libc/string/Makefile.am                |   134 -
 newlib/libc/string/Makefile.in                |  1350 --
 newlib/libc/string/Makefile.inc               |   127 +
 newlib/libc/sys/Makefile.inc                  |    72 +
 newlib/libc/sys/a29khif/Makefile.am           |    47 -
 newlib/libc/sys/a29khif/Makefile.in           |   611 -
 newlib/libc/sys/a29khif/Makefile.inc          |    35 +
 newlib/libc/sys/amdgcn/Makefile.am            |    11 -
 newlib/libc/sys/amdgcn/Makefile.in            |   625 -
 newlib/libc/sys/amdgcn/Makefile.inc           |     3 +
 newlib/libc/sys/arm/Makefile.am               |    17 -
 newlib/libc/sys/arm/Makefile.in               |   583 -
 newlib/libc/sys/arm/Makefile.inc              |     6 +
 newlib/libc/sys/d10v/Makefile.am              |    12 -
 newlib/libc/sys/d10v/Makefile.in              |   566 -
 newlib/libc/sys/d10v/Makefile.inc             |     1 +
 newlib/libc/sys/epiphany/Makefile.am          |    37 -
 newlib/libc/sys/epiphany/Makefile.in          |   573 -
 newlib/libc/sys/epiphany/Makefile.inc         |     2 +
 newlib/libc/sys/h8300hms/Makefile.am          |    13 -
 newlib/libc/sys/h8300hms/Makefile.in          |   582 -
 newlib/libc/sys/h8300hms/Makefile.inc         |     3 +
 newlib/libc/sys/h8500hms/Makefile.am          |    12 -
 newlib/libc/sys/h8500hms/Makefile.in          |   553 -
 newlib/libc/sys/h8500hms/Makefile.inc         |     1 +
 newlib/libc/sys/m88kbug/Makefile.am           |    12 -
 newlib/libc/sys/m88kbug/Makefile.in           |   547 -
 newlib/libc/sys/m88kbug/Makefile.inc          |     1 +
 newlib/libc/sys/mmixware/Makefile.am          |    16 -
 newlib/libc/sys/mmixware/Makefile.in          |   732 -
 newlib/libc/sys/mmixware/Makefile.inc         |     6 +
 newlib/libc/sys/netware/Makefile.am           |    13 -
 newlib/libc/sys/netware/Makefile.in           |   539 -
 newlib/libc/sys/netware/Makefile.inc          |     3 +
 newlib/libc/sys/or1k/Makefile.am              |    10 -
 newlib/libc/sys/or1k/Makefile.in              |   557 -
 newlib/libc/sys/or1k/Makefile.inc             |     1 +
 newlib/libc/sys/phoenix/Makefile.am           |   137 -
 newlib/libc/sys/phoenix/Makefile.in           |  1220 --
 newlib/libc/sys/phoenix/Makefile.inc          |   105 +
 newlib/libc/sys/phoenix/acinclude.m4          |    10 +-
 .../libc/sys/phoenix/machine/arm/Makefile.am  |     8 -
 .../libc/sys/phoenix/machine/arm/Makefile.in  |   542 -
 .../libc/sys/phoenix/machine/arm/Makefile.inc |     1 +
 newlib/libc/sys/rdos/Makefile.am              |    15 -
 newlib/libc/sys/rdos/Makefile.in              |   706 -
 newlib/libc/sys/rdos/Makefile.inc             |     5 +
 newlib/libc/sys/rtems/Makefile.am             |    12 -
 newlib/libc/sys/rtems/Makefile.in             |   560 -
 newlib/libc/sys/rtems/Makefile.inc            |     1 +
 newlib/libc/sys/sh/Makefile.am                |    12 -
 newlib/libc/sys/sh/Makefile.in                |   579 -
 newlib/libc/sys/sh/Makefile.inc               |     1 +
 newlib/libc/sys/sysmec/Makefile.am            |    16 -
 newlib/libc/sys/sysmec/Makefile.in            |   732 -
 newlib/libc/sys/sysmec/Makefile.inc           |     6 +
 newlib/libc/sys/sysnec810/Makefile.am         |    12 -
 newlib/libc/sys/sysnec810/Makefile.in         |   572 -
 newlib/libc/sys/sysnec810/Makefile.inc        |     1 +
 newlib/libc/sys/sysnecv850/Makefile.am        |    22 -
 newlib/libc/sys/sysnecv850/Makefile.in        |   764 -
 newlib/libc/sys/sysnecv850/Makefile.inc       |     8 +
 newlib/libc/sys/sysvi386/Makefile.am          |    21 -
 newlib/libc/sys/sysvi386/Makefile.in          |   668 -
 newlib/libc/sys/sysvi386/Makefile.inc         |    10 +
 newlib/libc/sys/sysvnecv70/Makefile.am        |    13 -
 newlib/libc/sys/sysvnecv70/Makefile.in        |   565 -
 newlib/libc/sys/sysvnecv70/Makefile.inc       |     3 +
 newlib/libc/sys/tic80/Makefile.am             |    17 -
 newlib/libc/sys/tic80/Makefile.in             |   551 -
 newlib/libc/sys/tic80/Makefile.inc            |     0
 newlib/libc/sys/tirtos/Makefile.am            |    10 -
 newlib/libc/sys/tirtos/Makefile.in            |   545 -
 newlib/libc/sys/tirtos/Makefile.inc           |     1 +
 newlib/libc/sys/w65/Makefile.am               |    12 -
 newlib/libc/sys/w65/Makefile.in               |   553 -
 newlib/libc/sys/w65/Makefile.inc              |     1 +
 newlib/libc/sys/z8ksim/Makefile.am            |    12 -
 newlib/libc/sys/z8ksim/Makefile.in            |   547 -
 newlib/libc/sys/z8ksim/Makefile.inc           |     1 +
 newlib/libc/syscalls/Makefile.am              |    40 -
 newlib/libc/syscalls/Makefile.in              |   688 -
 newlib/libc/syscalls/Makefile.inc             |    33 +
 newlib/libc/time/Makefile.am                  |    33 -
 newlib/libc/time/Makefile.in                  |   707 -
 newlib/libc/time/Makefile.inc                 |    24 +
 newlib/libc/unix/Makefile.am                  |    40 -
 newlib/libc/unix/Makefile.in                  |   643 -
 newlib/libc/unix/Makefile.inc                 |    35 +
 newlib/libc/xdr/Makefile.am                   |    48 -
 newlib/libc/xdr/Makefile.in                   |   629 -
 newlib/libc/xdr/Makefile.inc                  |    38 +
 newlib/libc/xdr/dummy.c                       |     1 -
 334 files changed, 18309 insertions(+), 72033 deletions(-)
 delete mode 100644 newlib/libc/Makefile.am
 delete mode 100644 newlib/libc/Makefile.in
 delete mode 100644 newlib/libc/argz/Makefile.am
 delete mode 100644 newlib/libc/argz/Makefile.in
 delete mode 100644 newlib/libc/argz/dummy.c
 delete mode 100644 newlib/libc/ctype/Makefile.am
 delete mode 100644 newlib/libc/ctype/Makefile.in
 delete mode 100644 newlib/libc/errno/Makefile.am
 delete mode 100644 newlib/libc/errno/Makefile.in
 delete mode 100644 newlib/libc/iconv/Makefile.am
 delete mode 100644 newlib/libc/iconv/Makefile.in
 delete mode 100644 newlib/libc/iconv/ccs/Makefile.am
 delete mode 100644 newlib/libc/iconv/ccs/Makefile.in
 create mode 100644 newlib/libc/iconv/ccs/Makefile.inc
 delete mode 100644 newlib/libc/iconv/ccs/binary/Makefile.am
 delete mode 100644 newlib/libc/iconv/ccs/binary/Makefile.in
 create mode 100644 newlib/libc/iconv/ccs/binary/Makefile.inc
 delete mode 100644 newlib/libc/iconv/ces/Makefile.am
 delete mode 100644 newlib/libc/iconv/ces/Makefile.in
 create mode 100644 newlib/libc/iconv/ces/Makefile.inc
 delete mode 100644 newlib/libc/iconv/lib/Makefile.am
 delete mode 100644 newlib/libc/iconv/lib/Makefile.in
 delete mode 100644 newlib/libc/locale/Makefile.am
 delete mode 100644 newlib/libc/locale/Makefile.in
 delete mode 100644 newlib/libc/machine/a29k/Makefile.am
 delete mode 100644 newlib/libc/machine/a29k/Makefile.in
 delete mode 100644 newlib/libc/machine/aarch64/Makefile.am
 delete mode 100644 newlib/libc/machine/aarch64/Makefile.in
 create mode 100644 newlib/libc/machine/aarch64/Makefile.inc
 delete mode 100644 newlib/libc/machine/amdgcn/Makefile.am
 delete mode 100644 newlib/libc/machine/amdgcn/Makefile.in
 create mode 100644 newlib/libc/machine/amdgcn/Makefile.inc
 delete mode 100644 newlib/libc/machine/arc/Makefile.am
 delete mode 100644 newlib/libc/machine/arc/Makefile.in
 create mode 100644 newlib/libc/machine/arc/Makefile.inc
 delete mode 100644 newlib/libc/machine/arm/Makefile.am
 delete mode 100644 newlib/libc/machine/arm/Makefile.in
 create mode 100644 newlib/libc/machine/arm/Makefile.inc
 delete mode 100644 newlib/libc/machine/bfin/Makefile.am
 delete mode 100644 newlib/libc/machine/bfin/Makefile.in
 create mode 100644 newlib/libc/machine/bfin/Makefile.inc
 delete mode 100644 newlib/libc/machine/cr16/Makefile.am
 delete mode 100644 newlib/libc/machine/cr16/Makefile.in
 create mode 100644 newlib/libc/machine/cr16/Makefile.inc
 delete mode 100644 newlib/libc/machine/cris/Makefile.am
 delete mode 100644 newlib/libc/machine/cris/Makefile.in
 create mode 100644 newlib/libc/machine/cris/Makefile.inc
 delete mode 100644 newlib/libc/machine/crx/Makefile.am
 delete mode 100644 newlib/libc/machine/crx/Makefile.in
 create mode 100644 newlib/libc/machine/crx/Makefile.inc
 delete mode 100644 newlib/libc/machine/csky/Makefile.am
 delete mode 100644 newlib/libc/machine/csky/Makefile.in
 create mode 100644 newlib/libc/machine/csky/Makefile.inc
 delete mode 100644 newlib/libc/machine/d10v/Makefile.am
 delete mode 100644 newlib/libc/machine/d10v/Makefile.in
 create mode 100644 newlib/libc/machine/d10v/Makefile.inc
 delete mode 100644 newlib/libc/machine/d30v/Makefile.am
 delete mode 100644 newlib/libc/machine/d30v/Makefile.in
 create mode 100644 newlib/libc/machine/d30v/Makefile.inc
 delete mode 100644 newlib/libc/machine/epiphany/Makefile.am
 delete mode 100644 newlib/libc/machine/epiphany/Makefile.in
 create mode 100644 newlib/libc/machine/epiphany/Makefile.inc
 delete mode 100644 newlib/libc/machine/fr30/Makefile.am
 delete mode 100644 newlib/libc/machine/fr30/Makefile.in
 create mode 100644 newlib/libc/machine/fr30/Makefile.inc
 delete mode 100644 newlib/libc/machine/frv/Makefile.am
 delete mode 100644 newlib/libc/machine/frv/Makefile.in
 create mode 100644 newlib/libc/machine/frv/Makefile.inc
 delete mode 100644 newlib/libc/machine/ft32/Makefile.am
 delete mode 100644 newlib/libc/machine/ft32/Makefile.in
 create mode 100644 newlib/libc/machine/ft32/Makefile.inc
 delete mode 100644 newlib/libc/machine/h8300/Makefile.am
 delete mode 100644 newlib/libc/machine/h8300/Makefile.in
 create mode 100644 newlib/libc/machine/h8300/Makefile.inc
 delete mode 100644 newlib/libc/machine/h8500/Makefile.am
 delete mode 100644 newlib/libc/machine/h8500/Makefile.in
 create mode 100644 newlib/libc/machine/h8500/Makefile.inc
 delete mode 100644 newlib/libc/machine/hppa/Makefile.am
 delete mode 100644 newlib/libc/machine/hppa/Makefile.in
 create mode 100644 newlib/libc/machine/hppa/Makefile.inc
 delete mode 100644 newlib/libc/machine/i386/Makefile.am
 delete mode 100644 newlib/libc/machine/i386/Makefile.in
 create mode 100644 newlib/libc/machine/i386/Makefile.inc
 delete mode 100644 newlib/libc/machine/i960/Makefile.am
 delete mode 100644 newlib/libc/machine/i960/Makefile.in
 create mode 100644 newlib/libc/machine/i960/Makefile.inc
 delete mode 100644 newlib/libc/machine/iq2000/Makefile.am
 delete mode 100644 newlib/libc/machine/iq2000/Makefile.in
 create mode 100644 newlib/libc/machine/iq2000/Makefile.inc
 delete mode 100644 newlib/libc/machine/lm32/Makefile.am
 delete mode 100644 newlib/libc/machine/lm32/Makefile.in
 create mode 100644 newlib/libc/machine/lm32/Makefile.inc
 delete mode 100644 newlib/libc/machine/m32c/Makefile.am
 delete mode 100644 newlib/libc/machine/m32c/Makefile.in
 create mode 100644 newlib/libc/machine/m32c/Makefile.inc
 delete mode 100644 newlib/libc/machine/m32r/Makefile.am
 delete mode 100644 newlib/libc/machine/m32r/Makefile.in
 create mode 100644 newlib/libc/machine/m32r/Makefile.inc
 delete mode 100644 newlib/libc/machine/m68hc11/Makefile.am
 delete mode 100644 newlib/libc/machine/m68hc11/Makefile.in
 create mode 100644 newlib/libc/machine/m68hc11/Makefile.inc
 delete mode 100644 newlib/libc/machine/m68k/Makefile.am
 delete mode 100644 newlib/libc/machine/m68k/Makefile.in
 create mode 100644 newlib/libc/machine/m68k/Makefile.inc
 delete mode 100644 newlib/libc/machine/m88k/Makefile.am
 delete mode 100644 newlib/libc/machine/m88k/Makefile.in
 create mode 100644 newlib/libc/machine/m88k/Makefile.inc
 delete mode 100644 newlib/libc/machine/mep/Makefile.am
 delete mode 100644 newlib/libc/machine/mep/Makefile.in
 create mode 100644 newlib/libc/machine/mep/Makefile.inc
 delete mode 100644 newlib/libc/machine/microblaze/Makefile.am
 delete mode 100644 newlib/libc/machine/microblaze/Makefile.in
 create mode 100644 newlib/libc/machine/microblaze/Makefile.inc
 delete mode 100644 newlib/libc/machine/mips/Makefile.am
 delete mode 100644 newlib/libc/machine/mips/Makefile.in
 create mode 100644 newlib/libc/machine/mips/Makefile.inc
 delete mode 100644 newlib/libc/machine/mn10200/Makefile.am
 delete mode 100644 newlib/libc/machine/mn10200/Makefile.in
 create mode 100644 newlib/libc/machine/mn10200/Makefile.inc
 delete mode 100644 newlib/libc/machine/mn10300/Makefile.am
 delete mode 100644 newlib/libc/machine/mn10300/Makefile.in
 create mode 100644 newlib/libc/machine/mn10300/Makefile.inc
 delete mode 100644 newlib/libc/machine/moxie/Makefile.am
 delete mode 100644 newlib/libc/machine/moxie/Makefile.in
 create mode 100644 newlib/libc/machine/moxie/Makefile.inc
 delete mode 100644 newlib/libc/machine/msp430/Makefile.am
 delete mode 100644 newlib/libc/machine/msp430/Makefile.in
 create mode 100644 newlib/libc/machine/msp430/Makefile.inc
 delete mode 100644 newlib/libc/machine/mt/Makefile.am
 delete mode 100644 newlib/libc/machine/mt/Makefile.in
 create mode 100644 newlib/libc/machine/mt/Makefile.inc
 delete mode 100644 newlib/libc/machine/nds32/Makefile.am
 delete mode 100644 newlib/libc/machine/nds32/Makefile.in
 create mode 100644 newlib/libc/machine/nds32/Makefile.inc
 delete mode 100644 newlib/libc/machine/necv70/Makefile.am
 delete mode 100644 newlib/libc/machine/necv70/Makefile.in
 create mode 100644 newlib/libc/machine/necv70/Makefile.inc
 delete mode 100644 newlib/libc/machine/nios2/Makefile.am
 delete mode 100644 newlib/libc/machine/nios2/Makefile.in
 create mode 100644 newlib/libc/machine/nios2/Makefile.inc
 delete mode 100644 newlib/libc/machine/nvptx/Makefile.am
 delete mode 100644 newlib/libc/machine/nvptx/Makefile.in
 create mode 100644 newlib/libc/machine/nvptx/Makefile.inc
 delete mode 100644 newlib/libc/machine/or1k/Makefile.am
 delete mode 100644 newlib/libc/machine/or1k/Makefile.in
 create mode 100644 newlib/libc/machine/or1k/Makefile.inc
 delete mode 100644 newlib/libc/machine/powerpc/Makefile.am
 delete mode 100644 newlib/libc/machine/powerpc/Makefile.in
 create mode 100644 newlib/libc/machine/powerpc/Makefile.inc
 delete mode 100644 newlib/libc/machine/pru/Makefile.am
 delete mode 100644 newlib/libc/machine/pru/Makefile.in
 create mode 100644 newlib/libc/machine/pru/Makefile.inc
 delete mode 100644 newlib/libc/machine/riscv/Makefile.am
 delete mode 100644 newlib/libc/machine/riscv/Makefile.in
 create mode 100644 newlib/libc/machine/riscv/Makefile.inc
 delete mode 100644 newlib/libc/machine/rl78/Makefile.am
 delete mode 100644 newlib/libc/machine/rl78/Makefile.in
 create mode 100644 newlib/libc/machine/rl78/Makefile.inc
 delete mode 100644 newlib/libc/machine/rx/Makefile.am
 delete mode 100644 newlib/libc/machine/rx/Makefile.in
 create mode 100644 newlib/libc/machine/rx/Makefile.inc
 delete mode 100644 newlib/libc/machine/sh/Makefile.am
 delete mode 100644 newlib/libc/machine/sh/Makefile.in
 create mode 100644 newlib/libc/machine/sh/Makefile.inc
 delete mode 100644 newlib/libc/machine/sparc/Makefile.am
 delete mode 100644 newlib/libc/machine/sparc/Makefile.in
 create mode 100644 newlib/libc/machine/sparc/Makefile.inc
 delete mode 100644 newlib/libc/machine/spu/Makefile.am
 delete mode 100644 newlib/libc/machine/spu/Makefile.in
 create mode 100644 newlib/libc/machine/spu/Makefile.inc
 delete mode 100644 newlib/libc/machine/tic4x/Makefile.am
 delete mode 100644 newlib/libc/machine/tic4x/Makefile.in
 create mode 100644 newlib/libc/machine/tic4x/Makefile.inc
 delete mode 100644 newlib/libc/machine/tic6x/Makefile.am
 delete mode 100644 newlib/libc/machine/tic6x/Makefile.in
 create mode 100644 newlib/libc/machine/tic6x/Makefile.inc
 delete mode 100644 newlib/libc/machine/tic80/Makefile.am
 delete mode 100644 newlib/libc/machine/tic80/Makefile.in
 create mode 100644 newlib/libc/machine/tic80/Makefile.inc
 delete mode 100644 newlib/libc/machine/v850/Makefile.am
 delete mode 100644 newlib/libc/machine/v850/Makefile.in
 create mode 100644 newlib/libc/machine/v850/Makefile.inc
 delete mode 100644 newlib/libc/machine/visium/Makefile.am
 delete mode 100644 newlib/libc/machine/visium/Makefile.in
 create mode 100644 newlib/libc/machine/visium/Makefile.inc
 delete mode 100644 newlib/libc/machine/w65/Makefile.am
 delete mode 100644 newlib/libc/machine/w65/Makefile.in
 create mode 100644 newlib/libc/machine/w65/Makefile.inc
 delete mode 100644 newlib/libc/machine/x86_64/Makefile.am
 delete mode 100644 newlib/libc/machine/x86_64/Makefile.in
 create mode 100644 newlib/libc/machine/x86_64/Makefile.inc
 delete mode 100644 newlib/libc/machine/xc16x/Makefile.am
 delete mode 100644 newlib/libc/machine/xc16x/Makefile.in
 create mode 100644 newlib/libc/machine/xc16x/Makefile.inc
 delete mode 100644 newlib/libc/machine/xstormy16/Makefile.am
 delete mode 100644 newlib/libc/machine/xstormy16/Makefile.in
 create mode 100644 newlib/libc/machine/xstormy16/Makefile.inc
 delete mode 100644 newlib/libc/machine/z8k/Makefile.am
 delete mode 100644 newlib/libc/machine/z8k/Makefile.in
 create mode 100644 newlib/libc/machine/z8k/Makefile.inc
 delete mode 100644 newlib/libc/misc/Makefile.am
 delete mode 100644 newlib/libc/misc/Makefile.in
 delete mode 100644 newlib/libc/posix/Makefile.am
 delete mode 100644 newlib/libc/posix/Makefile.in
 delete mode 100644 newlib/libc/reent/Makefile.am
 delete mode 100644 newlib/libc/reent/Makefile.in
 delete mode 100644 newlib/libc/search/Makefile.am
 delete mode 100644 newlib/libc/search/Makefile.in
 delete mode 100644 newlib/libc/signal/Makefile.am
 delete mode 100644 newlib/libc/signal/Makefile.in
 delete mode 100644 newlib/libc/ssp/Makefile.am
 delete mode 100644 newlib/libc/ssp/Makefile.in
 delete mode 100644 newlib/libc/stdio/Makefile.am
 delete mode 100644 newlib/libc/stdio/Makefile.in
 delete mode 100644 newlib/libc/stdio64/Makefile.am
 delete mode 100644 newlib/libc/stdio64/Makefile.in
 delete mode 100644 newlib/libc/stdio64/dummy.c
 delete mode 100644 newlib/libc/stdlib/Makefile.am
 delete mode 100644 newlib/libc/stdlib/Makefile.in
 delete mode 100644 newlib/libc/string/Makefile.am
 delete mode 100644 newlib/libc/string/Makefile.in
 delete mode 100644 newlib/libc/sys/a29khif/Makefile.am
 delete mode 100644 newlib/libc/sys/a29khif/Makefile.in
 create mode 100644 newlib/libc/sys/a29khif/Makefile.inc
 delete mode 100644 newlib/libc/sys/amdgcn/Makefile.am
 delete mode 100644 newlib/libc/sys/amdgcn/Makefile.in
 create mode 100644 newlib/libc/sys/amdgcn/Makefile.inc
 delete mode 100644 newlib/libc/sys/arm/Makefile.am
 delete mode 100644 newlib/libc/sys/arm/Makefile.in
 create mode 100644 newlib/libc/sys/arm/Makefile.inc
 delete mode 100644 newlib/libc/sys/d10v/Makefile.am
 delete mode 100644 newlib/libc/sys/d10v/Makefile.in
 create mode 100644 newlib/libc/sys/d10v/Makefile.inc
 delete mode 100644 newlib/libc/sys/epiphany/Makefile.am
 delete mode 100644 newlib/libc/sys/epiphany/Makefile.in
 create mode 100644 newlib/libc/sys/epiphany/Makefile.inc
 delete mode 100644 newlib/libc/sys/h8300hms/Makefile.am
 delete mode 100644 newlib/libc/sys/h8300hms/Makefile.in
 create mode 100644 newlib/libc/sys/h8300hms/Makefile.inc
 delete mode 100644 newlib/libc/sys/h8500hms/Makefile.am
 delete mode 100644 newlib/libc/sys/h8500hms/Makefile.in
 create mode 100644 newlib/libc/sys/h8500hms/Makefile.inc
 delete mode 100644 newlib/libc/sys/m88kbug/Makefile.am
 delete mode 100644 newlib/libc/sys/m88kbug/Makefile.in
 create mode 100644 newlib/libc/sys/m88kbug/Makefile.inc
 delete mode 100644 newlib/libc/sys/mmixware/Makefile.am
 delete mode 100644 newlib/libc/sys/mmixware/Makefile.in
 create mode 100644 newlib/libc/sys/mmixware/Makefile.inc
 delete mode 100644 newlib/libc/sys/netware/Makefile.am
 delete mode 100644 newlib/libc/sys/netware/Makefile.in
 create mode 100644 newlib/libc/sys/netware/Makefile.inc
 delete mode 100644 newlib/libc/sys/or1k/Makefile.am
 delete mode 100644 newlib/libc/sys/or1k/Makefile.in
 create mode 100644 newlib/libc/sys/or1k/Makefile.inc
 delete mode 100644 newlib/libc/sys/phoenix/Makefile.am
 delete mode 100644 newlib/libc/sys/phoenix/Makefile.in
 create mode 100644 newlib/libc/sys/phoenix/Makefile.inc
 delete mode 100644 newlib/libc/sys/phoenix/machine/arm/Makefile.am
 delete mode 100644 newlib/libc/sys/phoenix/machine/arm/Makefile.in
 create mode 100644 newlib/libc/sys/phoenix/machine/arm/Makefile.inc
 delete mode 100644 newlib/libc/sys/rdos/Makefile.am
 delete mode 100644 newlib/libc/sys/rdos/Makefile.in
 create mode 100644 newlib/libc/sys/rdos/Makefile.inc
 delete mode 100644 newlib/libc/sys/rtems/Makefile.am
 delete mode 100644 newlib/libc/sys/rtems/Makefile.in
 create mode 100644 newlib/libc/sys/rtems/Makefile.inc
 delete mode 100644 newlib/libc/sys/sh/Makefile.am
 delete mode 100644 newlib/libc/sys/sh/Makefile.in
 create mode 100644 newlib/libc/sys/sh/Makefile.inc
 delete mode 100644 newlib/libc/sys/sysmec/Makefile.am
 delete mode 100644 newlib/libc/sys/sysmec/Makefile.in
 create mode 100644 newlib/libc/sys/sysmec/Makefile.inc
 delete mode 100644 newlib/libc/sys/sysnec810/Makefile.am
 delete mode 100644 newlib/libc/sys/sysnec810/Makefile.in
 create mode 100644 newlib/libc/sys/sysnec810/Makefile.inc
 delete mode 100644 newlib/libc/sys/sysnecv850/Makefile.am
 delete mode 100644 newlib/libc/sys/sysnecv850/Makefile.in
 create mode 100644 newlib/libc/sys/sysnecv850/Makefile.inc
 delete mode 100644 newlib/libc/sys/sysvi386/Makefile.am
 delete mode 100644 newlib/libc/sys/sysvi386/Makefile.in
 create mode 100644 newlib/libc/sys/sysvi386/Makefile.inc
 delete mode 100644 newlib/libc/sys/sysvnecv70/Makefile.am
 delete mode 100644 newlib/libc/sys/sysvnecv70/Makefile.in
 create mode 100644 newlib/libc/sys/sysvnecv70/Makefile.inc
 delete mode 100644 newlib/libc/sys/tic80/Makefile.am
 delete mode 100644 newlib/libc/sys/tic80/Makefile.in
 create mode 100644 newlib/libc/sys/tic80/Makefile.inc
 delete mode 100644 newlib/libc/sys/tirtos/Makefile.am
 delete mode 100644 newlib/libc/sys/tirtos/Makefile.in
 create mode 100644 newlib/libc/sys/tirtos/Makefile.inc
 delete mode 100644 newlib/libc/sys/w65/Makefile.am
 delete mode 100644 newlib/libc/sys/w65/Makefile.in
 create mode 100644 newlib/libc/sys/w65/Makefile.inc
 delete mode 100644 newlib/libc/sys/z8ksim/Makefile.am
 delete mode 100644 newlib/libc/sys/z8ksim/Makefile.in
 create mode 100644 newlib/libc/sys/z8ksim/Makefile.inc
 delete mode 100644 newlib/libc/syscalls/Makefile.am
 delete mode 100644 newlib/libc/syscalls/Makefile.in
 delete mode 100644 newlib/libc/time/Makefile.am
 delete mode 100644 newlib/libc/time/Makefile.in
 delete mode 100644 newlib/libc/unix/Makefile.am
 delete mode 100644 newlib/libc/unix/Makefile.in
 delete mode 100644 newlib/libc/xdr/Makefile.am
 delete mode 100644 newlib/libc/xdr/Makefile.in
 delete mode 100644 newlib/libc/xdr/dummy.c

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index ba0a3822fd13..84d0d349eb85 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -5,10 +5,12 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 
 # Variables that will accumulate in subdirs.
 CLEANFILES =
+EXTRA_DIST =
 PHONY =
 SUFFIXES =
 info_TEXINFOS =
 noinst_DATA =
+INSTALL_DATA_LOCAL =
 
 # The newlib hardware floating-point routines have been disabled due to
 # inaccuracy.  If you wish to work on them, you will need to edit the
@@ -24,7 +26,6 @@ endif
 # values defined in terms of make variables, as is the case for CC and
 # friends when we are called from the top level Makefile.
 AM_MAKEFLAGS = \
-	"AR_FLAGS=$(AR_FLAGS)" \
 	"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
 	"CFLAGS=$(CFLAGS)" \
 	"CCASFLAGS=$(CCASFLAGS)" \
@@ -60,15 +61,10 @@ AM_MAKEFLAGS = \
 
 FLAGS_TO_PASS=$(AM_MAKEFLAGS)
 
-SUBDIRS = libc .
-
 tooldir = $(exec_prefix)/$(host_alias)
 toollibdir = $(tooldir)/lib$(MULTISUBDIR)
 
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-AR_FLAGS = rc
-
-noinst_DATA += stmp-targ-include
 
 toollib_LIBRARIES = libm.a \
 	libc.a
@@ -122,17 +118,28 @@ MATHOBJS_IN_LIBC = \
 	libm_a-s_finite.o libm_a-sf_finite.o \
 	libm_a-s_copysign.o libm_a-sf_copysign.o
 
-libc.a: libc/libc.a libm.a
-	rm -rf libc.a tmp
-	mkdir tmp
-	cd tmp; \
-	 $(AR) x ../libm.a $(MATHOBJS_IN_LIBC) ; \
-	 $(AR) x ../libc/libc.a ; \
-	 $(AR) $(AR_FLAGS) ../$@ *.o
-	$(RANLIB) libc.a
-	rm -rf tmp
+## Place the libm_a objects in libc/ to keep the top dir tidy.
+stamp-libc-math-objects: libm.a
+	$(AM_V_GEN)cd libc && $(AR) x ../$< $(MATHOBJS_IN_LIBC)
+	$(AM_V_at)touch $@
 
-libc/libc.a: ; @true
+CLEANFILES += $(MATHOBJS_IN_LIBC)
+
+libc_a_SOURCES =
+libc_a_CFLAGS = $(AM_CFLAGS) $(libc_a_CFLAGS_$(subst /,_,$(@D))) $(libc_a_CFLAGS_$(subst /,_,$(@D)_$(<F)))
+libc_a_CCASFLAGS = $(AM_CCASFLAGS) $(libc_a_CCASFLAGS_$(subst /,_,$(@D))) $(libc_a_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
+libc_a_CPPFLAGS = $(AM_CPPFLAGS) $(libc_a_CPPFLAGS_$(subst /,_,$(@D))) $(libc_a_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
+libc_a_DEPENDENCIES = stamp-libc-math-objects
+## Best to avoid libc_a_LIBADD entirely to avoid having 2 independent lists
+## with separate overriding behavior (libc_a_OBJECTS is the other).  See the
+## AWK_UNIQUE_OBJS comment aove for more details.
+$(libc_a_OBJECTS) $(libc_a_LIBADD): stmp-targ-include
+
+libc.a: $(libc_a_OBJECTS) $(libc_a_DEPENDENCIES)
+	$(AM_V_at)rm -f $@
+	$(AM_V_AR)objs=`echo $(libc_a_OBJECTS) | $(AWK_UNIQUE_OBJS)` || exit $$?; \
+	  $(AR) $(ARFLAGS) $@ $$objs $(MATHOBJS_IN_LIBC:%=libc/%)
+	$(AM_V_at)$(RANLIB) $@
 
 libg.a: libc.a
 	$(AM_V_GEN)ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a
@@ -177,13 +184,13 @@ crt0.o: $(CRT0_DIR)$(CRT0)
 	$(AM_V_at)rm -f $@
 	$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
 
-$(CRT0_DIR)$(CRT0): ; @true
+$(CRT0_DIR)$(CRT0): stmp-targ-include
 
 crt1.o: $(CRT1_DIR)$(CRT1)
 	$(AM_V_at)rm -f $@
 	$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
 
-$(CRT1_DIR)$(CRT1): ; @true
+$(CRT1_DIR)$(CRT1): stmp-targ-include
 
 targ-include:
 	$(AM_V_GEN)$(MKDIR_P) $@
@@ -199,8 +206,6 @@ targ-include/newlib.h: newlib.h targ-include
 targ-include/_newlib_version.h: _newlib_version.h targ-include
 	$(AM_V_GEN)cp _newlib_version.h $@
 
-all-recursive: stmp-targ-include
-
 # The targ-include directory just holds the includes files for the
 # particular system and machine we have been configured for.  It is
 # used while building.
@@ -241,7 +246,7 @@ CLEANFILES += stmp-targ-include
 ## We hook install-multi because this Makefile doesn't have any exec targets,
 ## only data targets.  If that ever changes, this should be removed and the
 ## install-exec-local in ../multilib.am will kick in.
-install-data-local: install-toollibLIBRARIES install-multi
+install-data-local: install-toollibLIBRARIES install-multi $(INSTALL_DATA_LOCAL)
 	rm -f $(DESTDIR)$(toollibdir)/libg.a
 	ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a >/dev/null 2>/dev/null || cp $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
 	-if [ -z "$(MULTISUBDIR)" ]; then \
diff --git a/newlib/doc/Makefile.inc b/newlib/doc/Makefile.inc
index de1dd1f2bb09..630681c8847a 100644
--- a/newlib/doc/Makefile.inc
+++ b/newlib/doc/Makefile.inc
@@ -28,6 +28,7 @@ SUFFIXES += .def
 CHEW = $(MKDOC) -f $(srcdir)/%D%/doc.str
 
 .c.def:
+	$(AM_V_at)$(MKDIR_P) $(@D)
 	$(AM_V_GEN)$(CHEW) < $< > $*.def || ( rm $*.def && false )
 
 SUFFIXES += .xml
@@ -35,6 +36,7 @@ SUFFIXES += .xml
 DOCBOOK_CHEW = ${top_srcdir}/%D%/makedocbook.py
 
 .c.xml:
+	$(AM_V_at)$(MKDIR_P) $(@D)
 	$(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
diff --git a/newlib/libc/Makefile.am b/newlib/libc/Makefile.am
deleted file mode 100644
index f4cdcf1b6e63..000000000000
--- a/newlib/libc/Makefile.am
+++ /dev/null
@@ -1,90 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-if HAVE_POSIX_DIR
-POSIX_SUBDIR = posix
-endif
-
-if HAVE_SIGNAL_DIR
-SIGNAL_SUBDIR = signal
-endif
-
-if HAVE_SYSCALL_DIR
-SYSCALLS_SUBDIR = syscalls
-endif
-
-if HAVE_UNIX_DIR
-UNIX_SUBDIR = unix
-endif
-
-if HAVE_STDIO_DIR
-STDIO_SUBDIR = stdio
-endif
-
-if HAVE_STDIO64_DIR
-STDIO64_SUBDIR = stdio64
-endif
-
-if ENABLE_NEWLIB_ICONV
-NEWLIB_ICONV_DIRS = iconv
-NEWLIB_ICONV_LIBS = iconv/ces/lib.a iconv/ccs/lib.a iconv/lib/lib.a
-else
-NEWLIB_ICONV_DIRS =
-NEWLIB_ICONV_LIBS =
-endif
-
-if HAVE_XDR_DIR
-XDR_SUBDIR = xdr
-endif
-
-SUBDIRS = argz stdlib ctype search $(STDIO_SUBDIR) $(STDIO64_SUBDIR) string $(SIGNAL_SUBDIR) time locale reent \
-	errno misc $(UNIX_SUBDIR) $(POSIX_SUBDIR) $(SYSCALLS_SUBDIR) $(NEWLIB_ICONV_DIRS) \
-	$(XDR_SUBDIR) ssp
-if HAVE_SYS_DIR
-SUBDIRS += $(SYS_DIR)
-endif
-# NB: Machine dir must come last so it can override common objects when creating
-# libc.a below.
-if HAVE_LIBC_MACHINE_DIR
-SUBDIRS += $(LIBC_MACHINE_DIR)
-endif
-# NB: This must come last to avoid parallel build issues with current lib.a
-# accumulation logic.
-SUBDIRS += .
-
-noinst_LIBRARIES = libc.a
-SUBLIBS = \
-	argz/lib.a \
-	stdlib/lib.a \
-	ctype/lib.a \
-	search/lib.a \
-	$(LIBC_STDIO_LIB) \
-	$(LIBC_STDIO64_LIB) \
-	$(LIBC_XDR_LIB) \
-	string/lib.a \
-	$(LIBC_SIGNAL_LIB) \
-	time/lib.a \
-	locale/lib.a \
-	reent/lib.a \
-	errno/lib.a \
-	misc/lib.a \
-	ssp/lib.a \
-	$(LIBC_UNIX_LIB) \
-	$(LIBC_POSIX_LIB) \
-	$(LIBC_SYSCALL_LIB) \
-        $(NEWLIB_ICONV_LIBS) \
-	$(LIBC_MACHINE_LIB) \
-	$(LIBC_SYS_LIB)
-
-libc.a: $(SUBLIBS)
-	rm -f $@
-	rm -rf tmp
-	mkdir tmp
-	cd tmp; \
-	 for i in $(SUBLIBS); do \
-	   $(AR) x ../$$i; \
-	 done; \
-	$(AR) $(AR_FLAGS) ../$@ *.o
-	$(RANLIB) $@
-	rm -rf tmp
-
-$(SUBLIBS): ; @true
diff --git a/newlib/libc/Makefile.inc b/newlib/libc/Makefile.inc
index a26085883e9e..61ae0d793360 100644
--- a/newlib/libc/Makefile.inc
+++ b/newlib/libc/Makefile.inc
@@ -38,6 +38,9 @@ install-man: %C%_install-man
 ## * The integrated documentation (chapter ordering).
 ## * Object overridding -- machine dir must come last.
 ## Do not change the order without considering the doc impact.
+##
+## Also keep in mind that every subdir must always be included here.  Any
+## conditional loigc must live in the respective Makefile.inc files.
 include %D%/argz/Makefile.inc
 include %D%/stdlib/Makefile.inc
 include %D%/ctype/Makefile.inc
@@ -58,6 +61,7 @@ include %D%/iconv/Makefile.inc
 include %D%/xdr/Makefile.inc
 include %D%/ssp/Makefile.inc
 include %D%/sys/Makefile.inc
+## NB: Machine must be last!  See comment block above.
 include %D%/machine/Makefile.inc
 
 CLEANFILES += \
diff --git a/newlib/libc/acinclude.m4 b/newlib/libc/acinclude.m4
index 69c956cb4d00..5629f9e5c498 100644
--- a/newlib/libc/acinclude.m4
+++ b/newlib/libc/acinclude.m4
@@ -2,94 +2,30 @@ dnl For each directory which we may or may not want, we define a name
 dnl for the library and an automake conditional for whether we should
 dnl build the library.
 
-LIBC_SIGNAL_LIB=
-if test -n "${signal_dir}"; then
-  LIBC_SIGNAL_LIB=${signal_dir}/lib.a
-fi
-AC_SUBST(LIBC_SIGNAL_LIB)
 AM_CONDITIONAL(HAVE_SIGNAL_DIR, test x${signal_dir} != x)
-
-LIBC_STDIO_LIB=
-if test -n "${stdio_dir}"; then
-  LIBC_STDIO_LIB=${stdio_dir}/lib.a
-fi
-AC_SUBST(LIBC_STDIO_LIB)
 AM_CONDITIONAL(HAVE_STDIO_DIR, test x${stdio_dir} != x)
-
-LIBC_STDIO64_LIB=
-if test -n "${stdio64_dir}"; then
-  LIBC_STDIO64_LIB=${stdio64_dir}/lib.a
-fi
-AC_SUBST(LIBC_STDIO64_LIB)
 AM_CONDITIONAL(HAVE_STDIO64_DIR, test x${stdio64_dir} != x)
-
-LIBC_POSIX_LIB=
-if test -n "${posix_dir}"; then
-  LIBC_POSIX_LIB=${posix_dir}/lib.a
-fi
-AC_SUBST(LIBC_POSIX_LIB)
 AM_CONDITIONAL(HAVE_POSIX_DIR, test x${posix_dir} != x)
-
-LIBC_XDR_LIB=
-if test -n "${xdr_dir}"; then
-  LIBC_XDR_LIB=${xdr_dir}/lib.a
-fi
-AC_SUBST(LIBC_XDR_LIB)
 AM_CONDITIONAL(HAVE_XDR_DIR, test x${xdr_dir} != x)
-
-LIBC_SYSCALL_LIB=
-if test -n "${syscall_dir}"; then
-  LIBC_SYSCALL_LIB=${syscall_dir}/lib.a
-fi
-AC_SUBST(LIBC_SYSCALL_LIB)
 AM_CONDITIONAL(HAVE_SYSCALL_DIR, test x${syscall_dir} != x)
-
-LIBC_UNIX_LIB=
-if test -n "${unix_dir}"; then
-  LIBC_UNIX_LIB=${unix_dir}/lib.a
-fi
-AC_SUBST(LIBC_UNIX_LIB)
 AM_CONDITIONAL(HAVE_UNIX_DIR, test x${unix_dir} != x)
 
-dnl We always recur into sys and machine, and let them decide what to
-dnl do.  However, we do need to know whether they will produce a library.
-
-LIBC_SYS_LIB=
-if test -n "${sys_dir}"; then
-  case ${sys_dir} in
-    a29khif) AC_CONFIG_FILES([libc/sys/a29khif/Makefile]) ;;
-    amdgcn) AC_CONFIG_FILES([libc/sys/amdgcn/Makefile]) ;;
-    arm) AC_CONFIG_FILES([libc/sys/arm/Makefile]) ;;
-    d10v) AC_CONFIG_FILES([libc/sys/d10v/Makefile]) ;;
-    epiphany) AC_CONFIG_FILES([libc/sys/epiphany/Makefile]) ;;
-    h8300hms) AC_CONFIG_FILES([libc/sys/h8300hms/Makefile]) ;;
-    h8500hms) AC_CONFIG_FILES([libc/sys/h8500hms/Makefile]) ;;
-    m88kbug) AC_CONFIG_FILES([libc/sys/m88kbug/Makefile]) ;;
-    mmixware) AC_CONFIG_FILES([libc/sys/mmixware/Makefile]) ;;
-    netware) AC_CONFIG_FILES([libc/sys/netware/Makefile]) ;;
-    or1k) AC_CONFIG_FILES([libc/sys/or1k/Makefile]) ;;
-    phoenix) AC_CONFIG_FILES([libc/sys/phoenix/Makefile]) ;;
-    rdos) AC_CONFIG_FILES([libc/sys/rdos/Makefile]) ;;
-    rtems) AC_CONFIG_FILES([libc/sys/rtems/Makefile]) ;;
-    sh) AC_CONFIG_FILES([libc/sys/sh/Makefile]) ;;
-    sysmec) AC_CONFIG_FILES([libc/sys/sysmec/Makefile]) ;;
-    sysnec810) AC_CONFIG_FILES([libc/sys/sysnec810/Makefile]) ;;
-    sysnecv850) AC_CONFIG_FILES([libc/sys/sysnecv850/Makefile]) ;;
-    sysvi386) AC_CONFIG_FILES([libc/sys/sysvi386/Makefile]) ;;
-    sysvnecv70) AC_CONFIG_FILES([libc/sys/sysvnecv70/Makefile]) ;;
-    tic80) AC_CONFIG_FILES([libc/sys/tic80/Makefile]) ;;
-    tirtos) AC_CONFIG_FILES([libc/sys/tirtos/Makefile]) ;;
-    w65) AC_CONFIG_FILES([libc/sys/w65/Makefile]) ;;
-    z8ksim) AC_CONFIG_FILES([libc/sys/z8ksim/Makefile]) ;;
-    *) AC_MSG_ERROR([unsupported sys_dir "${sys_dir}"]) ;;
-  esac
-
-  SYS_DIR=sys/${sys_dir}
-  LIBC_SYS_LIB=${SYS_DIR}/lib.a
-fi
-AC_SUBST(SYS_DIR)
-AM_CONDITIONAL(HAVE_SYS_DIR, test x${sys_dir} != x)
-AC_SUBST(LIBC_SYS_LIB)
+dnl We always recur into sys and machine, and let them decide what to do.
+m4_foreach_w([SYS_DIR], [
+  a29khif amdgcn arm
+  d10v
+  epiphany
+  h8300hms h8500hms
+  m88kbug mmixware
+  netware
+  or1k
+  phoenix
+  rdos rtems
+  sh sysmec sysnec810 sysnecv850 sysvi386 sysvnecv70
+  tic80 tirtos
+  w65
+  z8ksim
+], [AM_CONDITIONAL([HAVE_LIBC_SYS_]m4_toupper(SYS_DIR)[_DIR], test "${sys_dir}" = SYS_DIR)])
 
 AC_TYPE_LONG_DOUBLE
 AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
@@ -105,78 +41,27 @@ m4_include([libc/machine/sh/acinclude.m4])
 m4_include([libc/machine/spu/acinclude.m4])
 m4_include([libc/sys/phoenix/acinclude.m4])
 
-LIBC_MACHINE_LIB=
-if test -n "${machine_dir}"; then
-  case ${machine_dir} in
-    a29k) AC_CONFIG_FILES([libc/machine/a29k/Makefile]) ;;
-    aarch64) AC_CONFIG_FILES([libc/machine/aarch64/Makefile]) ;;
-    amdgcn) AC_CONFIG_FILES([libc/machine/amdgcn/Makefile]) ;;
-    arc) AC_CONFIG_FILES([libc/machine/arc/Makefile]) ;;
-    arm) AC_CONFIG_FILES([libc/machine/arm/Makefile]) ;;
-    bfin) AC_CONFIG_FILES([libc/machine/bfin/Makefile]) ;;
-    cr16) AC_CONFIG_FILES([libc/machine/cr16/Makefile]) ;;
-    cris) AC_CONFIG_FILES([libc/machine/cris/Makefile]) ;;
-    crx) AC_CONFIG_FILES([libc/machine/crx/Makefile]) ;;
-    csky) AC_CONFIG_FILES([libc/machine/csky/Makefile]) ;;
-    d10v) AC_CONFIG_FILES([libc/machine/d10v/Makefile]) ;;
-    d30v) AC_CONFIG_FILES([libc/machine/d30v/Makefile]) ;;
-    epiphany) AC_CONFIG_FILES([libc/machine/epiphany/Makefile]) ;;
-    fr30) AC_CONFIG_FILES([libc/machine/fr30/Makefile]) ;;
-    frv) AC_CONFIG_FILES([libc/machine/frv/Makefile]) ;;
-    ft32) AC_CONFIG_FILES([libc/machine/ft32/Makefile]) ;;
-    h8300) AC_CONFIG_FILES([libc/machine/h8300/Makefile]) ;;
-    h8500) AC_CONFIG_FILES([libc/machine/h8500/Makefile]) ;;
-    hppa) AC_CONFIG_FILES([libc/machine/hppa/Makefile]) ;;
-    i386) AC_CONFIG_FILES([libc/machine/i386/Makefile]) ;;
-    i960) AC_CONFIG_FILES([libc/machine/i960/Makefile]) ;;
-    iq2000) AC_CONFIG_FILES([libc/machine/iq2000/Makefile]) ;;
-    lm32) AC_CONFIG_FILES([libc/machine/lm32/Makefile]) ;;
-    m32c) AC_CONFIG_FILES([libc/machine/m32c/Makefile]) ;;
-    m32r) AC_CONFIG_FILES([libc/machine/m32r/Makefile]) ;;
-    m68hc11) AC_CONFIG_FILES([libc/machine/m68hc11/Makefile]) ;;
-    m68k) AC_CONFIG_FILES([libc/machine/m68k/Makefile]) ;;
-    m88k) AC_CONFIG_FILES([libc/machine/m88k/Makefile]) ;;
-    mep) AC_CONFIG_FILES([libc/machine/mep/Makefile]) ;;
-    microblaze) AC_CONFIG_FILES([libc/machine/microblaze/Makefile]) ;;
-    mips) AC_CONFIG_FILES([libc/machine/mips/Makefile]) ;;
-    riscv) AC_CONFIG_FILES([libc/machine/riscv/Makefile]) ;;
-    mn10200) AC_CONFIG_FILES([libc/machine/mn10200/Makefile]) ;;
-    mn10300) AC_CONFIG_FILES([libc/machine/mn10300/Makefile]) ;;
-    moxie) AC_CONFIG_FILES([libc/machine/moxie/Makefile]) ;;
-    msp430) AC_CONFIG_FILES([libc/machine/msp430/Makefile]) ;;
-    mt) AC_CONFIG_FILES([libc/machine/mt/Makefile]) ;;
-    nds32) AC_CONFIG_FILES([libc/machine/nds32/Makefile]) ;;
-    necv70) AC_CONFIG_FILES([libc/machine/necv70/Makefile]) ;;
-    nios2) AC_CONFIG_FILES([libc/machine/nios2/Makefile]) ;;
-    nvptx) AC_CONFIG_FILES([libc/machine/nvptx/Makefile]) ;;
-    or1k) AC_CONFIG_FILES([libc/machine/or1k/Makefile]) ;;
-    powerpc) AC_CONFIG_FILES([libc/machine/powerpc/Makefile]) ;;
-    pru) AC_CONFIG_FILES([libc/machine/pru/Makefile]) ;;
-    rl78) AC_CONFIG_FILES([libc/machine/rl78/Makefile]) ;;
-    rx) AC_CONFIG_FILES([libc/machine/rx/Makefile]) ;;
-    sh) AC_CONFIG_FILES([libc/machine/sh/Makefile]) ;;
-    sparc) AC_CONFIG_FILES([libc/machine/sparc/Makefile]) ;;
-    spu) AC_CONFIG_FILES([libc/machine/spu/Makefile]) ;;
-    tic4x) AC_CONFIG_FILES([libc/machine/tic4x/Makefile]) ;;
-    tic6x) AC_CONFIG_FILES([libc/machine/tic6x/Makefile]) ;;
-    tic80) AC_CONFIG_FILES([libc/machine/tic80/Makefile]) ;;
-    v850) AC_CONFIG_FILES([libc/machine/v850/Makefile]) ;;
-    visium) AC_CONFIG_FILES([libc/machine/visium/Makefile]) ;;
-    w65) AC_CONFIG_FILES([libc/machine/w65/Makefile]) ;;
-    x86_64) AC_CONFIG_FILES([libc/machine/x86_64/Makefile]) ;;
-    xc16x) AC_CONFIG_FILES([libc/machine/xc16x/Makefile]) ;;
-    xstormy16) AC_CONFIG_FILES([libc/machine/xstormy16/Makefile]) ;;
-    z8k) AC_CONFIG_FILES([libc/machine/z8k/Makefile]) ;;
-    *) AC_MSG_ERROR([unsupported machine_dir "${machine_dir}"]) ;;
-  esac
-
-  LIBC_MACHINE_DIR=machine/${machine_dir}
-  LIBC_MACHINE_LIB=${LIBC_MACHINE_DIR}/lib.a
-fi
-AM_CONDITIONAL(HAVE_LIBC_MACHINE_DIR, test "x${LIBC_MACHINE_DIR}" != x)
-AC_SUBST(LIBC_MACHINE_DIR)
-AC_SUBST(LIBC_MACHINE_LIB)
+m4_foreach_w([MACHINE], [
+  aarch64 amdgcn arc arm
+  bfin
+  cr16 cris crx csky
+  d10v d30v
+  epiphany
+  fr30 frv ft32
+  h8300 h8500 hppa
+  i386 i960 iq2000
+  lm32
+  m32c m32r m68hc11 m68k m88k mep microblaze mips mn10200 mn10300 moxie msp430 mt
+  nds32 necv70 nios2 nvptx
+  or1k
+  powerpc pru
+  riscv rl78 rx
+  sh sparc spu
+  tic4x tic6x tic80
+  v850 visium
+  w65
+  x86_64 xc16x xstormy16
+  z8k
+], [AM_CONDITIONAL([HAVE_LIBC_MACHINE_]m4_toupper(MACHINE), test "${machine_dir}" = MACHINE)])
 
 AM_CONDITIONAL(MACH_ADD_SETJMP, test "x$mach_add_setjmp" = "xtrue")
-
-AC_CONFIG_FILES([libc/Makefile libc/argz/Makefile libc/ctype/Makefile libc/errno/Makefile libc/locale/Makefile libc/misc/Makefile libc/reent/Makefile libc/search/Makefile libc/stdio/Makefile libc/stdio64/Makefile libc/stdlib/Makefile libc/string/Makefile libc/time/Makefile libc/posix/Makefile libc/signal/Makefile libc/syscalls/Makefile libc/unix/Makefile libc/iconv/Makefile libc/iconv/ces/Makefile libc/iconv/ccs/Makefile libc/iconv/ccs/binary/Makefile libc/iconv/lib/Makefile libc/ssp/Makefile libc/xdr/Makefile])
diff --git a/newlib/libc/argz/Makefile.am b/newlib/libc/argz/Makefile.am
deleted file mode 100644
index 27cabd7e4546..000000000000
--- a/newlib/libc/argz/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-## All functions in this directory are EL/IX level 2 and above
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-ELIX_SOURCES = 		\
-	argz_add.c 	\
-	argz_add_sep.c 	\
-	argz_append.c 	\
-	argz_count.c 	\
-	argz_create.c 	\
-	argz_create_sep.c \
-	argz_delete.c 	\
-	argz_extract.c 	\
-	argz_insert.c 	\
-	argz_next.c 	\
-	argz_replace.c 	\
-	argz_stringify.c \
-	buf_findstr.c 	\
-	envz_entry.c 	\
-	envz_get.c 	\
-	envz_add.c 	\
-	envz_remove.c 	\
-	envz_merge.c 	\
-	envz_strip.c
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = dummy.c $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/argz/Makefile.inc b/newlib/libc/argz/Makefile.inc
index e69de29bb2d1..98da255989d4 100644
--- a/newlib/libc/argz/Makefile.inc
+++ b/newlib/libc/argz/Makefile.inc
@@ -0,0 +1,23 @@
+## All functions in this directory are EL/IX level 2 and above
+if !ELIX_LEVEL_1
+libc_a_SOURCES += \
+	%D%/argz_add.c \
+	%D%/argz_add_sep.c \
+	%D%/argz_append.c \
+	%D%/argz_count.c \
+	%D%/argz_create.c \
+	%D%/argz_create_sep.c \
+	%D%/argz_delete.c \
+	%D%/argz_extract.c \
+	%D%/argz_insert.c \
+	%D%/argz_next.c \
+	%D%/argz_replace.c \
+	%D%/argz_stringify.c \
+	%D%/buf_findstr.c \
+	%D%/envz_entry.c \
+	%D%/envz_get.c \
+	%D%/envz_add.c \
+	%D%/envz_remove.c \
+	%D%/envz_merge.c \
+	%D%/envz_strip.c
+endif
diff --git a/newlib/libc/argz/dummy.c b/newlib/libc/argz/dummy.c
deleted file mode 100644
index 895395e51609..000000000000
--- a/newlib/libc/argz/dummy.c
+++ /dev/null
@@ -1 +0,0 @@
-/* empty stub to allow objectlist.awk.in to be created */
diff --git a/newlib/libc/ctype/Makefile.am b/newlib/libc/ctype/Makefile.am
deleted file mode 100644
index dac01fa48fa0..000000000000
--- a/newlib/libc/ctype/Makefile.am
+++ /dev/null
@@ -1,87 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = 	\
-	ctype_.c 	\
-	isalnum.c 	\
-	isalpha.c 	\
-	iscntrl.c 	\
-	isdigit.c 	\
-	islower.c 	\
-	isupper.c 	\
-	isprint.c 	\
-	ispunct.c 	\
-	isspace.c 	\
-	isxdigit.c 	\
-	tolower.c 	\
-	toupper.c
-
-## The following handles EL/IX level 2 functions
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-ELIX_SOURCES = \
-	categories.c	\
-	isalnum_l.c	\
-	isalpha_l.c	\
-	isascii.c 	\
-	isascii_l.c 	\
-	isblank.c 	\
-	isblank_l.c 	\
-	iscntrl_l.c 	\
-	isdigit_l.c 	\
-	islower_l.c 	\
-	isupper_l.c 	\
-	isprint_l.c 	\
-	ispunct_l.c 	\
-	isspace_l.c 	\
-	iswalnum.c 	\
-	iswalnum_l.c 	\
-	iswalpha.c 	\
-	iswalpha_l.c 	\
-	iswblank.c 	\
-	iswblank_l.c 	\
-	iswcntrl.c 	\
-	iswcntrl_l.c 	\
-	iswctype.c 	\
-	iswctype_l.c 	\
-	iswdigit.c 	\
-	iswdigit_l.c 	\
-	iswgraph.c 	\
-	iswgraph_l.c 	\
-	iswlower.c 	\
-	iswlower_l.c 	\
-	iswprint.c 	\
-	iswprint_l.c 	\
-	iswpunct.c 	\
-	iswpunct_l.c 	\
-	iswspace.c 	\
-	iswspace_l.c 	\
-	iswupper.c 	\
-	iswupper_l.c 	\
-	iswxdigit.c 	\
-	iswxdigit_l.c 	\
-	isxdigit_l.c 	\
-	jp2uc.c 	\
-	toascii.c 	\
-	toascii_l.c 	\
-	tolower_l.c 	\
-	toupper_l.c	\
-	towctrans.c 	\
-	towctrans_l.c 	\
-	towlower.c 	\
-	towlower_l.c 	\
-	towupper.c 	\
-	towupper_l.c 	\
-	wctrans.c 	\
-	wctrans_l.c 	\
-	wctype.c	\
-	wctype_l.c
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-$(lpfx)ctype_.o: ctype_.c ctype_iso.h ctype_cp.h
diff --git a/newlib/libc/ctype/Makefile.inc b/newlib/libc/ctype/Makefile.inc
index 8cef16630ac1..0affa292bca0 100644
--- a/newlib/libc/ctype/Makefile.inc
+++ b/newlib/libc/ctype/Makefile.inc
@@ -1,3 +1,79 @@
+libc_a_SOURCES += \
+	%D%/ctype_.c \
+	%D%/isalnum.c \
+	%D%/isalpha.c \
+	%D%/iscntrl.c \
+	%D%/isdigit.c \
+	%D%/islower.c \
+	%D%/isupper.c \
+	%D%/isprint.c \
+	%D%/ispunct.c \
+	%D%/isspace.c \
+	%D%/isxdigit.c \
+	%D%/tolower.c \
+	%D%/toupper.c
+
+## The following handles EL/IX level 2 functions
+if !ELIX_LEVEL_1
+libc_a_SOURCES += \
+	%D%/categories.c \
+	%D%/isalnum_l.c \
+	%D%/isalpha_l.c \
+	%D%/isascii.c \
+	%D%/isascii_l.c \
+	%D%/isblank.c \
+	%D%/isblank_l.c \
+	%D%/iscntrl_l.c \
+	%D%/isdigit_l.c \
+	%D%/islower_l.c \
+	%D%/isupper_l.c \
+	%D%/isprint_l.c \
+	%D%/ispunct_l.c \
+	%D%/isspace_l.c \
+	%D%/iswalnum.c \
+	%D%/iswalnum_l.c \
+	%D%/iswalpha.c \
+	%D%/iswalpha_l.c \
+	%D%/iswblank.c \
+	%D%/iswblank_l.c \
+	%D%/iswcntrl.c \
+	%D%/iswcntrl_l.c \
+	%D%/iswctype.c \
+	%D%/iswctype_l.c \
+	%D%/iswdigit.c \
+	%D%/iswdigit_l.c \
+	%D%/iswgraph.c \
+	%D%/iswgraph_l.c \
+	%D%/iswlower.c \
+	%D%/iswlower_l.c \
+	%D%/iswprint.c \
+	%D%/iswprint_l.c \
+	%D%/iswpunct.c \
+	%D%/iswpunct_l.c \
+	%D%/iswspace.c \
+	%D%/iswspace_l.c \
+	%D%/iswupper.c \
+	%D%/iswupper_l.c \
+	%D%/iswxdigit.c \
+	%D%/iswxdigit_l.c \
+	%D%/isxdigit_l.c \
+	%D%/jp2uc.c \
+	%D%/toascii.c \
+	%D%/toascii_l.c \
+	%D%/tolower_l.c \
+	%D%/toupper_l.c \
+	%D%/towctrans.c \
+	%D%/towctrans_l.c \
+	%D%/towlower.c \
+	%D%/towlower_l.c \
+	%D%/towupper.c \
+	%D%/towupper_l.c \
+	%D%/wctrans.c \
+	%D%/wctrans_l.c \
+	%D%/wctype.c \
+	%D%/wctype_l.c
+endif
+
 LIBC_CHEWOUT_FILES += \
 	%D%/isalnum.def \
 	%D%/isalpha.def \
diff --git a/newlib/libc/errno/Makefile.am b/newlib/libc/errno/Makefile.am
deleted file mode 100644
index 190b389021dd..000000000000
--- a/newlib/libc/errno/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = errno.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/errno/Makefile.inc b/newlib/libc/errno/Makefile.inc
index e69de29bb2d1..f06b8c5e8b7b 100644
--- a/newlib/libc/errno/Makefile.inc
+++ b/newlib/libc/errno/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/errno.c
diff --git a/newlib/libc/iconv/Makefile.am b/newlib/libc/iconv/Makefile.am
deleted file mode 100644
index bfaf0dd9e0d9..000000000000
--- a/newlib/libc/iconv/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-## Process this file with automake to generate Makefile.in
-SUBDIRS = ces ccs lib .
-
-cctdir=$(datadir)/iconv_data
-cct_DATA=encoding.aliases
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
diff --git a/newlib/libc/iconv/Makefile.inc b/newlib/libc/iconv/Makefile.inc
index 1c331a5fac5b..77c0b05991b4 100644
--- a/newlib/libc/iconv/Makefile.inc
+++ b/newlib/libc/iconv/Makefile.inc
@@ -1,3 +1,10 @@
+if ENABLE_NEWLIB_ICONV
+cctdir = $(datadir)/iconv_data
+cct_DATA = %D%/encoding.aliases
+endif
+
 LIBC_CHAPTERS += %D%/iconv.tex
 
+include %D%/ces/Makefile.inc
+include %D%/ccs/Makefile.inc
 include %D%/lib/Makefile.inc
diff --git a/newlib/libc/iconv/ccs/Makefile.am b/newlib/libc/iconv/ccs/Makefile.am
deleted file mode 100644
index fb3b51c79105..000000000000
--- a/newlib/libc/iconv/ccs/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = ccsbi.c \
-iso_8859_10.c iso_8859_13.c iso_8859_14.c iso_8859_15.c \
-iso_8859_1.c iso_8859_2.c iso_8859_3.c iso_8859_4.c \
-iso_8859_5.c iso_8859_6.c iso_8859_7.c iso_8859_8.c \
-iso_8859_9.c iso_8859_11.c \
-win_1250.c win_1252.c win_1254.c \
-win_1256.c win_1258.c win_1251.c \
-win_1253.c win_1255.c win_1257.c \
-koi8_r.c koi8_u.c koi8_ru.c koi8_uni.c \
-iso_ir_111.c \
-big5.c \
-cp775.c cp850.c cp852.c cp855.c cp866.c \
-jis_x0212_1990.c jis_x0201_1976.c jis_x0208_1990.c ksx1001.c \
-cns11643_plane1.c cns11643_plane2.c cns11643_plane14.c
-
-## The following interfaces are EL/IX level 2
-if ELIX_LEVEL_1
-ELIX_SOURCES = ccsbi.c \
-iso_8859_10.c iso_8859_13.c iso_8859_14.c iso_8859_15.c \
-iso_8859_1.c iso_8859_2.c iso_8859_3.c iso_8859_4.c \
-iso_8859_5.c iso_8859_6.c iso_8859_7.c iso_8859_8.c \
-iso_8859_9.c iso_8859_11.c \
-win_1250.c win_1252.c win_1254.c \
-win_1256.c win_1258.c win_1251.c \
-win_1253.c win_1255.c win_1257.c \
-koi8_r.c koi8_u.c koi8_ru.c koi8_uni.c \
-iso_ir_111.c \
-big5.c \
-cp775.c cp850.c cp852.c cp855.c cp866.c \
-jis_x0212_1990.c jis_x0201_1976.c jis_x0208_1990.c ksx1001.c \
-cns11643_plane1.c cns11643_plane2.c cns11643_plane14.c
-
-else
-ELIX_SOURCES =
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
-noinst_DATA =
-
-SUBDIRS=binary
diff --git a/newlib/libc/iconv/ccs/Makefile.inc b/newlib/libc/iconv/ccs/Makefile.inc
new file mode 100644
index 000000000000..84a53f4fe9a6
--- /dev/null
+++ b/newlib/libc/iconv/ccs/Makefile.inc
@@ -0,0 +1,24 @@
+if ENABLE_NEWLIB_ICONV
+
+## The following interfaces are EL/IX level 2
+if ELIX_LEVEL_1
+libc_a_SOURCES += \
+	%D%/ccsbi.c \
+	%D%/iso_8859_10.c %D%/iso_8859_13.c %D%/iso_8859_14.c %D%/iso_8859_15.c \
+	%D%/iso_8859_1.c %D%/iso_8859_2.c %D%/iso_8859_3.c %D%/iso_8859_4.c \
+	%D%/iso_8859_5.c %D%/iso_8859_6.c %D%/iso_8859_7.c %D%/iso_8859_8.c \
+	%D%/iso_8859_9.c %D%/iso_8859_11.c \
+	%D%/win_1250.c %D%/win_1252.c %D%/win_1254.c \
+	%D%/win_1256.c %D%/win_1258.c %D%/win_1251.c \
+	%D%/win_1253.c %D%/win_1255.c %D%/win_1257.c \
+	%D%/koi8_r.c %D%/koi8_u.c %D%/koi8_ru.c %D%/koi8_uni.c \
+	%D%/iso_ir_111.c \
+	%D%/big5.c \
+	%D%/cp775.c %D%/cp850.c %D%/cp852.c %D%/cp855.c %D%/cp866.c \
+	%D%/jis_x0212_1990.c %D%/jis_x0201_1976.c %D%/jis_x0208_1990.c %D%/ksx1001.c \
+	%D%/cns11643_plane1.c %D%/cns11643_plane2.c %D%/cns11643_plane14.c
+endif
+
+include %D%/binary/Makefile.inc
+
+endif
diff --git a/newlib/libc/iconv/ccs/binary/Makefile.am b/newlib/libc/iconv/ccs/binary/Makefile.am
deleted file mode 100644
index 24656c3aabd8..000000000000
--- a/newlib/libc/iconv/ccs/binary/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-cctdir=$(datadir)/iconv_data
-
-cct_DATA= \
-iso_8859_10.cct iso_8859_13.cct iso_8859_14.cct iso_8859_15.cct \
-iso_8859_1.cct iso_8859_2.cct iso_8859_3.cct iso_8859_4.cct \
-iso_8859_5.cct iso_8859_6.cct iso_8859_7.cct iso_8859_8.cct \
-iso_8859_9.cct iso_8859_11.cct \
-win_1250.cct win_1252.cct win_1254.cct \
-win_1256.cct win_1258.cct win_1251.cct \
-win_1253.cct win_1255.cct win_1257.cct \
-koi8_r.cct koi8_u.cct koi8_ru.cct koi8_uni.cct \
-iso_ir_111.cct \
-big5.cct \
-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
-
-info:
diff --git a/newlib/libc/iconv/ccs/binary/Makefile.inc b/newlib/libc/iconv/ccs/binary/Makefile.inc
new file mode 100644
index 000000000000..78582303be69
--- /dev/null
+++ b/newlib/libc/iconv/ccs/binary/Makefile.inc
@@ -0,0 +1,14 @@
+cct_DATA += \
+	%D%/iso_8859_10.cct %D%/iso_8859_13.cct %D%/iso_8859_14.cct %D%/iso_8859_15.cct \
+	%D%/iso_8859_1.cct %D%/iso_8859_2.cct %D%/iso_8859_3.cct %D%/iso_8859_4.cct \
+	%D%/iso_8859_5.cct %D%/iso_8859_6.cct %D%/iso_8859_7.cct %D%/iso_8859_8.cct \
+	%D%/iso_8859_9.cct %D%/iso_8859_11.cct \
+	%D%/win_1250.cct %D%/win_1252.cct %D%/win_1254.cct \
+	%D%/win_1256.cct %D%/win_1258.cct %D%/win_1251.cct \
+	%D%/win_1253.cct %D%/win_1255.cct %D%/win_1257.cct \
+	%D%/koi8_r.cct %D%/koi8_u.cct %D%/koi8_ru.cct %D%/koi8_uni.cct \
+	%D%/iso_ir_111.cct \
+	%D%/big5.cct \
+	%D%/cp775.cct %D%/cp850.cct %D%/cp852.cct %D%/cp855.cct %D%/cp866.cct \
+	%D%/jis_x0212_1990.cct %D%/jis_x0201_1976.cct %D%/jis_x0208_1990.cct %D%/ksx1001.cct \
+	%D%/cns11643_plane1.cct %D%/cns11643_plane2.cct %D%/cns11643_plane14.cct
diff --git a/newlib/libc/iconv/ces/Makefile.am b/newlib/libc/iconv/ces/Makefile.am
deleted file mode 100644
index f59401305741..000000000000
--- a/newlib/libc/iconv/ces/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-	utf-8.c \
-	utf-16.c \
-	ucs-2.c \
-	us-ascii.c \
-	ucs-4.c \
-	ucs-2-internal.c \
-	ucs-4-internal.c \
-	cesbi.c \
-	table.c \
-	table-pcs.c \
-	euc.c
-
-## The following interfaces are EL/IX level 2
-if ELIX_LEVEL_1
-ELIX_SOURCES = \
-	utf-8.c \
-	utf-16.c \
-	ucs-2.c \
-	us-ascii.c \
-	ucs-4.c \
-	ucs-2-internal.c \
-	ucs-4-internal.c \
-	cesbi.c \
-	table.c \
-	table-pcs.c \
-	euc.c
-else
-ELIX_SOURCES = 
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/iconv/ces/Makefile.inc b/newlib/libc/iconv/ces/Makefile.inc
new file mode 100644
index 000000000000..6fb933970f56
--- /dev/null
+++ b/newlib/libc/iconv/ces/Makefile.inc
@@ -0,0 +1,19 @@
+if ENABLE_NEWLIB_ICONV
+
+## The following interfaces are EL/IX level 2
+if ELIX_LEVEL_1
+libc_a_SOURCES += \
+	%D%/utf-8.c \
+	%D%/utf-16.c \
+	%D%/ucs-2.c \
+	%D%/us-ascii.c \
+	%D%/ucs-4.c \
+	%D%/ucs-2-internal.c \
+	%D%/ucs-4-internal.c \
+	%D%/cesbi.c \
+	%D%/table.c \
+	%D%/table-pcs.c \
+	%D%/euc.c
+endif
+
+endif
diff --git a/newlib/libc/iconv/lib/Makefile.am b/newlib/libc/iconv/lib/Makefile.am
deleted file mode 100644
index c385538df985..000000000000
--- a/newlib/libc/iconv/lib/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-	aliasesi.c \
-	ucsconv.c \
-	nullconv.c \
-	iconv.c \
-	aliasesbi.c \
-	iconvnls.c
-
-
-## The following interfaces are EL/IX level 2
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-ELIX_SOURCES = \
-	aliasesi.c \
-	ucsconv.c \
-	nullconv.c \
-	iconv.c \
-	aliasesbi.c \
-	iconvnls.c
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/iconv/lib/Makefile.inc b/newlib/libc/iconv/lib/Makefile.inc
index 62a2be87ba5e..6c7d015cd12d 100644
--- a/newlib/libc/iconv/lib/Makefile.inc
+++ b/newlib/libc/iconv/lib/Makefile.inc
@@ -1 +1,24 @@
+if ENABLE_NEWLIB_ICONV
+
+libc_a_SOURCES += \
+	%D%/aliasesi.c \
+	%D%/ucsconv.c \
+	%D%/nullconv.c \
+	%D%/iconv.c \
+	%D%/aliasesbi.c \
+	%D%/iconvnls.c
+
+## The following interfaces are EL/IX level 2
+if !ELIX_LEVEL_1
+libc_a_SOURCES += \
+	%D%/aliasesi.c \
+	%D%/ucsconv.c \
+	%D%/nullconv.c \
+	%D%/iconv.c \
+	%D%/aliasesbi.c \
+	%D%/iconvnls.c
+endif
+
+endif
+
 LIBC_CHEWOUT_FILES += %D%/iconv.def
diff --git a/newlib/libc/locale/Makefile.am b/newlib/libc/locale/Makefile.am
deleted file mode 100644
index d14fd668930e..000000000000
--- a/newlib/libc/locale/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = setlocale.h locale.c localeconv.c
-
-## The following interfaces are EL/IX level 2
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-ELIX_SOURCES = \
-	duplocale.c \
-	freelocale.c \
-	lctype.c \
-	lmessages.c \
-	lnumeric.c \
-	lmonetary.c \
-	newlocale.c \
-	nl_langinfo.c \
-	timelocal.c \
-	uselocale.c
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/locale/Makefile.inc b/newlib/libc/locale/Makefile.inc
index 7af1534c8f96..cef4131d08ec 100644
--- a/newlib/libc/locale/Makefile.inc
+++ b/newlib/libc/locale/Makefile.inc
@@ -1,3 +1,23 @@
+libc_a_SOURCES += \
+	%D%/setlocale.h \
+	%D%/locale.c \
+	%D%/localeconv.c
+
+## The following interfaces are EL/IX level 2
+if !ELIX_LEVEL_1
+libc_a_SOURCES += \
+	%D%/duplocale.c \
+	%D%/freelocale.c \
+	%D%/lctype.c \
+	%D%/lmessages.c \
+	%D%/lnumeric.c \
+	%D%/lmonetary.c \
+	%D%/newlocale.c \
+	%D%/nl_langinfo.c \
+	%D%/timelocal.c \
+	%D%/uselocale.c
+endif
+
 LIBC_CHEWOUT_FILES += \
 	%D%/duplocale.def \
 	%D%/freelocale.def \
diff --git a/newlib/libc/machine/Makefile.inc b/newlib/libc/machine/Makefile.inc
index e69de29bb2d1..8aae2c52ccdb 100644
--- a/newlib/libc/machine/Makefile.inc
+++ b/newlib/libc/machine/Makefile.inc
@@ -0,0 +1,174 @@
+if HAVE_LIBC_MACHINE_AARCH64
+include %D%/aarch64/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_AMDGCN
+include %D%/amdgcn/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_ARC
+include %D%/arc/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_ARM
+include %D%/arm/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_BFIN
+include %D%/bfin/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_CR16
+include %D%/cr16/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_CRIS
+include %D%/cris/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_CRX
+include %D%/crx/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_CSKY
+include %D%/csky/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_D10V
+include %D%/d10v/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_D30V
+include %D%/d30v/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_EPIPHANY
+include %D%/epiphany/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_FR30
+include %D%/fr30/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_FRV
+include %D%/frv/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_FT32
+include %D%/ft32/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_H8300
+include %D%/h8300/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_H8500
+include %D%/h8500/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_HPPA
+include %D%/hppa/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_I386
+include %D%/i386/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_I960
+include %D%/i960/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_IQ2000
+include %D%/iq2000/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_LM32
+include %D%/lm32/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_M32C
+include %D%/m32c/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_M32R
+include %D%/m32r/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_M68HC11
+include %D%/m68hc11/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_M68K
+include %D%/m68k/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_M88K
+include %D%/m88k/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_MEP
+include %D%/mep/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_MICROBLAZE
+include %D%/microblaze/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_MIPS
+include %D%/mips/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_MN10200
+include %D%/mn10200/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_MN10300
+include %D%/mn10300/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_MOXIE
+include %D%/moxie/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_MSP430
+include %D%/msp430/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_MT
+include %D%/mt/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_NDS32
+include %D%/nds32/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_NECV70
+include %D%/necv70/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_NIOS2
+include %D%/nios2/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_NVPTX
+include %D%/nvptx/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_OR1K
+include %D%/or1k/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_POWERPC
+include %D%/powerpc/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_PRU
+include %D%/pru/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_RISCV
+include %D%/riscv/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_RL78
+include %D%/rl78/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_RX
+include %D%/rx/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_SH
+include %D%/sh/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_SPARC
+include %D%/sparc/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_SPU
+include %D%/spu/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_TIC4X
+include %D%/tic4x/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_TIC6X
+include %D%/tic6x/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_TIC80
+include %D%/tic80/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_V850
+include %D%/v850/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_VISIUM
+include %D%/visium/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_W65
+include %D%/w65/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_X86_64
+include %D%/x86_64/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_XC16X
+include %D%/xc16x/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_XSTORMY16
+include %D%/xstormy16/Makefile.inc
+endif
+if HAVE_LIBC_MACHINE_Z8K
+include %D%/z8k/Makefile.inc
+endif
diff --git a/newlib/libc/machine/a29k/Makefile.am b/newlib/libc/machine/a29k/Makefile.am
deleted file mode 100644
index 0264d7bc04a8..000000000000
--- a/newlib/libc/machine/a29k/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES =
diff --git a/newlib/libc/machine/aarch64/Makefile.am b/newlib/libc/machine/aarch64/Makefile.am
deleted file mode 100644
index a131f866e4c1..000000000000
--- a/newlib/libc/machine/aarch64/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES =
-lib_a_SOURCES += memchr-stub.c
-lib_a_SOURCES += memchr.S
-lib_a_SOURCES += memcmp-stub.c
-lib_a_SOURCES += memcmp.S
-lib_a_SOURCES += memcpy-stub.c
-lib_a_SOURCES += memcpy.S
-lib_a_SOURCES += memmove-stub.c
-lib_a_SOURCES += memmove.S
-lib_a_SOURCES += memset-stub.c
-lib_a_SOURCES += memset.S
-lib_a_SOURCES += rawmemchr.S
-lib_a_SOURCES += rawmemchr-stub.c
-lib_a_SOURCES += setjmp.S
-lib_a_SOURCES += stpcpy-stub.c
-lib_a_SOURCES += stpcpy.S
-lib_a_SOURCES += strchr-stub.c
-lib_a_SOURCES += strchr.S
-lib_a_SOURCES += strchrnul-stub.c
-lib_a_SOURCES += strchrnul.S
-lib_a_SOURCES += strcmp-stub.c
-lib_a_SOURCES += strcmp.S
-lib_a_SOURCES += strcpy-stub.c
-lib_a_SOURCES += strcpy.S
-lib_a_SOURCES += strlen-stub.c
-lib_a_SOURCES += strlen.S
-lib_a_SOURCES += strncmp-stub.c
-lib_a_SOURCES += strncmp.S
-lib_a_SOURCES += strnlen-stub.c
-lib_a_SOURCES += strnlen.S
-lib_a_SOURCES += strrchr-stub.c
-lib_a_SOURCES += strrchr.S
-
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/aarch64/Makefile.inc b/newlib/libc/machine/aarch64/Makefile.inc
new file mode 100644
index 000000000000..063a2a84ae45
--- /dev/null
+++ b/newlib/libc/machine/aarch64/Makefile.inc
@@ -0,0 +1,32 @@
+libc_a_SOURCES += \
+	%D%/memchr-stub.c \
+	%D%/memchr.S \
+	%D%/memcmp-stub.c \
+	%D%/memcmp.S \
+	%D%/memcpy-stub.c \
+	%D%/memcpy.S \
+	%D%/memmove-stub.c \
+	%D%/memmove.S \
+	%D%/memset-stub.c \
+	%D%/memset.S \
+	%D%/rawmemchr.S \
+	%D%/rawmemchr-stub.c \
+	%D%/setjmp.S \
+	%D%/stpcpy-stub.c \
+	%D%/stpcpy.S \
+	%D%/strchr-stub.c \
+	%D%/strchr.S \
+	%D%/strchrnul-stub.c \
+	%D%/strchrnul.S \
+	%D%/strcmp-stub.c \
+	%D%/strcmp.S \
+	%D%/strcpy-stub.c \
+	%D%/strcpy.S \
+	%D%/strlen-stub.c \
+	%D%/strlen.S \
+	%D%/strncmp-stub.c \
+	%D%/strncmp.S \
+	%D%/strnlen-stub.c \
+	%D%/strnlen.S \
+	%D%/strrchr-stub.c \
+	%D%/strrchr.S
diff --git a/newlib/libc/machine/amdgcn/Makefile.am b/newlib/libc/machine/amdgcn/Makefile.am
deleted file mode 100644
index 34c0399d55a1..000000000000
--- a/newlib/libc/machine/amdgcn/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = abort.c exit.c atexit.c malloc_support.c getreent.c signal.c
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/amdgcn/Makefile.inc b/newlib/libc/machine/amdgcn/Makefile.inc
new file mode 100644
index 000000000000..6253e4d70b33
--- /dev/null
+++ b/newlib/libc/machine/amdgcn/Makefile.inc
@@ -0,0 +1,7 @@
+libc_a_SOURCES += \
+	%D%/abort.c \
+	%D%/exit.c \
+	%D%/atexit.c \
+	%D%/malloc_support.c \
+	%D%/getreent.c \
+	%D%/signal.c
diff --git a/newlib/libc/machine/arc/Makefile.am b/newlib/libc/machine/arc/Makefile.am
deleted file mode 100644
index 47ff14791c08..000000000000
--- a/newlib/libc/machine/arc/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES =			\
-	memcmp.S		\
-	memcmp-bs-norm.S	\
-	memcmp-stub.c		\
-	memcpy.S		\
-	memcpy-archs.S		\
-	memcpy-bs.S		\
-	memcpy-stub.c		\
-	memset.S		\
-	memset-archs.S		\
-	memset-bs.S		\
-	memset-stub.c		\
-	setjmp.S		\
-	strchr.S		\
-	strchr-bs.S		\
-	strchr-bs-norm.S	\
-	strchr-stub.c		\
-	strcmp.S		\
-	strcmp-archs.S		\
-	strcmp-stub.c		\
-	strcpy.S		\
-	strcpy-bs.S		\
-	strcpy-bs-arc600.S	\
-	strcpy-stub.c		\
-	strlen.S		\
-	strlen-bs.S		\
-	strlen-bs-norm.S	\
-	strlen-stub.c		\
-	strncpy.S		\
-	strncpy-stub.c		\
-	strncpy-bs.S
-
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-pdf:
-install-pdf:
diff --git a/newlib/libc/machine/arc/Makefile.inc b/newlib/libc/machine/arc/Makefile.inc
new file mode 100644
index 000000000000..c0d6d7b39589
--- /dev/null
+++ b/newlib/libc/machine/arc/Makefile.inc
@@ -0,0 +1,31 @@
+libc_a_SOURCES += \
+	%D%/memcmp.S \
+	%D%/memcmp-bs-norm.S \
+	%D%/memcmp-stub.c \
+	%D%/memcpy.S \
+	%D%/memcpy-archs.S \
+	%D%/memcpy-bs.S \
+	%D%/memcpy-stub.c \
+	%D%/memset.S \
+	%D%/memset-archs.S \
+	%D%/memset-bs.S \
+	%D%/memset-stub.c \
+	%D%/setjmp.S \
+	%D%/strchr.S \
+	%D%/strchr-bs.S \
+	%D%/strchr-bs-norm.S \
+	%D%/strchr-stub.c \
+	%D%/strcmp.S \
+	%D%/strcmp-archs.S \
+	%D%/strcmp-stub.c \
+	%D%/strcpy.S \
+	%D%/strcpy-bs.S \
+	%D%/strcpy-bs-arc600.S \
+	%D%/strcpy-stub.c \
+	%D%/strlen.S \
+	%D%/strlen-bs.S \
+	%D%/strlen-bs-norm.S \
+	%D%/strlen-stub.c \
+	%D%/strncpy.S \
+	%D%/strncpy-stub.c \
+	%D%/strncpy-bs.S
diff --git a/newlib/libc/machine/arm/Makefile.am b/newlib/libc/machine/arm/Makefile.am
deleted file mode 100644
index ba308c195afa..000000000000
--- a/newlib/libc/machine/arm/Makefile.am
+++ /dev/null
@@ -1,48 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S strcmp.S strcpy.c \
-		aeabi_memcpy.c aeabi_memcpy-armv7a.S \
-		aeabi_memmove.c aeabi_memmove-soft.S \
-		aeabi_memset.c aeabi_memset-soft.S aeabi_memclr.c
-lib_a_SOURCES += memchr-stub.c
-lib_a_SOURCES += memchr.S
-lib_a_SOURCES += memcpy-stub.c
-lib_a_SOURCES += memcpy.S
-lib_a_SOURCES += strlen-stub.c
-lib_a_SOURCES += strlen.S
-
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-MEMCHR_DEP=acle-compat.h
-MEMCPY_DEP=memcpy-armv7a.S memcpy-armv7m.S
-STRCMP_DEP=strcmp-arm-tiny.S strcmp-armv4.S strcmp-armv4t.S strcmp-armv6.S \
-	strcmp-armv6m.S strcmp-armv7.S strcmp-armv7m.S
-AEABI_MEMMOVE_DEP=aeabi_memmove-thumb.S aeabi_memmove-thumb2.S \
-	aeabi_memmove-arm.S
-AEABI_MEMSET_DEP=aeabi_memset-thumb.S aeabi_memset-thumb2.S \
-	aeabi_memset-arm.S
-
-$(lpfx)memchr.o: $(MEMCHR_DEP)
-$(lpfx)memchr.obj: $(MEMCHR_DEP)
-
-$(lpfx)memcpy.o: $(MEMCPY_DEP)
-
-$(lpfx)memcpy.obj: $(MEMCPY_DEP)
-
-$(lpfx)strcmp.o: $(STRCMP_DEP)
-
-$(lpfx)strcmp.obj: $(STRCMP_DEP)
-
-$(lpfx)aeabi_memmove.o: $(AEABI_MEMMOVE_DEP)
-
-$(lpfx)aeabi_memmove.obj: $(AEABI_MEMMOVE_DEP)
-
-$(lpfx)aeabi_memset.o: $(AEABI_MEMSET_DEP)
-
-$(lpfx)aeabi_memset.obj: $(AEABI_MEMSET_DEP)
diff --git a/newlib/libc/machine/arm/Makefile.inc b/newlib/libc/machine/arm/Makefile.inc
new file mode 100644
index 000000000000..2d6c08d71972
--- /dev/null
+++ b/newlib/libc/machine/arm/Makefile.inc
@@ -0,0 +1,11 @@
+libc_a_SOURCES += \
+	%D%/setjmp.S %D%/strcmp.S %D%/strcpy.c \
+	%D%/aeabi_memcpy.c %D%/aeabi_memcpy-armv7a.S \
+	%D%/aeabi_memmove.c %D%/aeabi_memmove-soft.S \
+	%D%/aeabi_memset.c %D%/aeabi_memset-soft.S %D%/aeabi_memclr.c \
+	%D%/memchr-stub.c \
+	%D%/memchr.S \
+	%D%/memcpy-stub.c \
+	%D%/memcpy.S \
+	%D%/strlen-stub.c \
+	%D%/strlen.S
diff --git a/newlib/libc/machine/bfin/Makefile.am b/newlib/libc/machine/bfin/Makefile.am
deleted file mode 100644
index 98eeda0fd60e..000000000000
--- a/newlib/libc/machine/bfin/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S longjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/bfin/Makefile.inc b/newlib/libc/machine/bfin/Makefile.inc
new file mode 100644
index 000000000000..646a81335a08
--- /dev/null
+++ b/newlib/libc/machine/bfin/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/longjmp.S
diff --git a/newlib/libc/machine/cr16/Makefile.am b/newlib/libc/machine/cr16/Makefile.am
deleted file mode 100644
index f9204e299401..000000000000
--- a/newlib/libc/machine/cr16/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S getenv.c
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/cr16/Makefile.inc b/newlib/libc/machine/cr16/Makefile.inc
new file mode 100644
index 000000000000..8075d20f0fcc
--- /dev/null
+++ b/newlib/libc/machine/cr16/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/getenv.c
diff --git a/newlib/libc/machine/cris/Makefile.am b/newlib/libc/machine/cris/Makefile.am
deleted file mode 100644
index 1b8e3bfc2ec3..000000000000
--- a/newlib/libc/machine/cris/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-# We also make a library with just the useful
-# machine-but-not-system-specific functions, usable as an add-on
-# by itself together with e.g. uclibc.
-toollib_LIBRARIES = libic.a
-
-lib_a_SOURCES = setjmp.c memcpy.c memset.c memmove.c libcdtor.c
-lib_a_CFLAGS=$(AM_CFLAGS)
-
-libic_a_SOURCES = setjmp.c memcpy.c memset.c memmove.c libcdtor.c
-libic_a_CCASFLAGS=$(AM_CCASFLAGS)
-libic_a_CFLAGS=$(AM_CFLAGS)
-tooldir = $(exec_prefix)/$(host_alias)
-toollibdir = $(tooldir)/lib$(MULTISUBDIR)
diff --git a/newlib/libc/machine/cris/Makefile.inc b/newlib/libc/machine/cris/Makefile.inc
new file mode 100644
index 000000000000..f1864e352fb6
--- /dev/null
+++ b/newlib/libc/machine/cris/Makefile.inc
@@ -0,0 +1,13 @@
+libc_a_SOURCES += %D%/setjmp.c %D%/memcpy.c %D%/memset.c %D%/memmove.c %D%/libcdtor.c
+
+# We also make a library with just the useful
+# machine-but-not-system-specific functions, usable as an add-on
+# by itself together with e.g. uclibc.
+toollib_LIBRARIES += %D%/libic.a
+%C%_libic_a_SOURCES =
+%C%_libic_a_LIBADD = \
+	%D%/libc_a-setjmp.o \
+	%D%/libc_a-memcpy.o \
+	%D%/libc_a-memset.o \
+	%D%/libc_a-memmove.o \
+	%D%/libc_a-libcdtor.o
diff --git a/newlib/libc/machine/crx/Makefile.am b/newlib/libc/machine/crx/Makefile.am
deleted file mode 100644
index f9204e299401..000000000000
--- a/newlib/libc/machine/crx/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S getenv.c
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/crx/Makefile.inc b/newlib/libc/machine/crx/Makefile.inc
new file mode 100644
index 000000000000..8075d20f0fcc
--- /dev/null
+++ b/newlib/libc/machine/crx/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/getenv.c
diff --git a/newlib/libc/machine/csky/Makefile.am b/newlib/libc/machine/csky/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/csky/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/csky/Makefile.inc b/newlib/libc/machine/csky/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/csky/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/d10v/Makefile.am b/newlib/libc/machine/d10v/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/d10v/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/d10v/Makefile.inc b/newlib/libc/machine/d10v/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/d10v/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/d30v/Makefile.am b/newlib/libc/machine/d30v/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/d30v/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/d30v/Makefile.inc b/newlib/libc/machine/d30v/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/d30v/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/epiphany/Makefile.am b/newlib/libc/machine/epiphany/Makefile.am
deleted file mode 100644
index 61fff1648852..000000000000
--- a/newlib/libc/machine/epiphany/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-## Copyright (c) 2011, Adapteva, Inc.
-## All rights reserved.
-
-## Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are met:
-##  * Redistributions of source code must retain the above copyright notice,
-##    this list of conditions and the following disclaimer.
-##  * Redistributions in binary form must reproduce the above copyright
-##    notice, this list of conditions and the following disclaimer in the
-##    documentation and/or other materials provided with the distribution.
-##  * Neither the name of Adapteva nor the names of its contributors may be
-##    used to endorse or promote products derived from this software without
-##    specific prior written permission.
-
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-## POSSIBILITY OF SUCH DAMAGE.
-
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/epiphany/Makefile.inc b/newlib/libc/machine/epiphany/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/epiphany/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/fr30/Makefile.am b/newlib/libc/machine/fr30/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/fr30/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/fr30/Makefile.inc b/newlib/libc/machine/fr30/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/fr30/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/frv/Makefile.am b/newlib/libc/machine/frv/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/frv/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/frv/Makefile.inc b/newlib/libc/machine/frv/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/frv/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/ft32/Makefile.am b/newlib/libc/machine/ft32/Makefile.am
deleted file mode 100644
index 43c38c00211b..000000000000
--- a/newlib/libc/machine/ft32/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S strlen.S memcpy.S strcmp.S memset.S strcpy.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/ft32/Makefile.inc b/newlib/libc/machine/ft32/Makefile.inc
new file mode 100644
index 000000000000..363850199c2a
--- /dev/null
+++ b/newlib/libc/machine/ft32/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/strlen.S %D%/memcpy.S %D%/strcmp.S %D%/memset.S %D%/strcpy.S
diff --git a/newlib/libc/machine/h8300/Makefile.am b/newlib/libc/machine/h8300/Makefile.am
deleted file mode 100644
index 54ba703056ef..000000000000
--- a/newlib/libc/machine/h8300/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = reg_memcpy.S reg_memset.S strcmp.S memcpy.S memset.S \
-	setjmp.S h8sx_strcpy.S
-lib_a_LIBADD = 
-lib_a_DEPENDENCIES = 
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/h8300/Makefile.inc b/newlib/libc/machine/h8300/Makefile.inc
new file mode 100644
index 000000000000..7335d982864e
--- /dev/null
+++ b/newlib/libc/machine/h8300/Makefile.inc
@@ -0,0 +1,3 @@
+libc_a_SOURCES += \
+	%D%/reg_memcpy.S %D%/reg_memset.S %D%/strcmp.S %D%/memcpy.S %D%/memset.S \
+	%D%/setjmp.S %D%/h8sx_strcpy.S
diff --git a/newlib/libc/machine/h8500/Makefile.am b/newlib/libc/machine/h8500/Makefile.am
deleted file mode 100644
index 2fe66abedc3f..000000000000
--- a/newlib/libc/machine/h8500/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = divsi3.c mulsi3.c divhi3.S shifts.c cmpsi.c psi.S setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/h8500/Makefile.inc b/newlib/libc/machine/h8500/Makefile.inc
new file mode 100644
index 000000000000..b437158887de
--- /dev/null
+++ b/newlib/libc/machine/h8500/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/divsi3.c %D%/mulsi3.c %D%/divhi3.S %D%/shifts.c %D%/cmpsi.c %D%/psi.S %D%/setjmp.S
diff --git a/newlib/libc/machine/hppa/Makefile.am b/newlib/libc/machine/hppa/Makefile.am
deleted file mode 100644
index 4875bfbc3625..000000000000
--- a/newlib/libc/machine/hppa/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = \
-	memchr.S memcmp.S memcpy.S memset.S setjmp.S strcat.S strcmp.S \
-	strcpy.S strlen.S strncat.S strncmp.S strncpy.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/hppa/Makefile.inc b/newlib/libc/machine/hppa/Makefile.inc
new file mode 100644
index 000000000000..c3d2da691492
--- /dev/null
+++ b/newlib/libc/machine/hppa/Makefile.inc
@@ -0,0 +1,5 @@
+libc_a_SOURCES += \
+	%D%/memchr.S %D%/memcmp.S %D%/memcpy.S %D%/memset.S \
+	%D%/setjmp.S \
+	%D%/strcat.S %D%/strcmp.S \
+	%D%/strcpy.S %D%/strlen.S %D%/strncat.S %D%/strncmp.S %D%/strncpy.S
diff --git a/newlib/libc/machine/i386/Makefile.am b/newlib/libc/machine/i386/Makefile.am
deleted file mode 100644
index fa1bec6ef45b..000000000000
--- a/newlib/libc/machine/i386/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-if MACH_ADD_SETJMP
-ADDED_SOURCES = setjmp.S
-else
-ADDED_SOURCES =
-endif
-
-LIB_SOURCES = \
-	memchr.S memcmp.S memcpy.S memset.S strchr.S \
-	memmove.S strlen.S i386mach.h
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES) $(ADDED_SOURCES)
-## These flag settings are basically redundant, but necessary to workaround the
-## automake limitation "Objects 'created with both libtool and without'".
-lib_a_CCASFLAGS = $(AM_CCASFLAGS)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/i386/Makefile.inc b/newlib/libc/machine/i386/Makefile.inc
new file mode 100644
index 000000000000..60c5c13e2020
--- /dev/null
+++ b/newlib/libc/machine/i386/Makefile.inc
@@ -0,0 +1,7 @@
+if MACH_ADD_SETJMP
+libc_a_SOURCES += %D%/setjmp.S
+endif
+
+libc_a_SOURCES += \
+	%D%/memchr.S %D%/memcmp.S %D%/memcpy.S %D%/memset.S %D%/strchr.S \
+	%D%/memmove.S %D%/strlen.S %D%/i386mach.h
diff --git a/newlib/libc/machine/i960/Makefile.am b/newlib/libc/machine/i960/Makefile.am
deleted file mode 100644
index 85b3a36ba83d..000000000000
--- a/newlib/libc/machine/i960/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES =
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/i960/Makefile.inc b/newlib/libc/machine/i960/Makefile.inc
new file mode 100644
index 000000000000..cb78946365fe
--- /dev/null
+++ b/newlib/libc/machine/i960/Makefile.inc
@@ -0,0 +1,29 @@
+libc_a_SOURCES += \
+	%D%/memccpy_ca.S \
+	%D%/memccpy.S \
+	%D%/memchr_ca.S \
+	%D%/memchr.S \
+	%D%/memcmp_ca.S \
+	%D%/memcmp.S \
+	%D%/memcpy_ca.S \
+	%D%/memcpy.S \
+	%D%/memset.S \
+	%D%/setjmp.S \
+	%D%/strchr_ca.S \
+	%D%/strchr.S \
+	%D%/strcmp_ca.S \
+	%D%/strcmp.S \
+	%D%/strcpy_ca.S \
+	%D%/strcpy.S \
+	%D%/strcspn.S \
+	%D%/strdup.S \
+	%D%/strlen_ca.S \
+	%D%/strlen.S \
+	%D%/strncat_ca.S \
+	%D%/strncat.S \
+	%D%/strncmp_ca.S \
+	%D%/strncmp.S \
+	%D%/strncpy_ca.S \
+	%D%/strncpy.S \
+	%D%/strpbrk.S \
+	%D%/strrchr.S
diff --git a/newlib/libc/machine/iq2000/Makefile.am b/newlib/libc/machine/iq2000/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/iq2000/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/iq2000/Makefile.inc b/newlib/libc/machine/iq2000/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/iq2000/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/lm32/Makefile.am b/newlib/libc/machine/lm32/Makefile.am
deleted file mode 100644
index a1c515e528a5..000000000000
--- a/newlib/libc/machine/lm32/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/lm32/Makefile.inc b/newlib/libc/machine/lm32/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/lm32/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/m32c/Makefile.am b/newlib/libc/machine/m32c/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/m32c/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/m32c/Makefile.inc b/newlib/libc/machine/m32c/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/m32c/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/m32r/Makefile.am b/newlib/libc/machine/m32r/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/m32r/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/m32r/Makefile.inc b/newlib/libc/machine/m32r/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/m32r/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/m68hc11/Makefile.am b/newlib/libc/machine/m68hc11/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/m68hc11/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/m68hc11/Makefile.inc b/newlib/libc/machine/m68hc11/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/m68hc11/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/m68k/Makefile.am b/newlib/libc/machine/m68k/Makefile.am
deleted file mode 100644
index cc8e9ae06954..000000000000
--- a/newlib/libc/machine/m68k/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S strcpy.c strlen.c memcpy.S memset.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/m68k/Makefile.inc b/newlib/libc/machine/m68k/Makefile.inc
new file mode 100644
index 000000000000..262e4b4daa63
--- /dev/null
+++ b/newlib/libc/machine/m68k/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/strcpy.c %D%/strlen.c %D%/memcpy.S %D%/memset.S
diff --git a/newlib/libc/machine/m88k/Makefile.am b/newlib/libc/machine/m88k/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/m88k/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/m88k/Makefile.inc b/newlib/libc/machine/m88k/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/m88k/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/mep/Makefile.am b/newlib/libc/machine/mep/Makefile.am
deleted file mode 100644
index cba3878c8e43..000000000000
--- a/newlib/libc/machine/mep/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/mep/Makefile.inc b/newlib/libc/machine/mep/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/mep/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/microblaze/Makefile.am b/newlib/libc/machine/microblaze/Makefile.am
deleted file mode 100644
index 66ddd0144e64..000000000000
--- a/newlib/libc/machine/microblaze/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = strlen.c strcmp.c strcpy.c setjmp.S longjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/microblaze/Makefile.inc b/newlib/libc/machine/microblaze/Makefile.inc
new file mode 100644
index 000000000000..3fc3b9a2f164
--- /dev/null
+++ b/newlib/libc/machine/microblaze/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/strlen.c %D%/strcmp.c %D%/strcpy.c %D%/setjmp.S %D%/longjmp.S
diff --git a/newlib/libc/machine/mips/Makefile.am b/newlib/libc/machine/mips/Makefile.am
deleted file mode 100644
index 1cdec2f073a1..000000000000
--- a/newlib/libc/machine/mips/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S strlen.c strcmp.S strncpy.c memset.S memcpy.S
diff --git a/newlib/libc/machine/mips/Makefile.inc b/newlib/libc/machine/mips/Makefile.inc
new file mode 100644
index 000000000000..22f0c6ef9ca2
--- /dev/null
+++ b/newlib/libc/machine/mips/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/strlen.c %D%/strcmp.S %D%/strncpy.c %D%/memset.S %D%/memcpy.S
diff --git a/newlib/libc/machine/mn10200/Makefile.am b/newlib/libc/machine/mn10200/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/mn10200/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/mn10200/Makefile.inc b/newlib/libc/machine/mn10200/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/mn10200/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/mn10300/Makefile.am b/newlib/libc/machine/mn10300/Makefile.am
deleted file mode 100644
index 4016de0cde59..000000000000
--- a/newlib/libc/machine/mn10300/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS) -Wa,--gdwarf-2
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S memchr.S memcmp.S memcpy.S memset.S strchr.S \
-	strcmp.S strcpy.S strlen.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/mn10300/Makefile.inc b/newlib/libc/machine/mn10300/Makefile.inc
new file mode 100644
index 000000000000..299a38807fe5
--- /dev/null
+++ b/newlib/libc/machine/mn10300/Makefile.inc
@@ -0,0 +1,5 @@
+libc_a_CCASFLAGS_%C% = -Wa,--gdwarf-2
+
+libc_a_SOURCES += \
+	%D%/setjmp.S %D%/memchr.S %D%/memcmp.S %D%/memcpy.S %D%/memset.S %D%/strchr.S \
+	%D%/strcmp.S %D%/strcpy.S %D%/strlen.S
diff --git a/newlib/libc/machine/moxie/Makefile.am b/newlib/libc/machine/moxie/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/moxie/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/moxie/Makefile.inc b/newlib/libc/machine/moxie/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/moxie/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/msp430/Makefile.am b/newlib/libc/machine/msp430/Makefile.am
deleted file mode 100644
index 4d21eaeebe69..000000000000
--- a/newlib/libc/machine/msp430/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions
-# of the BSD License.   This program is distributed in the hope that
-# it will be useful, but WITHOUT ANY WARRANTY expressed or implied,
-# including the implied warranties of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  A copy of this license is available at
-# http://www.opensource.org/licenses. Any Red Hat trademarks that are
-# incorporated in the source code or documentation are not subject to
-# the BSD License and may only be used or replicated with the express
-# permission of Red Hat, Inc.
-
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S $(TINY_SOURCES)
-lib_a_CFLAGS=$(AM_CFLAGS)
-
-# tiny-printf.c and tiny-puts.c are derived from the nano printf/puts
-# functions, so other supporting nano functions are required, and the tiny
-# printf/puts will not work without them.
-if NEWLIB_NANO_FORMATTED_IO
-TINY_SOURCES = tiny-puts.c tiny-printf.c
-endif
diff --git a/newlib/libc/machine/msp430/Makefile.inc b/newlib/libc/machine/msp430/Makefile.inc
new file mode 100644
index 000000000000..0571a60b103e
--- /dev/null
+++ b/newlib/libc/machine/msp430/Makefile.inc
@@ -0,0 +1,8 @@
+libc_a_SOURCES += %D%/setjmp.S
+
+## tiny-printf.c and tiny-puts.c are derived from the nano printf/puts
+## functions, so other supporting nano functions are required, and the tiny
+## printf/puts will not work without them.
+if NEWLIB_NANO_FORMATTED_IO
+libc_a_SOURCES += %D%/tiny-puts.c %D%/tiny-printf.c
+endif
diff --git a/newlib/libc/machine/mt/Makefile.am b/newlib/libc/machine/mt/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/mt/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/mt/Makefile.inc b/newlib/libc/machine/mt/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/mt/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/nds32/Makefile.am b/newlib/libc/machine/nds32/Makefile.am
deleted file mode 100644
index aa2cdc872aa3..000000000000
--- a/newlib/libc/machine/nds32/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-if IS_NDS32_ISA_V3M
-lib_a_SOURCES = abort.c setjmp.S strcmp.S strcpy.S
-else
-lib_a_SOURCES = abort.c memcpy.S memset.S setjmp.S strcmp.S strcpy.S
-endif
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/nds32/Makefile.inc b/newlib/libc/machine/nds32/Makefile.inc
new file mode 100644
index 000000000000..b0fdfa07e39d
--- /dev/null
+++ b/newlib/libc/machine/nds32/Makefile.inc
@@ -0,0 +1,8 @@
+libc_a_SOURCES += \
+	%D%/abort.c \
+	%D%/setjmp.S \
+	%D%/strcmp.S \
+	%D%/strcpy.S
+if !IS_NDS32_ISA_V3M
+libc_a_SOURCES += %D%/memcpy.S %D%/memset.S
+endif
diff --git a/newlib/libc/machine/necv70/Makefile.am b/newlib/libc/machine/necv70/Makefile.am
deleted file mode 100644
index 23c051fcdad5..000000000000
--- a/newlib/libc/machine/necv70/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = fastmath.S setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/necv70/Makefile.inc b/newlib/libc/machine/necv70/Makefile.inc
new file mode 100644
index 000000000000..c9cb8f1e654f
--- /dev/null
+++ b/newlib/libc/machine/necv70/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/fastmath.S %D%/setjmp.S
diff --git a/newlib/libc/machine/nios2/Makefile.am b/newlib/libc/machine/nios2/Makefile.am
deleted file mode 100644
index 5badafc8fddb..000000000000
--- a/newlib/libc/machine/nios2/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.s
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/nios2/Makefile.inc b/newlib/libc/machine/nios2/Makefile.inc
new file mode 100644
index 000000000000..3b3f2dc723a4
--- /dev/null
+++ b/newlib/libc/machine/nios2/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.s
diff --git a/newlib/libc/machine/nvptx/Makefile.am b/newlib/libc/machine/nvptx/Makefile.am
deleted file mode 100644
index 62e9f27864dc..000000000000
--- a/newlib/libc/machine/nvptx/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = calloc.c callocr.c malloc.c mallocr.c realloc.c reallocr.c \
-		free.c write.c assert.c puts.c putchar.c printf.c abort.c \
-		exit.c misc.c clock.c
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/nvptx/Makefile.inc b/newlib/libc/machine/nvptx/Makefile.inc
new file mode 100644
index 000000000000..c4c3a5cb391b
--- /dev/null
+++ b/newlib/libc/machine/nvptx/Makefile.inc
@@ -0,0 +1,4 @@
+libc_a_SOURCES += \
+	%D%/calloc.c %D%/callocr.c %D%/malloc.c %D%/mallocr.c %D%/realloc.c %D%/reallocr.c \
+	%D%/free.c %D%/write.c %D%/assert.c %D%/puts.c %D%/putchar.c %D%/printf.c %D%/abort.c \
+	%D%/exit.c %D%/misc.c %D%/clock.c
diff --git a/newlib/libc/machine/or1k/Makefile.am b/newlib/libc/machine/or1k/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/or1k/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/or1k/Makefile.inc b/newlib/libc/machine/or1k/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/or1k/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/powerpc/Makefile.am b/newlib/libc/machine/powerpc/Makefile.am
deleted file mode 100644
index 650d889a6f0c..000000000000
--- a/newlib/libc/machine/powerpc/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
-if HAVE_POWERPC_ALTIVEC
-lib_a_SOURCES += \
-	vfprintf.c \
-	vfscanf.c \
-	vec_malloc.c \
-	vec_calloc.c \
-	vec_free.c \
-	vec_realloc.c \
-	vec_mallocr.c \
-	vec_callocr.c \
-	vec_reallocr.c
-endif
-if HAVE_POWERPC_SPE
-lib_a_SOURCES += \
-	atosfix16.c \
-	atosfix32.c \
-	atosfix64.c \
-	atoufix16.c \
-	atoufix32.c \
-	atoufix64.c \
-	simdldtoa.c \
-	strtosfix16.c \
-	strtosfix32.c \
-	strtosfix64.c \
-	strtoufix16.c \
-	strtoufix32.c \
-	strtoufix64.c \
-	ufix64toa.c \
-	vfprintf.c \
-	vfscanf.c
-endif
diff --git a/newlib/libc/machine/powerpc/Makefile.inc b/newlib/libc/machine/powerpc/Makefile.inc
new file mode 100644
index 000000000000..55c7ebdc60da
--- /dev/null
+++ b/newlib/libc/machine/powerpc/Makefile.inc
@@ -0,0 +1,35 @@
+libc_a_CPPFLAGS_%C% = -I$(srcdir)/libc/stdio -I$(srcdir)/libc/stdlib
+
+libc_a_SOURCES += %D%/setjmp.S
+
+if HAVE_POWERPC_ALTIVEC
+libc_a_SOURCES += \
+	%D%/vfprintf.c \
+	%D%/vfscanf.c \
+	%D%/vec_malloc.c \
+	%D%/vec_calloc.c \
+	%D%/vec_free.c \
+	%D%/vec_realloc.c \
+	%D%/vec_mallocr.c \
+	%D%/vec_callocr.c \
+	%D%/vec_reallocr.c
+endif
+if HAVE_POWERPC_SPE
+libc_a_SOURCES += \
+	%D%/atosfix16.c \
+	%D%/atosfix32.c \
+	%D%/atosfix64.c \
+	%D%/atoufix16.c \
+	%D%/atoufix32.c \
+	%D%/atoufix64.c \
+	%D%/simdldtoa.c \
+	%D%/strtosfix16.c \
+	%D%/strtosfix32.c \
+	%D%/strtosfix64.c \
+	%D%/strtoufix16.c \
+	%D%/strtoufix32.c \
+	%D%/strtoufix64.c \
+	%D%/ufix64toa.c \
+	%D%/vfprintf.c \
+	%D%/vfscanf.c
+endif
diff --git a/newlib/libc/machine/pru/Makefile.am b/newlib/libc/machine/pru/Makefile.am
deleted file mode 100644
index 5badafc8fddb..000000000000
--- a/newlib/libc/machine/pru/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.s
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/pru/Makefile.inc b/newlib/libc/machine/pru/Makefile.inc
new file mode 100644
index 000000000000..3b3f2dc723a4
--- /dev/null
+++ b/newlib/libc/machine/pru/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.s
diff --git a/newlib/libc/machine/riscv/Makefile.am b/newlib/libc/machine/riscv/Makefile.am
deleted file mode 100644
index 7bd1b78602f5..000000000000
--- a/newlib/libc/machine/riscv/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = memmove.S memmove-stub.c memset.S memcpy-asm.S memcpy.c strlen.c \
-	strcpy.c strcmp.S setjmp.S ieeefp.c ffs.c
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/riscv/Makefile.inc b/newlib/libc/machine/riscv/Makefile.inc
new file mode 100644
index 000000000000..47bbce00b79e
--- /dev/null
+++ b/newlib/libc/machine/riscv/Makefile.inc
@@ -0,0 +1,3 @@
+libc_a_SOURCES += \
+	%D%/memmove.S %D%/memmove-stub.c %D%/memset.S %D%/memcpy-asm.S %D%/memcpy.c %D%/strlen.c \
+	%D%/strcpy.c %D%/strcmp.S %D%/setjmp.S %D%/ieeefp.c %D%/ffs.c
diff --git a/newlib/libc/machine/rl78/Makefile.am b/newlib/libc/machine/rl78/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/rl78/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/rl78/Makefile.inc b/newlib/libc/machine/rl78/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/rl78/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/rx/Makefile.am b/newlib/libc/machine/rx/Makefile.am
deleted file mode 100644
index cce129a12338..000000000000
--- a/newlib/libc/machine/rx/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S \
- strncmp.S strcmp.S strncpy.S strcpy.S strlen.S strcat.S strncat.S \
- memset.S mempcpy.S memcpy.S memmove.S memchr.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/rx/Makefile.inc b/newlib/libc/machine/rx/Makefile.inc
new file mode 100644
index 000000000000..5c28f0687f84
--- /dev/null
+++ b/newlib/libc/machine/rx/Makefile.inc
@@ -0,0 +1,4 @@
+libc_a_SOURCES += \
+	%D%/setjmp.S \
+	%D%/strncmp.S %D%/strcmp.S %D%/strncpy.S %D%/strcpy.S %D%/strlen.S %D%/strcat.S %D%/strncat.S \
+	%D%/memset.S %D%/mempcpy.S %D%/memcpy.S %D%/memmove.S %D%/memchr.S
diff --git a/newlib/libc/machine/sh/Makefile.am b/newlib/libc/machine/sh/Makefile.am
deleted file mode 100644
index b0f904775fb7..000000000000
--- a/newlib/libc/machine/sh/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-if SH64
-lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strlen.S strcmp.S strncpy.S
-else
-lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strlen.S strcmp.S
-endif
-
-lib_a_CFLAGS=$(AM_CFLAGS)
-
-$(lpfx)memcpy.o: asm.h
-$(lpfx)memset.o: asm.h
-$(lpfx)setjmp.o: asm.h
-$(lpfx)strcpy.o: asm.h
-$(lpfx)strcmp.o: asm.h
-$(lpfx)strncpy.o: asm.h
diff --git a/newlib/libc/machine/sh/Makefile.inc b/newlib/libc/machine/sh/Makefile.inc
new file mode 100644
index 000000000000..fd9e26d687d1
--- /dev/null
+++ b/newlib/libc/machine/sh/Makefile.inc
@@ -0,0 +1,5 @@
+libc_a_SOURCES += %D%/memcpy.S %D%/memset.S %D%/setjmp.S %D%/strcpy.S %D%/strlen.S %D%/strcmp.S
+
+if SH64
+libc_a_SOURCES += %D%/strncpy.S
+endif
diff --git a/newlib/libc/machine/sparc/Makefile.am b/newlib/libc/machine/sparc/Makefile.am
deleted file mode 100644
index d54555777222..000000000000
--- a/newlib/libc/machine/sparc/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = scan.c shuffle.c setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/sparc/Makefile.inc b/newlib/libc/machine/sparc/Makefile.inc
new file mode 100644
index 000000000000..0630987a2c31
--- /dev/null
+++ b/newlib/libc/machine/sparc/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/scan.c %D%/shuffle.c %D%/setjmp.S
diff --git a/newlib/libc/machine/spu/Makefile.am b/newlib/libc/machine/spu/Makefile.am
deleted file mode 100644
index 611ec34850a6..000000000000
--- a/newlib/libc/machine/spu/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-lib_a_SOURCES = setjmp.S assert.c clearerr.c creat.c fclose.c feof.c \
-	ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c fiprintf.S \
-	fiscanf.S fopen.c fprintf.S fputc.c fputs.c fread.c freopen.c \
-	fscanf.S fseek.c fsetpos.c ftell.c fwrite.c getc.c getchar.c \
-	gets.c impure.c iprintf.S iscanf.S memcmp.c memcpy.c memmove.c \
-	memset.c perror.c printf.S putc.c putchar.c puts.c remove.c \
-	rename.c rewind.c scanf.S setbuf.c setvbuf.c siprintf.S siscanf.S \
-	sleep.c sniprintf.S snprintf.S sprintf.S sscanf.S stdio.c strcat.c \
-	strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c \
-	strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c tmpfile.c \
-	tmpnam.c ungetc.c usleep.c vfiprintf.c vfiscanf.c vfprintf.c \
-	vfscanf.c viprintf.c viscanf.c vprintf.c vscanf.c vsiprintf.c \
-	vsiscanf.c vsniprintf.c vsnprintf.c vsprintf.c vsscanf.c \
-	stack_reg_va.S spu_clock_svcs.c spu_clock_stop.c spu_timer_flih.S \
-	spu_timer_slih.c spu_timer_slih_reg.c spu_timer_svcs.c \
-	spu_timer_stop.c spu_timer_free.c spu_timebase.c fdopen.c
-
-if HAVE_SPU_EA
-lib_a_SOURCES += calloc_ea.c free_ea.c malloc_ea.c memchr_ea.c memcmp_ea.c \
-	memcpy_ea.c memmove_ea.c memset_ea.c mmap_ea.c mremap_ea.c msync_ea.c \
-	munmap_ea.c posix_memalign_ea.c realloc_ea.c strcat_ea.c strchr_ea.c \
-	strcmp_ea.c strcpy_ea.c strcspn_ea.c strlen_ea.c strncat_ea.c strncmp_ea.c \
-	strncpy_ea.c strpbrk_ea.c strrchr_ea.c strspn_ea.c strstr_ea.c read_ea.c \
-	pread_ea.c readv_ea.c write_ea.c pwrite_ea.c writev_ea.c spu-mcount.S \
-	spu-gmon.c
-endif
-
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/spu/Makefile.inc b/newlib/libc/machine/spu/Makefile.inc
new file mode 100644
index 000000000000..bc84e9a23ed8
--- /dev/null
+++ b/newlib/libc/machine/spu/Makefile.inc
@@ -0,0 +1,28 @@
+libc_a_SOURCES += \
+	%D%/setjmp.S %D%/assert.c %D%/clearerr.c %D%/creat.c %D%/fclose.c %D%/feof.c \
+	%D%/ferror.c %D%/fflush.c %D%/fgetc.c %D%/fgetpos.c %D%/fgets.c %D%/fileno.c %D%/fiprintf.S \
+	%D%/fiscanf.S %D%/fopen.c %D%/fprintf.S %D%/fputc.c %D%/fputs.c %D%/fread.c %D%/freopen.c \
+	%D%/fscanf.S %D%/fseek.c %D%/fsetpos.c %D%/ftell.c %D%/fwrite.c %D%/getc.c %D%/getchar.c \
+	%D%/gets.c %D%/impure.c %D%/iprintf.S %D%/iscanf.S %D%/memcmp.c %D%/memcpy.c %D%/memmove.c \
+	%D%/memset.c %D%/perror.c %D%/printf.S %D%/putc.c %D%/putchar.c %D%/puts.c %D%/remove.c \
+	%D%/rename.c %D%/rewind.c %D%/scanf.S %D%/setbuf.c %D%/setvbuf.c %D%/siprintf.S %D%/siscanf.S \
+	%D%/sleep.c %D%/sniprintf.S %D%/snprintf.S %D%/sprintf.S %D%/sscanf.S %D%/stdio.c %D%/strcat.c \
+	%D%/strchr.c %D%/strcmp.c %D%/strcpy.c %D%/strcspn.c %D%/strlen.c %D%/strncat.c %D%/strncmp.c \
+	%D%/strncpy.c %D%/strpbrk.c %D%/strrchr.c %D%/strspn.c %D%/strxfrm.c %D%/tmpfile.c \
+	%D%/tmpnam.c %D%/ungetc.c %D%/usleep.c %D%/vfiprintf.c %D%/vfiscanf.c %D%/vfprintf.c \
+	%D%/vfscanf.c %D%/viprintf.c %D%/viscanf.c %D%/vprintf.c %D%/vscanf.c %D%/vsiprintf.c \
+	%D%/vsiscanf.c %D%/vsniprintf.c %D%/vsnprintf.c %D%/vsprintf.c %D%/vsscanf.c \
+	%D%/stack_reg_va.S %D%/spu_clock_svcs.c %D%/spu_clock_stop.c %D%/spu_timer_flih.S \
+	%D%/spu_timer_slih.c %D%/spu_timer_slih_reg.c %D%/spu_timer_svcs.c \
+	%D%/spu_timer_stop.c %D%/spu_timer_free.c %D%/spu_timebase.c %D%/fdopen.c
+
+if HAVE_SPU_EA
+libc_a_SOURCES += \
+	%D%/calloc_ea.c %D%/free_ea.c %D%/malloc_ea.c %D%/memchr_ea.c %D%/memcmp_ea.c \
+	%D%/memcpy_ea.c %D%/memmove_ea.c %D%/memset_ea.c %D%/mmap_ea.c %D%/mremap_ea.c %D%/msync_ea.c \
+	%D%/munmap_ea.c %D%/posix_memalign_ea.c %D%/realloc_ea.c %D%/strcat_ea.c %D%/strchr_ea.c \
+	%D%/strcmp_ea.c %D%/strcpy_ea.c %D%/strcspn_ea.c %D%/strlen_ea.c %D%/strncat_ea.c %D%/strncmp_ea.c \
+	%D%/strncpy_ea.c %D%/strpbrk_ea.c %D%/strrchr_ea.c %D%/strspn_ea.c %D%/strstr_ea.c %D%/read_ea.c \
+	%D%/pread_ea.c %D%/readv_ea.c %D%/write_ea.c %D%/pwrite_ea.c %D%/writev_ea.c %D%/spu-mcount.S \
+	%D%/spu-gmon.c
+endif
diff --git a/newlib/libc/machine/tic4x/Makefile.am b/newlib/libc/machine/tic4x/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/tic4x/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/tic4x/Makefile.inc b/newlib/libc/machine/tic4x/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/tic4x/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/tic6x/Makefile.am b/newlib/libc/machine/tic6x/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/tic6x/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/tic6x/Makefile.inc b/newlib/libc/machine/tic6x/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/tic6x/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/tic80/Makefile.am b/newlib/libc/machine/tic80/Makefile.am
deleted file mode 100644
index 01355a09c5e9..000000000000
--- a/newlib/libc/machine/tic80/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/tic80/Makefile.inc b/newlib/libc/machine/tic80/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/tic80/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/v850/Makefile.am b/newlib/libc/machine/v850/Makefile.am
deleted file mode 100644
index cba3878c8e43..000000000000
--- a/newlib/libc/machine/v850/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/v850/Makefile.inc b/newlib/libc/machine/v850/Makefile.inc
new file mode 100644
index 000000000000..67137bce4279
--- /dev/null
+++ b/newlib/libc/machine/v850/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S
diff --git a/newlib/libc/machine/visium/Makefile.am b/newlib/libc/machine/visium/Makefile.am
deleted file mode 100644
index 62e11cf1cb0a..000000000000
--- a/newlib/libc/machine/visium/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = memcpy.c memset.c memmove.c setjmp.S
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/visium/Makefile.inc b/newlib/libc/machine/visium/Makefile.inc
new file mode 100644
index 000000000000..f931eaad9b21
--- /dev/null
+++ b/newlib/libc/machine/visium/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/memcpy.c %D%/memset.c %D%/memmove.c %D%/setjmp.S
diff --git a/newlib/libc/machine/w65/Makefile.am b/newlib/libc/machine/w65/Makefile.am
deleted file mode 100644
index 338024389b2c..000000000000
--- a/newlib/libc/machine/w65/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = udivhi3.S umodhi3.S smulhi3.S lshrhi.S sdivhi3.S mulsi3.c \
-	divsi3.c cmpsi.c
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/w65/Makefile.inc b/newlib/libc/machine/w65/Makefile.inc
new file mode 100644
index 000000000000..c06f8596e495
--- /dev/null
+++ b/newlib/libc/machine/w65/Makefile.inc
@@ -0,0 +1,3 @@
+libc_a_SOURCES += \
+	%D%/udivhi3.S %D%/umodhi3.S %D%/smulhi3.S %D%/lshrhi.S %D%/sdivhi3.S %D%/mulsi3.c \
+	%D%/divsi3.c %D%/cmpsi.c
diff --git a/newlib/libc/machine/x86_64/Makefile.am b/newlib/libc/machine/x86_64/Makefile.am
deleted file mode 100644
index e6510cea74ca..000000000000
--- a/newlib/libc/machine/x86_64/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S memcpy.S memset.S
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/x86_64/Makefile.inc b/newlib/libc/machine/x86_64/Makefile.inc
new file mode 100644
index 000000000000..c7395a317126
--- /dev/null
+++ b/newlib/libc/machine/x86_64/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/memcpy.S %D%/memset.S
diff --git a/newlib/libc/machine/xc16x/Makefile.am b/newlib/libc/machine/xc16x/Makefile.am
deleted file mode 100644
index fe1b80b7fd9d..000000000000
--- a/newlib/libc/machine/xc16x/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S puts.c putchar.c
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/machine/xc16x/Makefile.inc b/newlib/libc/machine/xc16x/Makefile.inc
new file mode 100644
index 000000000000..853f9ad310fe
--- /dev/null
+++ b/newlib/libc/machine/xc16x/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/puts.c %D%/putchar.c
diff --git a/newlib/libc/machine/xstormy16/Makefile.am b/newlib/libc/machine/xstormy16/Makefile.am
deleted file mode 100644
index d3ada18d76a2..000000000000
--- a/newlib/libc/machine/xstormy16/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S \
-	calloc.c \
-	callocr.c \
-	cfree.c \
-	freer.c \
-	malign.c \
-	malloc.c \
-	mallocr.c \
-	msize.c \
-	mstats.c \
-	realloc.c \
-	reallocr.c \
-	valloc.c
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/xstormy16/Makefile.inc b/newlib/libc/machine/xstormy16/Makefile.inc
new file mode 100644
index 000000000000..c8df172ca3ab
--- /dev/null
+++ b/newlib/libc/machine/xstormy16/Makefile.inc
@@ -0,0 +1,14 @@
+libc_a_SOURCES += \
+	%D%/setjmp.S \
+	%D%/calloc.c \
+	%D%/callocr.c \
+	%D%/cfree.c \
+	%D%/freer.c \
+	%D%/malign.c \
+	%D%/malloc.c \
+	%D%/mallocr.c \
+	%D%/msize.c \
+	%D%/mstats.c \
+	%D%/realloc.c \
+	%D%/reallocr.c \
+	%D%/valloc.c
diff --git a/newlib/libc/machine/z8k/Makefile.am b/newlib/libc/machine/z8k/Makefile.am
deleted file mode 100644
index 5dbd32808127..000000000000
--- a/newlib/libc/machine/z8k/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S memset.S memcpy.S memmove.S memcmp.S
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/z8k/Makefile.inc b/newlib/libc/machine/z8k/Makefile.inc
new file mode 100644
index 000000000000..5e4a2a1723fe
--- /dev/null
+++ b/newlib/libc/machine/z8k/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/setjmp.S %D%/memset.S %D%/memcpy.S %D%/memmove.S %D%/memcmp.S
diff --git a/newlib/libc/misc/Makefile.am b/newlib/libc/misc/Makefile.am
deleted file mode 100644
index a9fdf70c5d6f..000000000000
--- a/newlib/libc/misc/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = __dprintf.c unctrl.c ffs.c init.c fini.c
-
-if NEWLIB_RETARGETABLE_LOCKING
-LIB_SOURCES += \
-	lock.c
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/misc/Makefile.inc b/newlib/libc/misc/Makefile.inc
index 54a53efff220..78bb022dd8a7 100644
--- a/newlib/libc/misc/Makefile.inc
+++ b/newlib/libc/misc/Makefile.inc
@@ -1,3 +1,15 @@
+libc_a_SOURCES += \
+	%D%/__dprintf.c \
+	%D%/unctrl.c \
+	%D%/ffs.c \
+	%D%/init.c \
+	%D%/fini.c
+
+if NEWLIB_RETARGETABLE_LOCKING
+libc_a_SOURCES += \
+	%D%/lock.c
+endif
+
 LIBC_CHEWOUT_FILES += \
 	%D%/ffs.def \
 	%D%/lock.def \
diff --git a/newlib/libc/posix/Makefile.am b/newlib/libc/posix/Makefile.am
deleted file mode 100644
index 571d57203222..000000000000
--- a/newlib/libc/posix/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-	closedir.c collate.c collcmp.c creat.c dirfd.c \
-	fnmatch.c glob.c _isatty.c isatty.c \
-	opendir.c readdir.c readdir_r.c \
-	regcomp.c regerror.c regexec.c regfree.c \
-	rewinddir.c sleep.c usleep.c \
-	telldir.c ftw.c nftw.c
-
-ELIX_2_SOURCES = \
-        scandir.c seekdir.c
-
-ELIX_3_SOURCES = \
-	execl.c execle.c execlp.c execv.c \
-	execve.c execvp.c wordexp.c wordfree.c
-
-ELIX_4_SOURCES = \
-	popen.c posix_spawn.c
-
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else 
-if ELIX_LEVEL_2
-ELIX_SOURCES = $(ELIX_2_SOURCES)
-else 
-if ELIX_LEVEL_3
-ELIX_SOURCES = $(ELIX_2_SOURCES) $(ELIX_3_SOURCES)
-else
-ELIX_SOURCES = $(ELIX_2_SOURCES) $(ELIX_3_SOURCES) $(ELIX_4_SOURCES)
-endif
-endif
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-AM_CFLAGS = -D_GNU_SOURCE
diff --git a/newlib/libc/posix/Makefile.inc b/newlib/libc/posix/Makefile.inc
index 74539dddbe72..99958054f646 100644
--- a/newlib/libc/posix/Makefile.inc
+++ b/newlib/libc/posix/Makefile.inc
@@ -1,3 +1,41 @@
+if HAVE_POSIX_DIR
+
+libc_a_SOURCES += \
+	%D%/closedir.c %D%/collate.c %D%/collcmp.c %D%/creat.c %D%/dirfd.c \
+	%D%/fnmatch.c %D%/glob.c %D%/_isatty.c %D%/isatty.c \
+	%D%/opendir.c %D%/readdir.c %D%/readdir_r.c \
+	%D%/regcomp.c %D%/regerror.c %D%/regexec.c %D%/regfree.c \
+	%D%/rewinddir.c %D%/sleep.c %D%/usleep.c \
+	%D%/telldir.c %D%/ftw.c %D%/nftw.c
+
+%C%_ELIX_2_SOURCES = \
+	%D%/scandir.c %D%/seekdir.c
+
+%C%_ELIX_3_SOURCES = \
+	%D%/execl.c %D%/execle.c %D%/execlp.c %D%/execv.c \
+	%D%/execve.c %D%/execvp.c %D%/wordexp.c %D%/wordfree.c
+
+%C%_ELIX_4_SOURCES = \
+	%D%/popen.c %D%/posix_spawn.c
+
+if ELIX_LEVEL_1
+libc_a_SOURCES +=
+else
+if ELIX_LEVEL_2
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES)
+else
+if ELIX_LEVEL_3
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES) $(%C%_ELIX_3_SOURCES)
+else
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES) $(%C%_ELIX_3_SOURCES) $(%C%_ELIX_4_SOURCES)
+endif
+endif
+endif
+
+endif
+
+libc_a_CPPFLAGS_%C% = -D_GNU_SOURCE
+
 LIBC_CHEWOUT_FILES += \
 	%D%/popen.def \
 	%D%/posix_spawn.def
diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am
deleted file mode 100644
index 912febaab504..000000000000
--- a/newlib/libc/reent/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-if HAVE_STDIO64_DIR
-STDIO64_SOURCES = \
-	fstat64r.c \
-	lseek64r.c \
-	stat64r.c \
-	open64r.c
-endif
-
-ELIX_2_SOURCES = $(STDIO64_SOURCES)
-ELIX_3_SOURCES = execr.c
-
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_SOURCES = $(ELIX_2_SOURCES)
-else
-ELIX_SOURCES = $(ELIX_2_SOURCES) $(ELIX_3_SOURCES)
-endif
-endif
-
-GENERAL_SOURCES = \
-	closer.c \
-	reent.c \
-	impure.c \
-	fcntlr.c \
-	fstatr.c \
-	getreent.c \
-	gettimeofdayr.c \
-	isattyr.c \
-	linkr.c \
-	lseekr.c \
-	mkdirr.c \
-	openr.c \
-	readr.c \
-	renamer.c \
-	signalr.c \
-	signgam.c \
-	sbrkr.c \
-	statr.c \
-	timesr.c \
-	unlinkr.c \
-	writer.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-$(lpfx)impure.o: $(srcdir)/impure.c $(srcdir)/../include/sys/reent.h
diff --git a/newlib/libc/reent/Makefile.inc b/newlib/libc/reent/Makefile.inc
index 975a8d82a83a..3a227ea62d30 100644
--- a/newlib/libc/reent/Makefile.inc
+++ b/newlib/libc/reent/Makefile.inc
@@ -1,3 +1,46 @@
+libc_a_SOURCES += \
+	%D%/closer.c \
+	%D%/reent.c \
+	%D%/impure.c \
+	%D%/fcntlr.c \
+	%D%/fstatr.c \
+	%D%/getreent.c \
+	%D%/gettimeofdayr.c \
+	%D%/isattyr.c \
+	%D%/linkr.c \
+	%D%/lseekr.c \
+	%D%/mkdirr.c \
+	%D%/openr.c \
+	%D%/readr.c \
+	%D%/renamer.c \
+	%D%/signalr.c \
+	%D%/signgam.c \
+	%D%/sbrkr.c \
+	%D%/statr.c \
+	%D%/timesr.c \
+	%D%/unlinkr.c \
+	%D%/writer.c
+
+%C%_ELIX_2_SOURCES =
+if HAVE_STDIO64_DIR
+%C%_ELIX_2_SOURCES += \
+	fstat64r.c \
+	lseek64r.c \
+	stat64r.c \
+	open64r.c
+endif
+%C%_ELIX_3_SOURCES = %D%/execr.c
+
+if ELIX_LEVEL_1
+libc_a_SOURCES +=
+else
+if ELIX_LEVEL_2
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES)
+else
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES) $(%C%_ELIX_3_SOURCES)
+endif
+endif
+
 LIBC_CHEWOUT_FILES += \
 	%D%/closer.def \
 	%D%/reent.def \
diff --git a/newlib/libc/search/Makefile.am b/newlib/libc/search/Makefile.am
deleted file mode 100644
index afd9c0499135..000000000000
--- a/newlib/libc/search/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-	bsearch.c \
-	db_local.h \
-	extern.h \
-	hash.h \
-	ndbm.c \
-	page.h \
-	qsort.c
-
-## Following are EL/IX level 2 interfaces
-if ELIX_LEVEL_1
-ELIX_2_SOURCES =
-else
-ELIX_2_SOURCES = \
-	hash.c \
-	hash_bigkey.c \
-	hash_buf.c \
-	hash_func.c \
-	hash_log2.c \
-	hash_page.c \
-	hcreate.c \
-	hcreate_r.c \
-	tdelete.c \
-	tdestroy.c \
-	tfind.c \
-	tsearch.c \
-	twalk.c
-endif
-
-## Following are EL/IX level 4 interfaces
-if ELIX_LEVEL_1
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_3
-ELIX_4_SOURCES =
-else
-ELIX_4_SOURCES = \
-	bsd_qsort_r.c \
-	qsort_r.c
-endif !ELIX_LEVEL_3
-endif !ELIX_LEVEL_2
-endif !ELIX_LEVEL_1
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/search/Makefile.inc b/newlib/libc/search/Makefile.inc
index a1704539b04c..5c28f197999e 100644
--- a/newlib/libc/search/Makefile.inc
+++ b/newlib/libc/search/Makefile.inc
@@ -1,3 +1,44 @@
+libc_a_SOURCES += \
+	%D%/bsearch.c \
+	%D%/db_local.h \
+	%D%/extern.h \
+	%D%/hash.h \
+	%D%/ndbm.c \
+	%D%/page.h \
+	%D%/qsort.c
+
+## Following are EL/IX level 2 interfaces
+if !ELIX_LEVEL_1
+libc_a_SOURCES += \
+	%D%/hash.c \
+	%D%/hash_bigkey.c \
+	%D%/hash_buf.c \
+	%D%/hash_func.c \
+	%D%/hash_log2.c \
+	%D%/hash_page.c \
+	%D%/hcreate.c \
+	%D%/hcreate_r.c \
+	%D%/tdelete.c \
+	%D%/tdestroy.c \
+	%D%/tfind.c \
+	%D%/tsearch.c \
+	%D%/twalk.c
+endif
+
+## Following are EL/IX level 4 interfaces
+if ELIX_LEVEL_1
+else
+if ELIX_LEVEL_2
+else
+if ELIX_LEVEL_3
+else
+libc_a_SOURCES += \
+	%D%/bsd_qsort_r.c \
+	%D%/qsort_r.c
+endif !ELIX_LEVEL_3
+endif !ELIX_LEVEL_2
+endif !ELIX_LEVEL_1
+
 LIBC_CHEWOUT_FILES += \
 	%D%/bsearch.def \
 	%D%/qsort.def \
diff --git a/newlib/libc/signal/Makefile.am b/newlib/libc/signal/Makefile.am
deleted file mode 100644
index b8afefeadc90..000000000000
--- a/newlib/libc/signal/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = psignal.c raise.c signal.c sig2str.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/signal/Makefile.inc b/newlib/libc/signal/Makefile.inc
index e0da75349a18..edf53f8ce2c9 100644
--- a/newlib/libc/signal/Makefile.inc
+++ b/newlib/libc/signal/Makefile.inc
@@ -1,3 +1,10 @@
+if HAVE_SIGNAL_DIR
+
+libc_a_SOURCES += \
+	%D%/psignal.c %D%/raise.c %D%/signal.c %D%/sig2str.c
+
+endif
+
 LIBC_CHEWOUT_FILES += \
 	%D%/psignal.def \
 	%D%/raise.def \
diff --git a/newlib/libc/ssp/Makefile.am b/newlib/libc/ssp/Makefile.am
deleted file mode 100644
index c56224ab1e79..000000000000
--- a/newlib/libc/ssp/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-  chk_fail.c \
-  stack_protector.c
-
-STRING_SOURCES = \
-  memcpy_chk.c \
-  memmove_chk.c \
-  mempcpy_chk.c \
-  memset_chk.c \
-  stpcpy_chk.c \
-  stpncpy_chk.c \
-  strcat_chk.c \
-  strcpy_chk.c \
-  strncat_chk.c \
-  strncpy_chk.c
-
-STDIO_SOURCES = \
-  gets_chk.c \
-  snprintf_chk.c \
-  sprintf_chk.c \
-  vsnprintf_chk.c \
-  vsprintf_chk.c
-
-## None of these functions are specified by EL/IX
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_3
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_4
-ELIX_SOURCES =
-else
-if HAVE_STDIO_DIR
-ELIX_SOURCES = $(GENERAL_SOURCES) $(STRING_SOURCES) $(STDIO_SOURCES)
-else
-ELIX_SOURCES = $(GENERAL_SOURCES) $(STRING_SOURCES)
-endif
-endif
-endif
-endif
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/ssp/Makefile.inc b/newlib/libc/ssp/Makefile.inc
index e87115b50025..f1dc912db485 100644
--- a/newlib/libc/ssp/Makefile.inc
+++ b/newlib/libc/ssp/Makefile.inc
@@ -1,3 +1,46 @@
+## General sources.
+%C%_ELIX_SOURCES = \
+  %D%/chk_fail.c \
+  %D%/stack_protector.c
+
+## String sources.
+%C%_ELIX_SOURCES += \
+  %D%/memcpy_chk.c \
+  %D%/memmove_chk.c \
+  %D%/mempcpy_chk.c \
+  %D%/memset_chk.c \
+  %D%/stpcpy_chk.c \
+  %D%/stpncpy_chk.c \
+  %D%/strcat_chk.c \
+  %D%/strcpy_chk.c \
+  %D%/strncat_chk.c \
+  %D%/strncpy_chk.c
+
+## Stdio sources.
+if HAVE_STDIO_DIR
+%C%_ELIX_SOURCES += \
+  %D%/gets_chk.c \
+  %D%/snprintf_chk.c \
+  %D%/sprintf_chk.c \
+  %D%/vsnprintf_chk.c \
+  %D%/vsprintf_chk.c
+endif
+
+## None of these functions are specified by EL/IX
+if ELIX_LEVEL_1
+else
+if ELIX_LEVEL_2
+else
+if ELIX_LEVEL_3
+else
+if ELIX_LEVEL_4
+else
+libc_a_SOURCES += $(%C%_ELIX_SOURCES)
+endif
+endif
+endif
+endif
+
 LIBC_CHEWOUT_FILES +=
 
 LIBC_CHAPTERS += %D%/ssp.tex
diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am
deleted file mode 100644
index 6009aa7288ff..000000000000
--- a/newlib/libc/stdio/Makefile.am
+++ /dev/null
@@ -1,228 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-if NEWLIB_NANO_FORMATTED_IO
-GENERAL_INT_FORMATTED_IO_SOURCES =
-else
-GENERAL_INT_FORMATTED_IO_SOURCES = \
-	%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 = \
-	%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
-ELIX_2_SOURCES =
-else
-if NEWLIB_NANO_FORMATTED_IO
-ELIX_2_INT_FORMATTED_IO_SOURCES =
-else
-ELIX_2_INT_FORMATTED_IO_SOURCES = \
-	%D%/asiprintf.c		\
-	%D%/vasiprintf.c
-
-endif !NEWLIB_NANO_FORMATTED_IO
-ELIX_2_SOURCES = \
-	%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
-if ELIX_LEVEL_1
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_3
-ELIX_4_SOURCES =
-else
-if NEWLIB_NANO_FORMATTED_IO
-ELIX_4_INT_FORMATTED_IO_SOURCES =
-else
-ELIX_4_INT_FORMATTED_IO_SOURCES = \
-	%D%/asniprintf.c		\
-	%D%/diprintf.c		\
-	%D%/vasniprintf.c
-
-endif !NEWLIB_NANO_FORMATTED_IO
-ELIX_4_SOURCES = \
-	%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
-endif !ELIX_LEVEL_1
-
-if NEWLIB_NANO_FORMATTED_IO
-GENERAL_SOURCES += \
-	%D%/nano-vfprintf_float.c \
-	%D%/nano-svfprintf.c \
-	%D%/nano-svfscanf.c \
-	%D%/nano-vfprintf.c \
-	%D%/nano-vfprintf_i.c \
-	%D%/nano-vfscanf.c \
-	%D%/nano-vfscanf_i.c \
-	%D%/nano-vfscanf_float.c
-else
-GENERAL_SOURCES += \
-	%D%/svfiprintf.c \
-	%D%/svfprintf.c \
-	%D%/svfiscanf.c \
-	%D%/svfscanf.c \
-	%D%/vfiprintf.c \
-	%D%/vfscanf.c \
-	%D%/vfiscanf.c
-endif
-GENERAL_SOURCES += \
-	%D%/svfiwprintf.c \
-	%D%/svfwprintf.c \
-	%D%/vfiwprintf.c \
-	%D%/svfiwscanf.c \
-	%D%/svfwscanf.c \
-	%D%/vfiwscanf.c \
-	%D%/vfwscanf.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
-lib_a_LIBADD = $(LIBADD_OBJS)
-lib_a_CFLAGS = $(AM_CFLAGS)
-lib_a_DEPENDENCIES = $(LIBADD_OBJS)
-LIB_COMPILE = $(AM_V_CC)$(COMPILE)
diff --git a/newlib/libc/stdio/Makefile.inc b/newlib/libc/stdio/Makefile.inc
index 2e1b8c416ddf..f240803ba724 100644
--- a/newlib/libc/stdio/Makefile.inc
+++ b/newlib/libc/stdio/Makefile.inc
@@ -1,3 +1,208 @@
+if HAVE_STDIO_DIR
+
+if NEWLIB_NANO_FORMATTED_IO
+libc_a_SOURCES += \
+	%D%/nano-vfprintf_float.c \
+	%D%/nano-svfprintf.c \
+	%D%/nano-svfscanf.c \
+	%D%/nano-vfprintf.c \
+	%D%/nano-vfprintf_i.c \
+	%D%/nano-vfscanf.c \
+	%D%/nano-vfscanf_i.c \
+	%D%/nano-vfscanf_float.c
+else
+libc_a_SOURCES += \
+	%D%/fiprintf.c \
+	%D%/fiscanf.c \
+	%D%/iprintf.c \
+	%D%/iscanf.c \
+	%D%/siprintf.c \
+	%D%/siscanf.c \
+	%D%/sniprintf.c \
+	%D%/svfiprintf.c \
+	%D%/svfiscanf.c \
+	%D%/svfprintf.c \
+	%D%/svfscanf.c \
+	%D%/vdiprintf.c \
+	%D%/vfprintf.c \
+	%D%/vfiprintf.c \
+	%D%/vfiscanf.c
+	%D%/vfscanf.c \
+	%D%/vfwprintf.c \
+	%D%/viprintf.c \
+	%D%/viscanf.c \
+	%D%/vsiprintf.c \
+	%D%/vsiscanf.c \
+	%D%/vsniprintf.c
+endif
+
+libc_a_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%/svfiwprintf.c \
+	%D%/svfiwscanf.c \
+	%D%/svfwprintf.c \
+	%D%/svfwscanf.c \
+	%D%/tmpfile.c \
+	%D%/tmpnam.c \
+	%D%/ungetc.c \
+	%D%/vdprintf.c \
+	%D%/vfiwprintf.c \
+	%D%/vfiwscanf.c \
+	%D%/vfwscanf.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
+%C%_ELIX_2_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
+if !NEWLIB_NANO_FORMATTED_IO
+%C%_ELIX_2_SOURCES += \
+	%D%/asiprintf.c \
+	%D%/vasiprintf.c
+endif !NEWLIB_NANO_FORMATTED_IO
+endif !ELIX_LEVEL_1
+
+## The following are EL/IX level 2 interfaces
+if ELIX_LEVEL_1
+%C%_ELIX_4_SOURCES =
+else
+if ELIX_LEVEL_2
+%C%_ELIX_4_SOURCES =
+else
+if ELIX_LEVEL_3
+%C%_ELIX_4_SOURCES =
+else
+%C%_ELIX_4_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
+if !NEWLIB_NANO_FORMATTED_IO
+%C%_ELIX_4_SOURCES += \
+	%D%/asniprintf.c \
+	%D%/diprintf.c \
+	%D%/vasniprintf.c
+endif !NEWLIB_NANO_FORMATTED_IO
+endif !ELIX_LEVEL_3
+endif !ELIX_LEVEL_2
+endif !ELIX_LEVEL_1
+
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES) $(%C%_ELIX_4_SOURCES)
+
+endif
+
 LIBC_CHEWOUT_FILES += \
 	%D%/clearerr.def \
 	%D%/diprintf.def \
diff --git a/newlib/libc/stdio64/Makefile.am b/newlib/libc/stdio64/Makefile.am
deleted file mode 100644
index 61104d6c39b8..000000000000
--- a/newlib/libc/stdio64/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-# need a dummy object so objectlist.awk.in will build every time
-GENERAL_SOURCES = dummy.c local64.h
-
-## All interfaces are EL/IX level 2
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-ELIX_SOURCES = \
-	fdopen64.c 	\
-	fgetpos64.c	\
-	fopen64.c 	\
-	freopen64.c 	\
-	fseeko64.c 	\
-	fsetpos64.c 	\
-	ftello64.c	\
-	stdio64.c	\
-	tmpfile64.c
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
-LIB_COMPILE = $(AM_V_CC)$(COMPILE)
-
-AM_CFLAGS = -I $(srcdir)/../stdio
diff --git a/newlib/libc/stdio64/Makefile.inc b/newlib/libc/stdio64/Makefile.inc
index bfe252766f81..02f650ec2c79 100644
--- a/newlib/libc/stdio64/Makefile.inc
+++ b/newlib/libc/stdio64/Makefile.inc
@@ -1,3 +1,25 @@
+if HAVE_STDIO64_DIR
+
+libc_a_SOURCES += local64.h
+
+## All interfaces are EL/IX level 2
+if !ELIX_LEVEL_1
+libc_a_SOURCES += \
+	fdopen64.c \
+	fgetpos64.c \
+	fopen64.c \
+	freopen64.c \
+	fseeko64.c \
+	fsetpos64.c \
+	ftello64.c \
+	stdio64.c \
+	tmpfile64.c
+endif
+
+libc_a_SOURCES_%C% = -I%D%/../stdio
+
+endif
+
 LIBC_CHEWOUT_FILES += \
 	%D%/fdopen64.def \
 	%D%/fgetpos64.def \
diff --git a/newlib/libc/stdio64/dummy.c b/newlib/libc/stdio64/dummy.c
deleted file mode 100644
index 90d0120ed455..000000000000
--- a/newlib/libc/stdio64/dummy.c
+++ /dev/null
@@ -1 +0,0 @@
-/* empty stub so there's at least one file to put in objectlist.awk.in */
diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am
deleted file mode 100644
index b06b66014b79..000000000000
--- a/newlib/libc/stdlib/Makefile.am
+++ /dev/null
@@ -1,175 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-	__adjust.c 	\
-	__atexit.c	\
-	__call_atexit.c	\
-	__exp10.c 	\
-	__ten_mu.c 	\
-	_Exit.c		\
-	abort.c  	\
-	abs.c 		\
-	aligned_alloc.c	\
-	assert.c  	\
-	atexit.c	\
-	atof.c 		\
-	atoff.c		\
-	atoi.c  	\
-	atol.c		\
-	calloc.c	\
-	callocr.c	\
-	cfreer.c	\
-	div.c  		\
-	dtoa.c 		\
-	dtoastub.c 	\
-	environ.c	\
-	envlock.c	\
-	eprintf.c	\
-	exit.c 		\
-	freer.c		\
-	gdtoa-gethex.c	\
-	gdtoa-hexnan.c	\
-	getenv.c  	\
-	getenv_r.c	\
-	imaxabs.c	\
-	imaxdiv.c	\
-	itoa.c          \
-	labs.c 		\
-	ldiv.c  	\
-	ldtoa.c		\
-	gdtoa-ldtoa.c	\
-	gdtoa-gdtoa.c	\
-	gdtoa-dmisc.c	\
-	gdtoa-gmisc.c	\
-	mallinfor.c	\
-	malloc.c  	\
-	mallocr.c	\
-	mallstatsr.c	\
-	mblen.c		\
-	mblen_r.c	\
-	mbstowcs.c	\
-	mbstowcs_r.c	\
-	mbtowc.c	\
-	mbtowc_r.c	\
-	mlock.c		\
-	mprec.c		\
-	msizer.c	\
-	mstats.c	\
-	on_exit_args.c	\
-	quick_exit.c	\
-	rand.c		\
-	rand_r.c	\
-	random.c	\
-	realloc.c	\
-	reallocarray.c	\
-	reallocf.c	\
-	reallocr.c	\
-	sb_charsets.c	\
-	strtod.c	\
-	strtoimax.c	\
-	strtol.c	\
-	strtoul.c	\
-	strtoumax.c	\
-	utoa.c          \
-	wcstod.c	\
-	wcstoimax.c	\
-	wcstol.c	\
-	wcstoul.c	\
-	wcstoumax.c	\
-	wcstombs.c	\
-	wcstombs_r.c	\
-	wctomb.c	\
-	wctomb_r.c
-
-if HAVE_LONG_DOUBLE
-GENERAL_SOURCES += \
-	strtodg.c	\
-	strtold.c	\
-	strtorx.c	\
-	wcstold.c
-endif # HAVE_LONG_DOUBLE
-
-EXTENDED_SOURCES = \
-	arc4random.c	\
-	arc4random_uniform.c \
-	cxa_atexit.c	\
-	cxa_finalize.c	\
-	drand48.c	\
-	ecvtbuf.c	\
-	efgcvt.c	\
-	erand48.c	\
-	jrand48.c	\
-	lcong48.c	\
-	lrand48.c	\
-	mrand48.c	\
-	msize.c		\
-	mtrim.c		\
-	nrand48.c	\
-	rand48.c	\
-	seed48.c	\
-	srand48.c	\
-	strtoll.c	\
-	strtoll_r.c	\
-	strtoull.c	\
-	strtoull_r.c	\
-	wcstoll.c	\
-	wcstoll_r.c	\
-	wcstoull.c	\
-	wcstoull_r.c	\
-	atoll.c		\
-	llabs.c		\
-	lldiv.c
-
-ELIX_2_SOURCES = \
-	a64l.c		\
-	btowc.c		\
-	getopt.c	\
-	getsubopt.c	\
-	l64a.c		\
-	malign.c	\
-	malignr.c	\
-	malloptr.c	\
-	mbrlen.c	\
-	mbrtowc.c	\
-	mbsinit.c	\
-	mbsnrtowcs.c	\
-	mbsrtowcs.c	\
-	on_exit.c	\
-	pvallocr.c	\
-	valloc.c	\
-	vallocr.c	\
-	wcrtomb.c	\
-	wcsnrtombs.c	\
-	wcsrtombs.c	\
-	wctob.c
-
-ELIX_3_SOURCES = \
-	putenv.c	\
-	putenv_r.c	\
-	setenv.c	\
-	setenv_r.c
-
-ELIX_4_SOURCES = \
-	rpmatch.c	\
-	system.c
-
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_SOURCES = $(ELIX_2_SOURCES)
-else
-if ELIX_LEVEL_3
-ELIX_SOURCES = $(ELIX_2_SOURCES) $(ELIX_3_SOURCES)
-else
-ELIX_SOURCES = $(ELIX_2_SOURCES) $(ELIX_3_SOURCES) $(ELIX_4_SOURCES)
-endif
-endif
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(EXTENDED_SOURCES) $(ELIX_SOURCES)
-lib_a_LIBADD =
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/stdlib/Makefile.inc b/newlib/libc/stdlib/Makefile.inc
index d2f199d8cab3..9812add766cf 100644
--- a/newlib/libc/stdlib/Makefile.inc
+++ b/newlib/libc/stdlib/Makefile.inc
@@ -1,3 +1,199 @@
+libc_a_SOURCES += \
+	%D%/__adjust.c \
+	%D%/__atexit.c \
+	%D%/__call_atexit.c \
+	%D%/__exp10.c \
+	%D%/__ten_mu.c \
+	%D%/_Exit.c \
+	%D%/abort.c \
+	%D%/abs.c \
+	%D%/aligned_alloc.c \
+	%D%/assert.c \
+	%D%/atexit.c \
+	%D%/atof.c \
+	%D%/atoff.c \
+	%D%/atoi.c \
+	%D%/atol.c \
+	%D%/calloc.c \
+	%D%/callocr.c \
+	%D%/cfreer.c \
+	%D%/div.c \
+	%D%/dtoa.c \
+	%D%/dtoastub.c \
+	%D%/environ.c \
+	%D%/envlock.c \
+	%D%/eprintf.c \
+	%D%/exit.c \
+	%D%/freer.c \
+	%D%/gdtoa-gethex.c \
+	%D%/gdtoa-hexnan.c \
+	%D%/getenv.c \
+	%D%/getenv_r.c \
+	%D%/imaxabs.c \
+	%D%/imaxdiv.c \
+	%D%/itoa.c \
+	%D%/labs.c \
+	%D%/ldiv.c \
+	%D%/ldtoa.c \
+	%D%/gdtoa-ldtoa.c \
+	%D%/gdtoa-gdtoa.c \
+	%D%/gdtoa-dmisc.c \
+	%D%/gdtoa-gmisc.c \
+	%D%/mallinfor.c \
+	%D%/malloc.c \
+	%D%/mallocr.c \
+	%D%/mallstatsr.c \
+	%D%/mblen.c \
+	%D%/mblen_r.c \
+	%D%/mbstowcs.c \
+	%D%/mbstowcs_r.c \
+	%D%/mbtowc.c \
+	%D%/mbtowc_r.c \
+	%D%/mlock.c \
+	%D%/mprec.c \
+	%D%/msizer.c \
+	%D%/mstats.c \
+	%D%/on_exit_args.c \
+	%D%/quick_exit.c \
+	%D%/rand.c \
+	%D%/rand_r.c \
+	%D%/random.c \
+	%D%/realloc.c \
+	%D%/reallocarray.c \
+	%D%/reallocf.c \
+	%D%/reallocr.c \
+	%D%/sb_charsets.c \
+	%D%/strtod.c \
+	%D%/strtoimax.c \
+	%D%/strtol.c \
+	%D%/strtoul.c \
+	%D%/strtoumax.c \
+	%D%/utoa.c \
+	%D%/wcstod.c \
+	%D%/wcstoimax.c \
+	%D%/wcstol.c \
+	%D%/wcstoul.c \
+	%D%/wcstoumax.c \
+	%D%/wcstombs.c \
+	%D%/wcstombs_r.c \
+	%D%/wctomb.c \
+	%D%/wctomb_r.c
+
+if HAVE_LONG_DOUBLE
+libc_a_SOURCES += \
+	%D%/strtodg.c \
+	%D%/strtold.c \
+	%D%/strtorx.c \
+	%D%/wcstold.c
+endif # HAVE_LONG_DOUBLE
+
+if NEWLIB_NANO_MALLOC
+MALIGNR = nano-malignr
+MALLOPTR = nano-malloptr
+PVALLOCR = nano-pvallocr
+VALLOCR = nano-vallocr
+FREER = nano-freer
+REALLOCR = nano-reallocr
+CALLOCR = nano-callocr
+CFREER = nano-cfreer
+MALLINFOR = nano-mallinfor
+MALLSTATSR = nano-mallstatsr
+MSIZER = nano-msizer
+MALLOCR = nano-mallocr
+else
+MALIGNR = malignr
+MALLOPTR = malloptr
+PVALLOCR = pvallocr
+VALLOCR = vallocr
+FREER = freer
+REALLOCR = reallocr
+CALLOCR = callocr
+CFREER = cfreer
+MALLINFOR = mallinfor
+MALLSTATSR = mallstatsr
+MSIZER = msizer
+MALLOCR = mallocr
+endif
+
+libc_a_SOURCES += \
+	%D%/arc4random.c \
+	%D%/arc4random_uniform.c \
+	%D%/cxa_atexit.c \
+	%D%/cxa_finalize.c \
+	%D%/drand48.c \
+	%D%/ecvtbuf.c \
+	%D%/efgcvt.c \
+	%D%/erand48.c \
+	%D%/jrand48.c \
+	%D%/lcong48.c \
+	%D%/lrand48.c \
+	%D%/mrand48.c \
+	%D%/msize.c \
+	%D%/mtrim.c \
+	%D%/nrand48.c \
+	%D%/rand48.c \
+	%D%/seed48.c \
+	%D%/srand48.c \
+	%D%/strtoll.c \
+	%D%/strtoll_r.c \
+	%D%/strtoull.c \
+	%D%/strtoull_r.c \
+	%D%/wcstoll.c \
+	%D%/wcstoll_r.c \
+	%D%/wcstoull.c \
+	%D%/wcstoull_r.c \
+	%D%/atoll.c \
+	%D%/llabs.c \
+	%D%/lldiv.c
+
+%C%_ELIX_2_SOURCES = \
+	%D%/a64l.c \
+	%D%/btowc.c \
+	%D%/getopt.c \
+	%D%/getsubopt.c \
+	%D%/l64a.c \
+	%D%/malign.c \
+	%D%/malignr.c \
+	%D%/malloptr.c \
+	%D%/mbrlen.c \
+	%D%/mbrtowc.c \
+	%D%/mbsinit.c \
+	%D%/mbsnrtowcs.c \
+	%D%/mbsrtowcs.c \
+	%D%/on_exit.c \
+	%D%/pvallocr.c \
+	%D%/valloc.c \
+	%D%/vallocr.c \
+	%D%/wcrtomb.c \
+	%D%/wcsnrtombs.c \
+	%D%/wcsrtombs.c \
+	%D%/wctob.c
+
+%C%_ELIX_3_SOURCES = \
+	%D%/putenv.c \
+	%D%/putenv_r.c \
+	%D%/setenv.c \
+	%D%/setenv_r.c
+
+%C%_ELIX_4_SOURCES = \
+	%D%/rpmatch.c \
+	%D%/system.c
+
+if ELIX_LEVEL_1
+%C%_ELIX_SOURCES =
+else
+if ELIX_LEVEL_2
+%C%_ELIX_SOURCES = $(%C%_ELIX_2_SOURCES)
+else
+if ELIX_LEVEL_3
+%C%_ELIX_SOURCES = $(%C%_ELIX_2_SOURCES) $(%C%_ELIX_3_SOURCES)
+else
+%C%_ELIX_SOURCES = $(%C%_ELIX_2_SOURCES) $(%C%_ELIX_3_SOURCES) $(%C%_ELIX_4_SOURCES)
+endif
+endif
+endif
+libc_a_SOURCES += $(%C%_ELIX_SOURCES)
+
 LIBC_CHEWOUT_FILES += \
 	%D%/_Exit.def \
 	%D%/a64l.def \
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
deleted file mode 100644
index 05ddf751f478..000000000000
--- a/newlib/libc/string/Makefile.am
+++ /dev/null
@@ -1,134 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-	bcopy.c \
-	bzero.c \
-	explicit_bzero.c \
-	ffsl.c \
-	ffsll.c \
-	fls.c \
-	flsl.c \
-	flsll.c \
-	index.c \
-	memchr.c \
-	memcmp.c \
-	memcpy.c \
-	memmove.c \
-	memset.c \
-	rindex.c \
-	strcasecmp.c \
-	strcat.c \
-	strchr.c \
-	strcmp.c \
-	strcoll.c \
-	strcpy.c \
-	strcspn.c \
-	strdup.c \
-	strdup_r.c \
-	strerror.c \
-	strerror_r.c \
-	strlcat.c \
-	strlcpy.c \
-	strlen.c  \
-	strlwr.c \
-	strncasecmp.c \
-	strncat.c \
-	strncmp.c \
-	strncpy.c \
-	strnlen.c \
-	strnstr.c \
-	strpbrk.c \
-	strrchr.c \
-	strsep.c \
-	strsignal.c \
-	strspn.c \
-	strtok.c \
-	strtok_r.c \
-	strupr.c \
-	strxfrm.c  \
-	strstr.c \
-	swab.c \
-	timingsafe_bcmp.c \
-	timingsafe_memcmp.c \
-	u_strerr.c \
-	wcscat.c \
-	wcschr.c \
-	wcscmp.c \
-	wcscoll.c \
-	wcscpy.c \
-	wcscspn.c \
-	wcslcat.c \
-	wcslcpy.c \
-	wcslen.c \
-	wcsncat.c \
-	wcsncmp.c \
-	wcsncpy.c \
-	wcsnlen.c \
-	wcspbrk.c \
-	wcsrchr.c \
-	wcsspn.c \
-	wcsstr.c \
-	wcstok.c \
-	wcswidth.c \
-	wcsxfrm.c \
-	wcwidth.c \
-	wmemchr.c \
-	wmemcmp.c \
-	wmemcpy.c \
-	wmemmove.c \
-	wmemset.c \
-	xpg_strerror_r.c
-
-if ELIX_LEVEL_1
-ELIX_2_SOURCES =
-else
-ELIX_2_SOURCES = \
-	bcmp.c \
-	memccpy.c \
-	mempcpy.c \
-	stpcpy.c \
-	stpncpy.c \
-	strndup.c \
-	strcasestr.c \
-	strchrnul.c \
-	strndup_r.c \
-	wcpcpy.c \
-	wcpncpy.c \
-	wcsdup.c
-endif !ELIX_LEVEL_1
-
-if ELIX_LEVEL_1
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_3
-ELIX_4_SOURCES =
-else
-ELIX_4_SOURCES = \
-	gnu_basename.c \
-	memmem.c \
-	memrchr.c \
-	rawmemchr.c \
-	strcasecmp_l.c \
-	strcoll_l.c \
-	strncasecmp_l.c \
-	strverscmp.c \
-	strxfrm_l.c \
-	wcscasecmp.c \
-	wcscasecmp_l.c \
-	wcscoll_l.c \
-	wcsncasecmp.c \
-	wcsncasecmp_l.c \
-	wcsxfrm_l.c \
-	wmempcpy.c
-endif !ELIX_LEVEL_3
-endif !ELIX_LEVEL_2
-endif !ELIX_LEVEL_1
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/string/Makefile.inc b/newlib/libc/string/Makefile.inc
index 5bcec8dd4ca6..a198aef00d07 100644
--- a/newlib/libc/string/Makefile.inc
+++ b/newlib/libc/string/Makefile.inc
@@ -1,3 +1,130 @@
+libc_a_SOURCES += \
+	%D%/bcopy.c \
+	%D%/bzero.c \
+	%D%/explicit_bzero.c \
+	%D%/ffsl.c \
+	%D%/ffsll.c \
+	%D%/fls.c \
+	%D%/flsl.c \
+	%D%/flsll.c \
+	%D%/index.c \
+	%D%/memchr.c \
+	%D%/memcmp.c \
+	%D%/memcpy.c \
+	%D%/memmove.c \
+	%D%/memset.c \
+	%D%/rindex.c \
+	%D%/strcasecmp.c \
+	%D%/strcat.c \
+	%D%/strchr.c \
+	%D%/strcmp.c \
+	%D%/strcoll.c \
+	%D%/strcpy.c \
+	%D%/strcspn.c \
+	%D%/strdup.c \
+	%D%/strdup_r.c \
+	%D%/strerror.c \
+	%D%/strerror_r.c \
+	%D%/strlcat.c \
+	%D%/strlcpy.c \
+	%D%/strlen.c  \
+	%D%/strlwr.c \
+	%D%/strncasecmp.c \
+	%D%/strncat.c \
+	%D%/strncmp.c \
+	%D%/strncpy.c \
+	%D%/strnlen.c \
+	%D%/strnstr.c \
+	%D%/strpbrk.c \
+	%D%/strrchr.c \
+	%D%/strsep.c \
+	%D%/strsignal.c \
+	%D%/strspn.c \
+	%D%/strtok.c \
+	%D%/strtok_r.c \
+	%D%/strupr.c \
+	%D%/strxfrm.c  \
+	%D%/strstr.c \
+	%D%/swab.c \
+	%D%/timingsafe_bcmp.c \
+	%D%/timingsafe_memcmp.c \
+	%D%/u_strerr.c \
+	%D%/wcscat.c \
+	%D%/wcschr.c \
+	%D%/wcscmp.c \
+	%D%/wcscoll.c \
+	%D%/wcscpy.c \
+	%D%/wcscspn.c \
+	%D%/wcslcat.c \
+	%D%/wcslcpy.c \
+	%D%/wcslen.c \
+	%D%/wcsncat.c \
+	%D%/wcsncmp.c \
+	%D%/wcsncpy.c \
+	%D%/wcsnlen.c \
+	%D%/wcspbrk.c \
+	%D%/wcsrchr.c \
+	%D%/wcsspn.c \
+	%D%/wcsstr.c \
+	%D%/wcstok.c \
+	%D%/wcswidth.c \
+	%D%/wcsxfrm.c \
+	%D%/wcwidth.c \
+	%D%/wmemchr.c \
+	%D%/wmemcmp.c \
+	%D%/wmemcpy.c \
+	%D%/wmemmove.c \
+	%D%/wmemset.c \
+	%D%/xpg_strerror_r.c
+
+%C%_ELIX_2_SOURCES =
+if ELIX_LEVEL_1
+else
+%C%_ELIX_2_SOURCES += \
+	%D%/bcmp.c \
+	%D%/memccpy.c \
+	%D%/mempcpy.c \
+	%D%/stpcpy.c \
+	%D%/stpncpy.c \
+	%D%/strndup.c \
+	%D%/strcasestr.c \
+	%D%/strchrnul.c \
+	%D%/strndup_r.c \
+	%D%/wcpcpy.c \
+	%D%/wcpncpy.c \
+	%D%/wcsdup.c
+endif !ELIX_LEVEL_1
+
+%C%_ELIX_4_SOURCES =
+if ELIX_LEVEL_1
+else
+if ELIX_LEVEL_2
+else
+if ELIX_LEVEL_3
+else
+%C%_ELIX_4_SOURCES += \
+	%D%/gnu_basename.c \
+	%D%/memmem.c \
+	%D%/memrchr.c \
+	%D%/rawmemchr.c \
+	%D%/strcasecmp_l.c \
+	%D%/strcoll_l.c \
+	%D%/strncasecmp_l.c \
+	%D%/strverscmp.c \
+	%D%/strxfrm_l.c \
+	%D%/wcscasecmp.c \
+	%D%/wcscasecmp_l.c \
+	%D%/wcscoll_l.c \
+	%D%/wcsncasecmp.c \
+	%D%/wcsncasecmp_l.c \
+	%D%/wcsxfrm_l.c \
+	%D%/wmempcpy.c
+endif !ELIX_LEVEL_3
+endif !ELIX_LEVEL_2
+endif !ELIX_LEVEL_1
+
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES) $(%C%_ELIX_4_SOURCES)
+
 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 \
diff --git a/newlib/libc/sys/Makefile.inc b/newlib/libc/sys/Makefile.inc
index e69de29bb2d1..69a59d4ef8a6 100644
--- a/newlib/libc/sys/Makefile.inc
+++ b/newlib/libc/sys/Makefile.inc
@@ -0,0 +1,72 @@
+if HAVE_LIBC_SYS_A29KHIF_DIR
+include %D%/a29khif/Makefile.inc
+endif
+if HAVE_LIBC_SYS_AMDGCN_DIR
+include %D%/amdgcn/Makefile.inc
+endif
+if HAVE_LIBC_SYS_ARM_DIR
+include %D%/arm/Makefile.inc
+endif
+if HAVE_LIBC_SYS_D10V_DIR
+include %D%/d10v/Makefile.inc
+endif
+if HAVE_LIBC_SYS_EPIPHANY_DIR
+include %D%/epiphany/Makefile.inc
+endif
+if HAVE_LIBC_SYS_H8300HMS_DIR
+include %D%/h8300hms/Makefile.inc
+endif
+if HAVE_LIBC_SYS_H8500HMS_DIR
+include %D%/h8500hms/Makefile.inc
+endif
+if HAVE_LIBC_SYS_M88KBUG_DIR
+include %D%/m88kbug/Makefile.inc
+endif
+if HAVE_LIBC_SYS_MMIXWARE_DIR
+include %D%/mmixware/Makefile.inc
+endif
+if HAVE_LIBC_SYS_NETWARE_DIR
+include %D%/netware/Makefile.inc
+endif
+if HAVE_LIBC_SYS_OR1K_DIR
+include %D%/or1k/Makefile.inc
+endif
+if HAVE_LIBC_SYS_PHOENIX_DIR
+include %D%/phoenix/Makefile.inc
+endif
+if HAVE_LIBC_SYS_RDOS_DIR
+include %D%/rdos/Makefile.inc
+endif
+if HAVE_LIBC_SYS_RTEMS_DIR
+include %D%/rtems/Makefile.inc
+endif
+if HAVE_LIBC_SYS_SH_DIR
+include %D%/sh/Makefile.inc
+endif
+if HAVE_LIBC_SYS_SYSMEC_DIR
+include %D%/sysmec/Makefile.inc
+endif
+if HAVE_LIBC_SYS_SYSNEC810_DIR
+include %D%/sysnec810/Makefile.inc
+endif
+if HAVE_LIBC_SYS_SYSNECV850_DIR
+include %D%/sysnecv850/Makefile.inc
+endif
+if HAVE_LIBC_SYS_SYSVI386_DIR
+include %D%/sysvi386/Makefile.inc
+endif
+if HAVE_LIBC_SYS_SYSVNECV70_DIR
+include %D%/sysvnecv70/Makefile.inc
+endif
+if HAVE_LIBC_SYS_TIC80_DIR
+include %D%/tic80/Makefile.inc
+endif
+if HAVE_LIBC_SYS_TIRTOS_DIR
+include %D%/tirtos/Makefile.inc
+endif
+if HAVE_LIBC_SYS_W65_DIR
+include %D%/w65/Makefile.inc
+endif
+if HAVE_LIBC_SYS_Z8KSIM_DIR
+include %D%/z8ksim/Makefile.inc
+endif
diff --git a/newlib/libc/sys/a29khif/Makefile.am b/newlib/libc/sys/a29khif/Makefile.am
deleted file mode 100644
index 174934d59f31..000000000000
--- a/newlib/libc/sys/a29khif/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = \
-	_alloc.S	\
-	_close.S	\
-	_cycles.S	\
-	_exit.S		\
-	_getpsiz.S	\
-	_gettz.S	\
-	_ioctl.S	\
-	_iostat.S	\
-	_iowait.S	\
-	_lseek.S	\
-	_open.S		\
-	_query.S	\
-	_read.S		\
-	_setim.S	\
-	_settrap.S	\
-	_setvec.S	\
-	_tmpnam.S	\
-	_write.S	\
-	alloc.S		\
-	clock.S		\
-	getargs.S	\
-	getenv.S	\
-	read.S		\
-	remove.S	\
-	rename.S	\
-	signal.S	\
-	_sbrk.S 	\
-	_fstat.S 	\
-	_isatty.S 	\
-	systime.S	\
-	vec.S		\
-	kill.c		\
-	getpid.c	\
-	stubs.S
-
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/a29khif/Makefile.inc b/newlib/libc/sys/a29khif/Makefile.inc
new file mode 100644
index 000000000000..4be62d1aa51b
--- /dev/null
+++ b/newlib/libc/sys/a29khif/Makefile.inc
@@ -0,0 +1,35 @@
+libc_a_SOURCES += \
+	%D%/_alloc.S \
+	%D%/_close.S \
+	%D%/_cycles.S \
+	%D%/_exit.S \
+	%D%/_getpsiz.S \
+	%D%/_gettz.S \
+	%D%/_ioctl.S \
+	%D%/_iostat.S \
+	%D%/_iowait.S \
+	%D%/_lseek.S \
+	%D%/_open.S \
+	%D%/_query.S \
+	%D%/_read.S \
+	%D%/_setim.S \
+	%D%/_settrap.S \
+	%D%/_setvec.S \
+	%D%/_tmpnam.S \
+	%D%/_write.S \
+	%D%/alloc.S \
+	%D%/clock.S \
+	%D%/getargs.S \
+	%D%/getenv.S \
+	%D%/read.S \
+	%D%/remove.S \
+	%D%/rename.S \
+	%D%/signal.S \
+	%D%/_sbrk.S  \
+	%D%/_fstat.S  \
+	%D%/_isatty.S  \
+	%D%/systime.S \
+	%D%/vec.S \
+	%D%/kill.c \
+	%D%/getpid.c \
+	%D%/stubs.S
diff --git a/newlib/libc/sys/amdgcn/Makefile.am b/newlib/libc/sys/amdgcn/Makefile.am
deleted file mode 100644
index 61eb3dd673ef..000000000000
--- a/newlib/libc/sys/amdgcn/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS) $(CFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = close.c fstat.c isatty.c lseek.c read.c write.c \
-                fcntl.c getpid.c kill.c open.c raise.c stat.c unlink.c
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/sys/amdgcn/Makefile.inc b/newlib/libc/sys/amdgcn/Makefile.inc
new file mode 100644
index 000000000000..c1570b2ad804
--- /dev/null
+++ b/newlib/libc/sys/amdgcn/Makefile.inc
@@ -0,0 +1,3 @@
+libc_a_SOURCES += \
+	%D%/close.c %D%/fstat.c %D%/isatty.c %D%/lseek.c %D%/read.c %D%/write.c \
+	%D%/fcntl.c %D%/getpid.c %D%/kill.c %D%/open.c %D%/raise.c %D%/stat.c %D%/unlink.c
diff --git a/newlib/libc/sys/arm/Makefile.am b/newlib/libc/sys/arm/Makefile.am
deleted file mode 100644
index 719b39e29b6b..000000000000
--- a/newlib/libc/sys/arm/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) -I$(abs_newlib_basedir)/libc/machine/arm
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = access.c aeabi_atexit.c
-if MAY_SUPPLY_SYSCALLS
-lib_a_SOURCES += libcfunc.c trap.S syscalls.c
-endif
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-if MAY_SUPPLY_SYSCALLS
-all-local: crt0.o
-endif
diff --git a/newlib/libc/sys/arm/Makefile.inc b/newlib/libc/sys/arm/Makefile.inc
new file mode 100644
index 000000000000..5f877919480d
--- /dev/null
+++ b/newlib/libc/sys/arm/Makefile.inc
@@ -0,0 +1,6 @@
+libc_a_CPPFLAGS_%C% = -I$(srcdir)/libc/machine/arm
+
+libc_a_SOURCES += %D%/access.c %D%/aeabi_atexit.c
+if MAY_SUPPLY_SYSCALLS
+libc_a_SOURCES += %D%/libcfunc.c %D%/trap.S %D%/syscalls.c
+endif
diff --git a/newlib/libc/sys/d10v/Makefile.am b/newlib/libc/sys/d10v/Makefile.am
deleted file mode 100644
index f8a9ca1af170..000000000000
--- a/newlib/libc/sys/d10v/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = syscalls.c trap.S creat.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/d10v/Makefile.inc b/newlib/libc/sys/d10v/Makefile.inc
new file mode 100644
index 000000000000..34196406a69c
--- /dev/null
+++ b/newlib/libc/sys/d10v/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/syscalls.c %D%/trap.S %D%/creat.c
diff --git a/newlib/libc/sys/epiphany/Makefile.am b/newlib/libc/sys/epiphany/Makefile.am
deleted file mode 100644
index a4e685f10420..000000000000
--- a/newlib/libc/sys/epiphany/Makefile.am
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (c) 2011, Adapteva, Inc.
-# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#  * Redistributions of source code must retain the above copyright notice,
-#    this list of conditions and the following disclaimer.
-#  * Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#  * Neither the name of Adapteva nor the names of its contributors may be
-#    used to endorse or promote products derived from this software without
-#    specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-# crt0.o comes from libgloss
-lib_a_SOURCES = e_printf.c
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/sys/epiphany/Makefile.inc b/newlib/libc/sys/epiphany/Makefile.inc
new file mode 100644
index 000000000000..a8d30fa134b4
--- /dev/null
+++ b/newlib/libc/sys/epiphany/Makefile.inc
@@ -0,0 +1,2 @@
+## crt0.o comes from libgloss
+libc_a_SOURCES += %D%/e_printf.c
diff --git a/newlib/libc/sys/h8300hms/Makefile.am b/newlib/libc/sys/h8300hms/Makefile.am
deleted file mode 100644
index 0e0e3bd0ed66..000000000000
--- a/newlib/libc/sys/h8300hms/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = syscalls.c _exit.S sbrk.c misc.c crt1.c \
-	close.S fstat.S lseek.S open.S read.S stat.S write.S
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/h8300hms/Makefile.inc b/newlib/libc/sys/h8300hms/Makefile.inc
new file mode 100644
index 000000000000..b3e1fa8fd09a
--- /dev/null
+++ b/newlib/libc/sys/h8300hms/Makefile.inc
@@ -0,0 +1,3 @@
+libc_a_SOURCES += \
+	%D%/syscalls.c %D%/_exit.S %D%/sbrk.c %D%/misc.c %D%/crt1.c \
+	%D%/close.S %D%/fstat.S %D%/lseek.S %D%/open.S %D%/read.S %D%/stat.S %D%/write.S
diff --git a/newlib/libc/sys/h8500hms/Makefile.am b/newlib/libc/sys/h8500hms/Makefile.am
deleted file mode 100644
index 91389b0a42db..000000000000
--- a/newlib/libc/sys/h8500hms/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = syscalls.c misc.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/h8500hms/Makefile.inc b/newlib/libc/sys/h8500hms/Makefile.inc
new file mode 100644
index 000000000000..d9e1b2a8e98c
--- /dev/null
+++ b/newlib/libc/sys/h8500hms/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/syscalls.c %D%/misc.c
diff --git a/newlib/libc/sys/m88kbug/Makefile.am b/newlib/libc/sys/m88kbug/Makefile.am
deleted file mode 100644
index 1ee90fff8648..000000000000
--- a/newlib/libc/sys/m88kbug/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = syscalls.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/m88kbug/Makefile.inc b/newlib/libc/sys/m88kbug/Makefile.inc
new file mode 100644
index 000000000000..ec439726ed2a
--- /dev/null
+++ b/newlib/libc/sys/m88kbug/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/syscalls.c
diff --git a/newlib/libc/sys/mmixware/Makefile.am b/newlib/libc/sys/mmixware/Makefile.am
deleted file mode 100644
index fcb4dce17548..000000000000
--- a/newlib/libc/sys/mmixware/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = _exit.c access.c chmod.c chown.c close.c creat.c \
-	execv.c execve.c fork.c fstat.c getpid.c isatty.c \
-	kill.c link.c lseek.c open.c pipe.c read.c \
-	sbrk.c stat.c time.c unlink.c utime.c wait.c write.c \
-	times.c gettime.c setjmp.S
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/mmixware/Makefile.inc b/newlib/libc/sys/mmixware/Makefile.inc
new file mode 100644
index 000000000000..0c494e5277a4
--- /dev/null
+++ b/newlib/libc/sys/mmixware/Makefile.inc
@@ -0,0 +1,6 @@
+libc_a_SOURCES += \
+	%D%/_exit.c %D%/access.c %D%/chmod.c %D%/chown.c %D%/close.c %D%/creat.c \
+	%D%/execv.c %D%/execve.c %D%/fork.c %D%/fstat.c %D%/getpid.c %D%/isatty.c \
+	%D%/kill.c %D%/link.c %D%/lseek.c %D%/open.c %D%/pipe.c %D%/read.c \
+	%D%/sbrk.c %D%/stat.c %D%/time.c %D%/unlink.c %D%/utime.c %D%/wait.c %D%/write.c \
+	%D%/times.c %D%/gettime.c %D%/setjmp.S
diff --git a/newlib/libc/sys/netware/Makefile.am b/newlib/libc/sys/netware/Makefile.am
deleted file mode 100644
index a4041ac87418..000000000000
--- a/newlib/libc/sys/netware/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = \
-	getpid.c \
-	link.c
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/netware/Makefile.inc b/newlib/libc/sys/netware/Makefile.inc
new file mode 100644
index 000000000000..663155ce90f6
--- /dev/null
+++ b/newlib/libc/sys/netware/Makefile.inc
@@ -0,0 +1,3 @@
+libc_a_SOURCES += \
+	%D%/getpid.c \
+	%D%/link.c
diff --git a/newlib/libc/sys/or1k/Makefile.am b/newlib/libc/sys/or1k/Makefile.am
deleted file mode 100644
index 8c005b24a1b2..000000000000
--- a/newlib/libc/sys/or1k/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = getreent.S mlock.c
-lib_a_CFLAGS=$(AM_CFLAGS)
diff --git a/newlib/libc/sys/or1k/Makefile.inc b/newlib/libc/sys/or1k/Makefile.inc
new file mode 100644
index 000000000000..f61c190ebb51
--- /dev/null
+++ b/newlib/libc/sys/or1k/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/getreent.S %D%/mlock.c
diff --git a/newlib/libc/sys/phoenix/Makefile.am b/newlib/libc/sys/phoenix/Makefile.am
deleted file mode 100644
index a2558e632eb4..000000000000
--- a/newlib/libc/sys/phoenix/Makefile.am
+++ /dev/null
@@ -1,137 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I$(srcdir)/include $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(INCLTDL)
-
-SUBDIRS = $(PHOENIX_MACHINE_DIR)
-
-PHOENIX_MACH_LIB = $(PHOENIX_MACHINE_DIR)/lib.a
-
-SUBLIBS = \
-	$(PHOENIX_MACH_LIB)
-
-SOURCES = \
-	net/domainname.c \
-	net/freeaddrinfo.c \
-	net/getaddrinfo.c \
-	net/gethostbyaddr.c \
-	net/gethostbyname.c \
-	net/getnameinfo.c \
-	net/getservbyname.c \
-	net/getservbyport.c \
-	net/herror.c \
-	net/hostname.c \
-	net/inet_addr.c \
-	net/inet_aton.c \
-	net/inet_lnaof.c \
-	net/inet_makeaddr.c \
-	net/inet_net_ntop.c \
-	net/inet_net_pton.c \
-	net/inet_netof.c \
-	net/inet_network.c \
-	net/inet_ntoa.c \
-	net/inet_ntop.c \
-	net/inet_pton.c \
-	net/nametoindex.c \
-	net/network.c \
-	alarm.c \
-	chmod.c \
-	chown.c \
-	clocks.c \
-	dup.c \
-	endmntent.c \
-	exec.c \
-	fcntl.c \
-	fork.c \
-	fs.c \
-	getentropy.c \
-	getmntent.c \
-	getpagesize.c \
-	groups.c \
-	ids.c \
-	io.c \
-	ioctl.c \
-	mmap.c \
-	mount.c \
-	nanosleep.c \
-	phoenix.c \
-	pid.c \
-	pipe.c \
-	poll.c \
-	realpath.c \
-	reboot.c \
-	resource.c \
-	sbrk.c \
-	sched.c \
-	select.c \
-	semaphore.c \
-	setmntent.c \
-	shm.c \
-	signal.c \
-	socket.c \
-	sockopt.c \
-	stat.c \
-	statfs.c \
-	symlink.c \
-	sync.c \
-	sysconf.c \
-	syslog.c \
-	time.c \
-	truncate.c \
-	tty.c \
-	uname.c \
-	utime.c \
-	wait.c
-
-ADD_OBJS =
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(SOURCES)
-lib_a_LIBADD = $(ADD_OBJS)
-lib_a_DEPENDENCIES = $(ADD_OBJS)
-lib_a_CFLAGS = $(AM_CFLAGS)
-LIBC_COMPILE = $(COMPILE)
-noinst_DATA =
-
-lib.a:  $(lib_a_OBJECTS)
-	rm -f $@
-	rm -rf tmp
-	mkdir tmp
-	cd tmp; \
-	for i in $(SUBLIBS); do \
-	  $(AR) x ../$$i; \
-	done;
-	$(AR) $(AR_FLAGS) $@ tmp/*.o  $^
-	$(RANLIB) $@
-	rm -rf tmp
-
-all-local: crt0.o
-
-crt0.o: $(PHOENIX_MACHINE_DIR)/crt0.o
-	rm -f $@
-	ln $(PHOENIX_MACHINE_DIR)/crt0.o $@ >/dev/null 2>/dev/null || cp $(PHOENIX_MACHINE_DIR)/crt0.o $@
-
-$(PHOENIX_MACHINE_DIR)/crt0.o: ; @true
-
-AM_CFLAGS = -I $(srcdir)/../../stdio
-
-install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \
-	for i in $(srcdir)/include/arpa/*.h; do \
-	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \
-	done; \
-	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/net; \
-	for i in $(srcdir)/include/net/*.h; do \
-	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/net/`basename $$i`; \
-	done; \
-	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \
-	for i in $(srcdir)/include/netinet/*.h; do \
-	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \
-	done; \
-	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet6; \
-	for i in $(srcdir)/include/netinet6/*.h; do \
-	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet6/`basename $$i`; \
-	done; \
-	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netpacket; \
-	for i in $(srcdir)/include/netpacket/*.h; do \
-	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netpacket/`basename $$i`; \
-	done;
diff --git a/newlib/libc/sys/phoenix/Makefile.inc b/newlib/libc/sys/phoenix/Makefile.inc
new file mode 100644
index 000000000000..9c9775130634
--- /dev/null
+++ b/newlib/libc/sys/phoenix/Makefile.inc
@@ -0,0 +1,105 @@
+libc_a_SOURCES += \
+	%D%/net/domainname.c \
+	%D%/net/freeaddrinfo.c \
+	%D%/net/getaddrinfo.c \
+	%D%/net/gethostbyaddr.c \
+	%D%/net/gethostbyname.c \
+	%D%/net/getnameinfo.c \
+	%D%/net/getservbyname.c \
+	%D%/net/getservbyport.c \
+	%D%/net/herror.c \
+	%D%/net/hostname.c \
+	%D%/net/inet_addr.c \
+	%D%/net/inet_aton.c \
+	%D%/net/inet_lnaof.c \
+	%D%/net/inet_makeaddr.c \
+	%D%/net/inet_net_ntop.c \
+	%D%/net/inet_net_pton.c \
+	%D%/net/inet_netof.c \
+	%D%/net/inet_network.c \
+	%D%/net/inet_ntoa.c \
+	%D%/net/inet_ntop.c \
+	%D%/net/inet_pton.c \
+	%D%/net/nametoindex.c \
+	%D%/net/network.c \
+	%D%/alarm.c \
+	%D%/chmod.c \
+	%D%/chown.c \
+	%D%/clocks.c \
+	%D%/dup.c \
+	%D%/endmntent.c \
+	%D%/exec.c \
+	%D%/fcntl.c \
+	%D%/fork.c \
+	%D%/fs.c \
+	%D%/getentropy.c \
+	%D%/getmntent.c \
+	%D%/getpagesize.c \
+	%D%/groups.c \
+	%D%/ids.c \
+	%D%/io.c \
+	%D%/ioctl.c \
+	%D%/mmap.c \
+	%D%/mount.c \
+	%D%/nanosleep.c \
+	%D%/phoenix.c \
+	%D%/pid.c \
+	%D%/pipe.c \
+	%D%/poll.c \
+	%D%/realpath.c \
+	%D%/reboot.c \
+	%D%/resource.c \
+	%D%/sbrk.c \
+	%D%/sched.c \
+	%D%/select.c \
+	%D%/semaphore.c \
+	%D%/setmntent.c \
+	%D%/shm.c \
+	%D%/signal.c \
+	%D%/socket.c \
+	%D%/sockopt.c \
+	%D%/stat.c \
+	%D%/statfs.c \
+	%D%/symlink.c \
+	%D%/sync.c \
+	%D%/sysconf.c \
+	%D%/syslog.c \
+	%D%/time.c \
+	%D%/truncate.c \
+	%D%/tty.c \
+	%D%/uname.c \
+	%D%/utime.c \
+	%D%/wait.c
+
+libc_a_CPPFLAGS_%C%_net = -I$(srcdir)/%D%
+
+%D%/crt0.o: %D%/$(PHOENIX_MACHINE_DIR)/crt0.o
+	$(AM_V_at)rm -f $@
+	$(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+
+INSTALL_DATA_LOCAL += install-data-local-%C%
+install-data-local-%C%:
+	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \
+	for i in $(srcdir)/%D%/include/arpa/*.h; do \
+	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \
+	done; \
+	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/net; \
+	for i in $(srcdir)/%D%/include/net/*.h; do \
+	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/net/`basename $$i`; \
+	done; \
+	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \
+	for i in $(srcdir)/%D%/include/netinet/*.h; do \
+	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \
+	done; \
+	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet6; \
+	for i in $(srcdir)/%D%/include/netinet6/*.h; do \
+	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet6/`basename $$i`; \
+	done; \
+	$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netpacket; \
+	for i in $(srcdir)/%D%/include/netpacket/*.h; do \
+	  $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netpacket/`basename $$i`; \
+	done;
+
+if HAVE_LIBC_SYS_PHOENIX_ARM_DIR
+include %D%/machine/arm/Makefile.inc
+endif
diff --git a/newlib/libc/sys/phoenix/acinclude.m4 b/newlib/libc/sys/phoenix/acinclude.m4
index 6f04b82485e5..1bbc7cfe7f2b 100644
--- a/newlib/libc/sys/phoenix/acinclude.m4
+++ b/newlib/libc/sys/phoenix/acinclude.m4
@@ -1,10 +1,8 @@
 AS_IF([test "$sys_dir" = "phoenix"], [dnl
-  m4_foreach_w([MACHINE], [
-    arm
-  ], [dnl
-    AS_IF(test "${machine_dir}" = MACHINE, AC_CONFIG_FILES([libc/sys/phoenix/machine/]MACHINE[/Makefile]))
-  ])
-
   PHOENIX_MACHINE_DIR=machine/${machine_dir}
 ])
 AC_SUBST(PHOENIX_MACHINE_DIR)
+
+m4_foreach_w([MACHINE], [
+  arm
+], [AM_CONDITIONAL([HAVE_LIBC_SYS_PHOENIX_]m4_toupper(MACHINE)[_DIR], test "${machine_dir}" = MACHINE)])
diff --git a/newlib/libc/sys/phoenix/machine/arm/Makefile.am b/newlib/libc/sys/phoenix/machine/arm/Makefile.am
deleted file mode 100644
index 28ee11508789..000000000000
--- a/newlib/libc/sys/phoenix/machine/arm/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-LIB_SOURCES = syscall.S
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/phoenix/machine/arm/Makefile.inc b/newlib/libc/sys/phoenix/machine/arm/Makefile.inc
new file mode 100644
index 000000000000..01d45d771fcb
--- /dev/null
+++ b/newlib/libc/sys/phoenix/machine/arm/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/syscall.S
diff --git a/newlib/libc/sys/rdos/Makefile.am b/newlib/libc/sys/rdos/Makefile.am
deleted file mode 100644
index 42a396d84a4d..000000000000
--- a/newlib/libc/sys/rdos/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = chown.c close.c execve.c fork.c fstat.c getenv.c \
-	getpid.c gettod.c isatty.c kill.c link.c lseek.c open.c rdoshelp.c \
-	rdos.S read.c readlink.c sbrk.c stat.c symlink.c times.c unlink.c \
-	wait.c write.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/rdos/Makefile.inc b/newlib/libc/sys/rdos/Makefile.inc
new file mode 100644
index 000000000000..bab38ab24f0f
--- /dev/null
+++ b/newlib/libc/sys/rdos/Makefile.inc
@@ -0,0 +1,5 @@
+libc_a_SOURCES += \
+	%D%/chown.c %D%/close.c %D%/execve.c %D%/fork.c %D%/fstat.c %D%/getenv.c \
+	%D%/getpid.c %D%/gettod.c %D%/isatty.c %D%/kill.c %D%/link.c %D%/lseek.c %D%/open.c %D%/rdoshelp.c \
+	%D%/rdos.S %D%/read.c %D%/readlink.c %D%/sbrk.c %D%/stat.c %D%/symlink.c %D%/times.c %D%/unlink.c \
+	%D%/wait.c %D%/write.c
diff --git a/newlib/libc/sys/rtems/Makefile.am b/newlib/libc/sys/rtems/Makefile.am
deleted file mode 100644
index 58c2834cc05a..000000000000
--- a/newlib/libc/sys/rtems/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = dummysys.c cpusetalloc.c cpusetfree.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/rtems/Makefile.inc b/newlib/libc/sys/rtems/Makefile.inc
new file mode 100644
index 000000000000..6f3b5eae6081
--- /dev/null
+++ b/newlib/libc/sys/rtems/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/dummysys.c %D%/cpusetalloc.c %D%/cpusetfree.c
diff --git a/newlib/libc/sys/sh/Makefile.am b/newlib/libc/sys/sh/Makefile.am
deleted file mode 100644
index 3ad9bd3b4d5f..000000000000
--- a/newlib/libc/sys/sh/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS) $(CFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = syscalls.c trap.S creat.c ftruncate.c truncate.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/sh/Makefile.inc b/newlib/libc/sys/sh/Makefile.inc
new file mode 100644
index 000000000000..d4081ec92c2e
--- /dev/null
+++ b/newlib/libc/sys/sh/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/syscalls.c %D%/trap.S %D%/creat.c %D%/ftruncate.c %D%/truncate.c
diff --git a/newlib/libc/sys/sysmec/Makefile.am b/newlib/libc/sys/sysmec/Makefile.am
deleted file mode 100644
index bcd220f8ad57..000000000000
--- a/newlib/libc/sys/sysmec/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = _exit.c access.c chmod.c chown.c close.c creat.c crt1.c \
-	execv.c execve.c fork.c fstat.c getpid.c isatty.c \
-	kill.c lseek.c open.c pipe.c read.c \
-	sbrk.c stat.c time.c trap.S unlink.c utime.c wait.c write.c \
-	times.c gettime.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/sysmec/Makefile.inc b/newlib/libc/sys/sysmec/Makefile.inc
new file mode 100644
index 000000000000..4280af3f1498
--- /dev/null
+++ b/newlib/libc/sys/sysmec/Makefile.inc
@@ -0,0 +1,6 @@
+libc_a_SOURCES += \
+	%D%/_exit.c %D%/access.c %D%/chmod.c %D%/chown.c %D%/close.c %D%/creat.c %D%/crt1.c \
+	%D%/execv.c %D%/execve.c %D%/fork.c %D%/fstat.c %D%/getpid.c %D%/isatty.c \
+	%D%/kill.c %D%/lseek.c %D%/open.c %D%/pipe.c %D%/read.c \
+	%D%/sbrk.c %D%/stat.c %D%/time.c %D%/trap.S %D%/unlink.c %D%/utime.c %D%/wait.c %D%/write.c \
+	%D%/times.c %D%/gettime.c
diff --git a/newlib/libc/sys/sysnec810/Makefile.am b/newlib/libc/sys/sysnec810/Makefile.am
deleted file mode 100644
index 531796f45edc..000000000000
--- a/newlib/libc/sys/sysnec810/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = io.S write.c sbrk.c misc.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/sysnec810/Makefile.inc b/newlib/libc/sys/sysnec810/Makefile.inc
new file mode 100644
index 000000000000..eca6a7068625
--- /dev/null
+++ b/newlib/libc/sys/sysnec810/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/io.S %D%/write.c %D%/sbrk.c %D%/misc.c
diff --git a/newlib/libc/sys/sysnecv850/Makefile.am b/newlib/libc/sys/sysnecv850/Makefile.am
deleted file mode 100644
index a597a790edd8..000000000000
--- a/newlib/libc/sys/sysnecv850/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES =
-if MAY_SUPPLY_SYSCALLS
-lib_a_SOURCES += \
-	_exit.c access.c chmod.c chown.c close.c creat.c crt1.c \
-	execv.c execve.c fork.c fstat.c getpid.c isatty.c \
-	kill.c lseek.c open.c pipe.c read.c link.c \
-	sbrk.c stat.c time.c trap.S unlink.c utime.c wait.c write.c \
-	times.c gettime.c rename.c
-endif
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-if MAY_SUPPLY_SYSCALLS
-all-local: crt0.o
-endif
diff --git a/newlib/libc/sys/sysnecv850/Makefile.inc b/newlib/libc/sys/sysnecv850/Makefile.inc
new file mode 100644
index 000000000000..5024c3e6a37c
--- /dev/null
+++ b/newlib/libc/sys/sysnecv850/Makefile.inc
@@ -0,0 +1,8 @@
+if MAY_SUPPLY_SYSCALLS
+libc_a_SOURCES += \
+	%D%/_exit.c %D%/access.c %D%/chmod.c %D%/chown.c %D%/close.c %D%/creat.c %D%/crt1.c \
+	%D%/execv.c %D%/execve.c %D%/fork.c %D%/fstat.c %D%/getpid.c %D%/isatty.c \
+	%D%/kill.c %D%/lseek.c %D%/open.c %D%/pipe.c %D%/read.c %D%/link.c \
+	%D%/sbrk.c %D%/stat.c %D%/time.c %D%/trap.S %D%/unlink.c %D%/utime.c %D%/wait.c %D%/write.c \
+	%D%/times.c %D%/gettime.c %D%/rename.c
+endif
diff --git a/newlib/libc/sys/sysvi386/Makefile.am b/newlib/libc/sys/sysvi386/Makefile.am
deleted file mode 100644
index e8f18a118174..000000000000
--- a/newlib/libc/sys/sysvi386/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = \
-	ioctl.S isatty.c read.S lseek.S close.S sbrk.c fstat.S cerror.S \
-	_exit.S write.S open.S signal.S kill.S getpid.S brk.S fork.S wait.S \
-	execve.S exec.c utime.S fcntl.S chmod.S getuid.S getgid.S time.S \
-	stat.S link.S unlink.S rename.S mkdir.S rmdir.S sigaction.S \
-	sigprocmask.S waitpid.S sysconf.S pathconf.S fpathconf.S \
-	getdents.S opendir.c readdir.c rewinddir.c closedir.c pipe.S \
-	getgroups.S setuid.S getuid.S setgid.S geteuid.S getegid.S \
-	chdir.S dup2.c dup.c tcgetattr.c tcsetattr.c speed.c tcline.c \
-	times.S pause.S sleep.c alarm.S access.S _longjmp.S _setjmp.S
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/sysvi386/Makefile.inc b/newlib/libc/sys/sysvi386/Makefile.inc
new file mode 100644
index 000000000000..dcc753323752
--- /dev/null
+++ b/newlib/libc/sys/sysvi386/Makefile.inc
@@ -0,0 +1,10 @@
+libc_a_SOURCES += \
+	%D%/ioctl.S %D%/isatty.c %D%/read.S %D%/lseek.S %D%/close.S %D%/sbrk.c %D%/fstat.S %D%/cerror.S \
+	%D%/_exit.S %D%/write.S %D%/open.S %D%/signal.S %D%/kill.S %D%/getpid.S %D%/brk.S %D%/fork.S %D%/wait.S \
+	%D%/execve.S %D%/exec.c %D%/utime.S %D%/fcntl.S %D%/chmod.S %D%/getuid.S %D%/getgid.S %D%/time.S \
+	%D%/stat.S %D%/link.S %D%/unlink.S %D%/rename.S %D%/mkdir.S %D%/rmdir.S %D%/sigaction.S \
+	%D%/sigprocmask.S %D%/waitpid.S %D%/sysconf.S %D%/pathconf.S %D%/fpathconf.S \
+	%D%/getdents.S %D%/opendir.c %D%/readdir.c %D%/rewinddir.c %D%/closedir.c %D%/pipe.S \
+	%D%/getgroups.S %D%/setuid.S %D%/getuid.S %D%/setgid.S %D%/geteuid.S %D%/getegid.S \
+	%D%/chdir.S %D%/dup2.c %D%/dup.c %D%/tcgetattr.c %D%/tcsetattr.c %D%/speed.c %D%/tcline.c \
+	%D%/times.S %D%/pause.S %D%/sleep.c %D%/alarm.S %D%/access.S %D%/_longjmp.S %D%/_setjmp.S
diff --git a/newlib/libc/sys/sysvnecv70/Makefile.am b/newlib/libc/sys/sysvnecv70/Makefile.am
deleted file mode 100644
index 14181271d999..000000000000
--- a/newlib/libc/sys/sysvnecv70/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = ioctl.S isatty.S read.S lseek.S close.S sbrk.S fstat.S \
-	cerror.S exit.S write.S sysv60.S fpx.c fps.S open.S
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/sysvnecv70/Makefile.inc b/newlib/libc/sys/sysvnecv70/Makefile.inc
new file mode 100644
index 000000000000..d72c62f35be8
--- /dev/null
+++ b/newlib/libc/sys/sysvnecv70/Makefile.inc
@@ -0,0 +1,3 @@
+libc_a_SOURCES += \
+	%D%/ioctl.S %D%/isatty.S %D%/read.S %D%/lseek.S %D%/close.S %D%/sbrk.S %D%/fstat.S \
+	%D%/cerror.S %D%/exit.S %D%/write.S %D%/sysv60.S %D%/fpx.c %D%/fps.S %D%/open.S
diff --git a/newlib/libc/sys/tic80/Makefile.am b/newlib/libc/sys/tic80/Makefile.am
deleted file mode 100644
index 145918e9d01e..000000000000
--- a/newlib/libc/sys/tic80/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES =
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-# This is a hack to force automake to include a definition for
-# COMPILE.
-EXTRA_LIBRARIES = libfoo.a
-libfoo_a_SOURCES = crt0.c
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/tic80/Makefile.inc b/newlib/libc/sys/tic80/Makefile.inc
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/newlib/libc/sys/tirtos/Makefile.am b/newlib/libc/sys/tirtos/Makefile.am
deleted file mode 100644
index 7347bad4ec16..000000000000
--- a/newlib/libc/sys/tirtos/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = lock.c 
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/sys/tirtos/Makefile.inc b/newlib/libc/sys/tirtos/Makefile.inc
new file mode 100644
index 000000000000..765d38cb21b9
--- /dev/null
+++ b/newlib/libc/sys/tirtos/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/lock.c
diff --git a/newlib/libc/sys/w65/Makefile.am b/newlib/libc/sys/w65/Makefile.am
deleted file mode 100644
index 5e674e39e5f0..000000000000
--- a/newlib/libc/sys/w65/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = syscalls.c trap.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/w65/Makefile.inc b/newlib/libc/sys/w65/Makefile.inc
new file mode 100644
index 000000000000..732554151ebf
--- /dev/null
+++ b/newlib/libc/sys/w65/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/syscalls.c %D%/trap.c
diff --git a/newlib/libc/sys/z8ksim/Makefile.am b/newlib/libc/sys/z8ksim/Makefile.am
deleted file mode 100644
index 71c84aec60a6..000000000000
--- a/newlib/libc/sys/z8ksim/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = glue.c
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-all-local: crt0.o
diff --git a/newlib/libc/sys/z8ksim/Makefile.inc b/newlib/libc/sys/z8ksim/Makefile.inc
new file mode 100644
index 000000000000..f44e0182ffb9
--- /dev/null
+++ b/newlib/libc/sys/z8ksim/Makefile.inc
@@ -0,0 +1 @@
+libc_a_SOURCES += %D%/glue.c
diff --git a/newlib/libc/syscalls/Makefile.am b/newlib/libc/syscalls/Makefile.am
deleted file mode 100644
index 418943f8dff7..000000000000
--- a/newlib/libc/syscalls/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-	sysclose.c	\
-	sysfcntl.c	\
-	sysfstat.c	\
-	sysgetpid.c	\
-	sysgettod.c	\
-	sysisatty.c	\
-	syskill.c	\
-	syslink.c	\
-	syslseek.c	\
-	sysopen.c	\
-	sysread.c	\
-	syssbrk.c	\
-	sysstat.c	\
-	systimes.c	\
-	sysunlink.c	\
-	syswrite.c
-
-
-## Weed out EL/IX level 3 interfaces if necessary
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_SOURCES =
-else
-ELIX_SOURCES = \
-	sysexecve.c	\
-	sysfork.c	\
-	syswait.c
-endif
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/syscalls/Makefile.inc b/newlib/libc/syscalls/Makefile.inc
index e69de29bb2d1..627a4dfd2f59 100644
--- a/newlib/libc/syscalls/Makefile.inc
+++ b/newlib/libc/syscalls/Makefile.inc
@@ -0,0 +1,33 @@
+if HAVE_SYSCALL_DIR
+
+libc_a_SOURCES += \
+	%D%/sysclose.c \
+	%D%/sysfcntl.c \
+	%D%/sysfstat.c \
+	%D%/sysgetpid.c \
+	%D%/sysgettod.c \
+	%D%/sysisatty.c \
+	%D%/syskill.c \
+	%D%/syslink.c \
+	%D%/syslseek.c \
+	%D%/sysopen.c \
+	%D%/sysread.c \
+	%D%/syssbrk.c \
+	%D%/sysstat.c \
+	%D%/systimes.c \
+	%D%/sysunlink.c \
+	%D%/syswrite.c
+
+## Weed out EL/IX level 3 interfaces if necessary
+if ELIX_LEVEL_1
+else
+if ELIX_LEVEL_2
+else
+libc_a_SOURCES += \
+	%D%/sysexecve.c \
+	%D%/sysfork.c \
+	%D%/syswait.c
+endif
+endif
+
+endif
diff --git a/newlib/libc/time/Makefile.am b/newlib/libc/time/Makefile.am
deleted file mode 100644
index 96cb6c2dfbb9..000000000000
--- a/newlib/libc/time/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	asctime.c	\
-	asctime_r.c	\
-	clock.c		\
-	ctime.c		\
-	ctime_r.c	\
-	difftime.c	\
-	gettzinfo.c	\
-	gmtime.c	\
-	gmtime_r.c	\
-	lcltime.c	\
-	lcltime_r.c	\
-	mktime.c	\
-	month_lengths.c \
-	strftime.c  	\
-	strptime.c	\
-	time.c		\
-	tzcalc_limits.c \
-	tzlock.c	\
-	tzset.c		\
-	tzset_r.c	\
-	tzvars.c	\
-	wcsftime.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-$(lpfx)wcsftime.o: strftime.c
diff --git a/newlib/libc/time/Makefile.inc b/newlib/libc/time/Makefile.inc
index 3e7ba4157ea1..e8ba76a92190 100644
--- a/newlib/libc/time/Makefile.inc
+++ b/newlib/libc/time/Makefile.inc
@@ -1,3 +1,27 @@
+libc_a_SOURCES += \
+	%D%/asctime.c \
+	%D%/asctime_r.c \
+	%D%/clock.c \
+	%D%/ctime.c \
+	%D%/ctime_r.c \
+	%D%/difftime.c \
+	%D%/gettzinfo.c \
+	%D%/gmtime.c \
+	%D%/gmtime_r.c \
+	%D%/lcltime.c \
+	%D%/lcltime_r.c \
+	%D%/mktime.c \
+	%D%/month_lengths.c \
+	%D%/strftime.c   \
+	%D%/strptime.c \
+	%D%/time.c \
+	%D%/tzcalc_limits.c \
+	%D%/tzlock.c \
+	%D%/tzset.c \
+	%D%/tzset_r.c \
+	%D%/tzvars.c \
+	%D%/wcsftime.c
+
 LIBC_CHEWOUT_FILES += \
 	%D%/asctime.def \
 	%D%/clock.def \
diff --git a/newlib/libc/unix/Makefile.am b/newlib/libc/unix/Makefile.am
deleted file mode 100644
index 535521121b6c..000000000000
--- a/newlib/libc/unix/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-	getcwd.c 	\
-	pread.c 	\
-	pwrite.c 	\
-	sigset.c
-
-## Distinguish different EL/IX level interfaces
-ELIX_2_SOURCES = \
-	ttyname.c \
-	ttyname_r.c
-
-ELIX_4_SOURCES = \
-	basename.c	\
-	dirname.c	\
-	getlogin.c	\
-	getpass.c 	\
-	getpwent.c 	\
-	getut.c
-
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_SOURCES = $(ELIX_2_SOURCES)
-else
-if ELIX_LEVEL_3
-ELIX_SOURCES = $(ELIX_2_SOURCES)
-else
-ELIX_SOURCES = $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
-endif
-endif
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/unix/Makefile.inc b/newlib/libc/unix/Makefile.inc
index e69de29bb2d1..c76819b639d0 100644
--- a/newlib/libc/unix/Makefile.inc
+++ b/newlib/libc/unix/Makefile.inc
@@ -0,0 +1,35 @@
+if HAVE_UNIX_DIR
+
+libc_a_SOURCES += \
+	%D%/getcwd.c \
+	%D%/pread.c \
+	%D%/pwrite.c \
+	%D%/sigset.c
+
+## Distinguish different EL/IX level interfaces
+%C%_ELIX_2_SOURCES = \
+	%D%/ttyname.c \
+	%D%/ttyname_r.c
+
+%C%_ELIX_4_SOURCES = \
+	%D%/basename.c \
+	%D%/dirname.c \
+	%D%/getlogin.c \
+	%D%/getpass.c \
+	%D%/getpwent.c \
+	%D%/getut.c
+
+if ELIX_LEVEL_1
+else
+if ELIX_LEVEL_2
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES)
+else
+if ELIX_LEVEL_3
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES)
+else
+libc_a_SOURCES += $(%C%_ELIX_2_SOURCES) $(%C%_ELIX_4_SOURCES)
+endif
+endif
+endif
+
+endif
diff --git a/newlib/libc/xdr/Makefile.am b/newlib/libc/xdr/Makefile.am
deleted file mode 100644
index 598da8fe9e6a..000000000000
--- a/newlib/libc/xdr/Makefile.am
+++ /dev/null
@@ -1,48 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-GENERAL_SOURCES = \
-  xdr_private.c \
-  xdr.c \
-  xdr_float.c \
-  xdr_array.c \
-  xdr_mem.c \
-  xdr_rec.c \
-  xdr_reference.c \
-  xdr_sizeof.c
-
-STDIO_SOURCES = \
-  xdr_stdio.c
-
-EXTRA_SRC = \
-  xdr_float_vax.c
-
-## None of these functions are specified by EL/IX
-if ELIX_LEVEL_1
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_3
-ELIX_SOURCES =
-else
-if ELIX_LEVEL_4
-ELIX_SOURCES =
-else
-if HAVE_STDIO_DIR
-ELIX_SOURCES = $(GENERAL_SOURCES) $(STDIO_SOURCES)
-else
-ELIX_SOURCES = $(GENERAL_SOURCES)
-endif
-endif
-endif
-endif
-endif
-
-EXTRA_DIST = README $(EXTRA_SRC)
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = dummy.c $(ELIX_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/xdr/Makefile.inc b/newlib/libc/xdr/Makefile.inc
index e69de29bb2d1..40fff6356b81 100644
--- a/newlib/libc/xdr/Makefile.inc
+++ b/newlib/libc/xdr/Makefile.inc
@@ -0,0 +1,38 @@
+if HAVE_XDR_DIR
+
+%C%_ELIX_SOURCES = \
+	%D%/xdr_private.c \
+	%D%/xdr.c \
+	%D%/xdr_float.c \
+	%D%/xdr_array.c \
+	%D%/xdr_mem.c \
+	%D%/xdr_rec.c \
+	%D%/xdr_reference.c \
+	%D%/xdr_sizeof.c
+
+if HAVE_STDIO_DIR
+%C%_ELIX_SOURCES += \
+	%D%/xdr_stdio.c
+endif
+
+%C%_EXTRA_SRC = \
+	%D%/xdr_float_vax.c
+
+## None of these functions are specified by EL/IX
+if ELIX_LEVEL_1
+else
+if ELIX_LEVEL_2
+else
+if ELIX_LEVEL_3
+else
+if ELIX_LEVEL_4
+else
+libc_a_SOURCES += $(%C%_ELIX_SOURCES)
+endif
+endif
+endif
+endif
+
+EXTRA_DIST += %D%/README $(%C%_EXTRA_SRC)
+
+endif
diff --git a/newlib/libc/xdr/dummy.c b/newlib/libc/xdr/dummy.c
deleted file mode 100644
index 90d0120ed455..000000000000
--- a/newlib/libc/xdr/dummy.c
+++ /dev/null
@@ -1 +0,0 @@
-/* empty stub so there's at least one file to put in objectlist.awk.in */
-- 
2.34.1


             reply	other threads:[~2022-03-02  1:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02  1:39 Mike Frysinger [this message]
2022-03-09  8:07 ` Corinna Vinschen
2022-03-09  9:12   ` Mike Frysinger
2022-03-13 21:18     ` Mike Frysinger
2022-03-14  2:48 ` Mike Frysinger
2022-03-14 10:58   ` Corinna Vinschen
2022-03-15  0:07     ` Mike Frysinger
2022-03-15  3:04 ` [PATCH v2] " Mike Frysinger
2022-03-15  3:15   ` Mike Frysinger
2022-03-16  7:24     ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220302013959.511-1-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).