public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: newlib@sourceware.org
Subject: [PATCH v2] newlib: libm: merge build up a directory
Date: Wed, 16 Feb 2022 23:42:56 -0500	[thread overview]
Message-ID: <20220217044256.5483-1-vapier@gentoo.org> (raw)
In-Reply-To: <20220212203450.19650-1-vapier@gentoo.org>

Convert all the libm/ subdir makes into the top-level Makefile.  This
allows us to build all of libm 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 libm.a.  The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libm_a_SOURCES.

One thing to note is that this will require GNU Make because of:
	libm_a_CFLAGS = ... $(libm_a_CFLAGS_$(subst /,_,$(@D)))
This was the only way I could find to supporting per-dir compiler
settings, and I couldn't find a POSIX compatible way of transforming
the variable content.  I don't think this is a big deal as other
Makefiles in the tree are using GNU Make-specific syntax, but I call
this out as it's the only one so far in the new automake code that
I've been writing.

Automake doesn't provide precise control over the output object names
(by design).  This is fine by default as we get consistent names in all
the subdirs: libm_a-<source>.o.  But this relies on using the same set
of compiler flags for all objects.  We currently compile libm/common/
with different optimizations than the rest.

If we want to compile objects differently, we can create an intermediate
archive with the subset of objects with unique flags, and then add those
objects to the main archive.  But Automake will use a different prefix
for the objects, and thus we can't rely on ordering to override.

But if we leverage $@, we can turn Automake's CFLAGS into a multiplex
on a per-dir (and even per-file if we wanted) basis.  Unfortunately,
since $@ contains /, Automake complains it's an invalid name.  While
GNU Make supports this, it's a POSIX extension, so Automake flags it.
Using $(subst) avoids the Automake warning to get a POSIX compliant
name, albeit with a GNU Make extension.
---
v2
- rebased onto latest tree
- fixed a parallel build issue with generated newlib headers & libm objects

 newlib/Makefile.am                       |   39 +-
 newlib/Makefile.in                       | 7756 +++++++++++++++++++++-
 newlib/configure                         |  202 +-
 newlib/libm/Makefile.am                  |   28 -
 newlib/libm/Makefile.in                  |  594 --
 newlib/libm/Makefile.inc                 |   45 +-
 newlib/libm/acinclude.m4                 |   31 +-
 newlib/libm/common/Makefile.am           |   51 -
 newlib/libm/common/Makefile.in           | 1553 -----
 newlib/libm/common/Makefile.inc          |   79 +
 newlib/libm/complex/Makefile.am          |   29 -
 newlib/libm/complex/Makefile.in          | 1007 ---
 newlib/libm/complex/Makefile.inc         |   23 +
 newlib/libm/fenv/Makefile.am             |   15 -
 newlib/libm/fenv/Makefile.in             |  610 --
 newlib/libm/fenv/Makefile.inc            |    7 +
 newlib/libm/machine/aarch64/Makefile.am  |   51 -
 newlib/libm/machine/aarch64/Makefile.in  |  840 ---
 newlib/libm/machine/aarch64/Makefile.inc |   45 +
 newlib/libm/machine/arm/Makefile.am      |   41 -
 newlib/libm/machine/arm/Makefile.in      |  758 ---
 newlib/libm/machine/arm/Makefile.inc     |   34 +
 newlib/libm/machine/i386/Makefile.am     |   21 -
 newlib/libm/machine/i386/Makefile.in     |  789 ---
 newlib/libm/machine/i386/Makefile.inc    |   12 +
 newlib/libm/machine/mips/Makefile.am     |   22 -
 newlib/libm/machine/mips/Makefile.in     |  610 --
 newlib/libm/machine/mips/Makefile.inc    |   10 +
 newlib/libm/machine/nds32/Makefile.am    |   17 -
 newlib/libm/machine/nds32/Makefile.in    |  531 --
 newlib/libm/machine/nds32/Makefile.inc   |   10 +
 newlib/libm/machine/powerpc/Makefile.am  |   12 -
 newlib/libm/machine/powerpc/Makefile.in  |  606 --
 newlib/libm/machine/powerpc/Makefile.inc |    6 +
 newlib/libm/machine/pru/Makefile.am      |   11 -
 newlib/libm/machine/pru/Makefile.in      |  592 --
 newlib/libm/machine/pru/Makefile.inc     |    5 +
 newlib/libm/machine/riscv/Makefile.am    |   24 -
 newlib/libm/machine/riscv/Makefile.in    |  801 ---
 newlib/libm/machine/riscv/Makefile.inc   |   18 +
 newlib/libm/machine/sparc/Makefile.am    |   13 -
 newlib/libm/machine/sparc/Makefile.in    |  607 --
 newlib/libm/machine/sparc/Makefile.inc   |    7 +
 newlib/libm/machine/spu/Makefile.am      |   31 -
 newlib/libm/machine/spu/Makefile.in      | 1360 ----
 newlib/libm/machine/spu/Makefile.inc     |   25 +
 newlib/libm/machine/x86_64/Makefile.am   |   12 -
 newlib/libm/machine/x86_64/Makefile.in   |  606 --
 newlib/libm/machine/x86_64/Makefile.inc  |    6 +
 newlib/libm/math/Makefile.am             |   60 -
 newlib/libm/math/Makefile.in             | 1453 ----
 newlib/libm/math/Makefile.inc            |   53 +
 newlib/libm/mathfp/Makefile.am           |   50 -
 newlib/libm/mathfp/Makefile.in           | 1172 ----
 newlib/libm/mathfp/Makefile.inc          |   43 +
 55 files changed, 8090 insertions(+), 15343 deletions(-)
 delete mode 100644 newlib/libm/Makefile.am
 delete mode 100644 newlib/libm/Makefile.in
 delete mode 100644 newlib/libm/common/Makefile.am
 delete mode 100644 newlib/libm/common/Makefile.in
 delete mode 100644 newlib/libm/complex/Makefile.am
 delete mode 100644 newlib/libm/complex/Makefile.in
 delete mode 100644 newlib/libm/fenv/Makefile.am
 delete mode 100644 newlib/libm/fenv/Makefile.in
 delete mode 100644 newlib/libm/machine/aarch64/Makefile.am
 delete mode 100644 newlib/libm/machine/aarch64/Makefile.in
 create mode 100644 newlib/libm/machine/aarch64/Makefile.inc
 delete mode 100644 newlib/libm/machine/arm/Makefile.am
 delete mode 100644 newlib/libm/machine/arm/Makefile.in
 create mode 100644 newlib/libm/machine/arm/Makefile.inc
 delete mode 100644 newlib/libm/machine/i386/Makefile.am
 delete mode 100644 newlib/libm/machine/i386/Makefile.in
 create mode 100644 newlib/libm/machine/i386/Makefile.inc
 delete mode 100644 newlib/libm/machine/mips/Makefile.am
 delete mode 100644 newlib/libm/machine/mips/Makefile.in
 create mode 100644 newlib/libm/machine/mips/Makefile.inc
 delete mode 100644 newlib/libm/machine/nds32/Makefile.am
 delete mode 100644 newlib/libm/machine/nds32/Makefile.in
 create mode 100644 newlib/libm/machine/nds32/Makefile.inc
 delete mode 100644 newlib/libm/machine/powerpc/Makefile.am
 delete mode 100644 newlib/libm/machine/powerpc/Makefile.in
 create mode 100644 newlib/libm/machine/powerpc/Makefile.inc
 delete mode 100644 newlib/libm/machine/pru/Makefile.am
 delete mode 100644 newlib/libm/machine/pru/Makefile.in
 create mode 100644 newlib/libm/machine/pru/Makefile.inc
 delete mode 100644 newlib/libm/machine/riscv/Makefile.am
 delete mode 100644 newlib/libm/machine/riscv/Makefile.in
 create mode 100644 newlib/libm/machine/riscv/Makefile.inc
 delete mode 100644 newlib/libm/machine/sparc/Makefile.am
 delete mode 100644 newlib/libm/machine/sparc/Makefile.in
 create mode 100644 newlib/libm/machine/sparc/Makefile.inc
 delete mode 100644 newlib/libm/machine/spu/Makefile.am
 delete mode 100644 newlib/libm/machine/spu/Makefile.in
 create mode 100644 newlib/libm/machine/spu/Makefile.inc
 delete mode 100644 newlib/libm/machine/x86_64/Makefile.am
 delete mode 100644 newlib/libm/machine/x86_64/Makefile.in
 create mode 100644 newlib/libm/machine/x86_64/Makefile.inc
 delete mode 100644 newlib/libm/math/Makefile.am
 delete mode 100644 newlib/libm/math/Makefile.in
 delete mode 100644 newlib/libm/mathfp/Makefile.am
 delete mode 100644 newlib/libm/mathfp/Makefile.in

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 6d3b60b330b0..0a966beca6c2 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -59,11 +59,12 @@ AM_MAKEFLAGS = \
 
 FLAGS_TO_PASS=$(AM_MAKEFLAGS)
 
-SUBDIRS = libc libm .
+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
@@ -84,19 +85,19 @@ toollib_DATA = $(CRT0) $(CRT1)
 # both libc.a and libm.a.  We build them in libm.a and copy them over,
 # along with some required supporting routines.
 MATHOBJS_IN_LIBC = \
-	$(lpfx)s_fpclassify.o $(lpfx)sf_fpclassify.o \
-	$(lpfx)s_isinf.o $(lpfx)sf_isinf.o \
-	$(lpfx)s_isnan.o $(lpfx)sf_isnan.o \
-	$(lpfx)s_isinfd.o $(lpfx)sf_isinff.o \
-	$(lpfx)s_isnand.o $(lpfx)sf_isnanf.o \
-	$(lpfx)s_nan.o $(lpfx)sf_nan.o \
-	$(lpfx)s_ldexp.o $(lpfx)sf_ldexp.o \
-	$(lpfx)s_frexp.o $(lpfx)sf_frexp.o $(lpfx)frexpl.o \
-	$(lpfx)s_modf.o \
-	$(lpfx)sf_modf.o $(lpfx)s_scalbn.o \
-	$(lpfx)sf_scalbn.o \
-	$(lpfx)s_finite.o $(lpfx)sf_finite.o \
-	$(lpfx)s_copysign.o $(lpfx)sf_copysign.o
+	libm_a-s_fpclassify.o libm_a-sf_fpclassify.o \
+	libm_a-s_isinf.o libm_a-sf_isinf.o \
+	libm_a-s_isnan.o libm_a-sf_isnan.o \
+	libm_a-s_isinfd.o libm_a-sf_isinff.o \
+	libm_a-s_isnand.o libm_a-sf_isnanf.o \
+	libm_a-s_nan.o libm_a-sf_nan.o \
+	libm_a-s_ldexp.o libm_a-sf_ldexp.o \
+	libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-frexpl.o \
+	libm_a-s_modf.o \
+	libm_a-sf_modf.o libm_a-s_scalbn.o \
+	libm_a-sf_scalbn.o \
+	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 libg.a tmp
@@ -111,11 +112,11 @@ libc.a: libc/libc.a libm.a
 
 libc/libc.a: ; @true
 
-libm.a: libm/libm.a
-	rm -f $@
-	ln $< $@ >/dev/null 2>/dev/null || cp $< $@
-
-libm/libm.a: ; @true
+libm_a_SOURCES =
+libm_a_CFLAGS = $(AM_CFLAGS) $(libm_a_CFLAGS_$(subst /,_,$(@D))) $(libm_a_CFLAGS_$(subst /,_,$(@D)_$(<F)))
+libm_a_CCASFLAGS = $(AM_CCASFLAGS) $(libm_a_CCASFLAGS_$(subst /,_,$(@D))) $(libm_a_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
+libm_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libm/common $(libm_a_CPPFLAGS_$(subst /,_,$(@D))) $(libm_a_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
+$(libm_a_OBJECTS): stmp-targ-include
 
 if HAVE_MULTISUBDIR
 $(BUILD_MULTISUBDIR):
diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
deleted file mode 100644
index 0ab26cda852c..000000000000
--- a/newlib/libm/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-if NEWLIB_HW_FP
-MATHDIR = mathfp
-else
-MATHDIR = math
-endif
-
-SUBDIRS = $(MATHDIR) common complex fenv
-if HAVE_LIBM_MACHINE_DIR
-SUBDIRS += $(LIBM_MACHINE_DIR)
-endif
-
-SUBLIBS = $(MATHDIR)/lib.a common/lib.a complex/lib.a fenv/lib.a $(LIBM_MACHINE_LIB)
-noinst_LIBRARIES = libm.a
-libm.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):
diff --git a/newlib/libm/Makefile.inc b/newlib/libm/Makefile.inc
index 7fdea0ca518e..e43ec7855087 100644
--- a/newlib/libm/Makefile.inc
+++ b/newlib/libm/Makefile.inc
@@ -34,14 +34,53 @@ man: %C%_man
 	$(INSTALL_DATA) %D%/*.3 $(DESTDIR)$(mandir)/man3/
 install-man: %C%_install-man
 
-include %D%/common/Makefile.inc
-include %D%/complex/Makefile.inc
-include %D%/fenv/Makefile.inc
+## The order of includes is important for two reasons:
+## * The integrated documentation (chapter ordering).
+## * Object overridding -- machine dir must come last.
+## Do not change the order without considering the doc impact.
+
 if NEWLIB_HW_FP
 include %D%/mathfp/Makefile.inc
 else
 include %D%/math/Makefile.inc
 endif
+include %D%/common/Makefile.inc
+include %D%/complex/Makefile.inc
+include %D%/fenv/Makefile.inc
+
+if HAVE_LIBM_MACHINE_AARCH64
+include %D%/machine/aarch64/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_ARM
+include %D%/machine/arm/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_I386
+include %D%/machine/i386/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_MIPS
+include %D%/machine/mips/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_NDS32
+include %D%/machine/nds32/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_POWERPC
+include %D%/machine/powerpc/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_PRU
+include %D%/machine/pru/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_SPARC
+include %D%/machine/sparc/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_SPU
+include %D%/machine/spu/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_RISCV
+include %D%/machine/riscv/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_X86_64
+include %D%/machine/x86_64/Makefile.inc
+endif
 
 CLEANFILES += \
 	%D%/targetdep.tex \
diff --git a/newlib/libm/acinclude.m4 b/newlib/libm/acinclude.m4
index 6b59715fce70..0be95a3b29dd 100644
--- a/newlib/libm/acinclude.m4
+++ b/newlib/libm/acinclude.m4
@@ -2,28 +2,9 @@ dnl We have to include these unconditionally since machines might want to use
 dnl AM_CONDITIONAL in their subdirs.
 m4_include([libm/machine/nds32/acinclude.m4])
 
-LIBM_MACHINE_LIB=
-if test -n "${libm_machine_dir}"; then
-  case ${libm_machine_dir} in
-    aarch64) AC_CONFIG_FILES([libm/machine/aarch64/Makefile]) ;;
-    arm) AC_CONFIG_FILES([libm/machine/arm/Makefile]) ;;
-    i386) AC_CONFIG_FILES([libm/machine/i386/Makefile]) ;;
-    nds32) AC_CONFIG_FILES([libm/machine/nds32/Makefile]) ;;
-    pru) AC_CONFIG_FILES([libm/machine/pru/Makefile]) ;;
-    spu) AC_CONFIG_FILES([libm/machine/spu/Makefile]) ;;
-    riscv) AC_CONFIG_FILES([libm/machine/riscv/Makefile]) ;;
-    x86_64) AC_CONFIG_FILES([libm/machine/x86_64/Makefile]) ;;
-    powerpc) AC_CONFIG_FILES([libm/machine/powerpc/Makefile]) ;;
-    sparc) AC_CONFIG_FILES([libm/machine/sparc/Makefile]) ;;
-    mips) AC_CONFIG_FILES([libm/machine/mips/Makefile]) ;;
-    *) AC_MSG_ERROR([unsupported libm_machine_dir "${libm_machine_dir}"]) ;;
-  esac
-
-  LIBM_MACHINE_DIR=machine/${libm_machine_dir}
-  LIBM_MACHINE_LIB=${LIBM_MACHINE_DIR}/lib.a
-fi
-AM_CONDITIONAL(HAVE_LIBM_MACHINE_DIR, test "x${LIBM_MACHINE_DIR}" != x)
-AC_SUBST(LIBM_MACHINE_DIR)
-AC_SUBST(LIBM_MACHINE_LIB)
-
-AC_CONFIG_FILES([libm/Makefile libm/math/Makefile libm/mathfp/Makefile libm/common/Makefile libm/complex/Makefile libm/fenv/Makefile])
+dnl Define HAVE_LIBM_MACHINE_<machine> automake conditionals.
+m4_foreach_w([MACHINE], [
+  aarch64 arm i386 mips nds32 powerpc pru sparc spu riscv x86_64
+], [dnl
+  AM_CONDITIONAL([HAVE_LIBM_MACHINE_]m4_toupper(MACHINE), test "${libm_machine_dir}" = "MACHINE")
+])
diff --git a/newlib/libm/common/Makefile.am b/newlib/libm/common/Makefile.am
deleted file mode 100644
index 90a02b9d313f..000000000000
--- a/newlib/libm/common/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-src = 	s_finite.c s_copysign.c s_modf.c s_scalbn.c \
-	s_cbrt.c s_exp10.c s_expm1.c s_ilogb.c \
-	s_infinity.c s_isinf.c s_isinfd.c s_isnan.c s_isnand.c \
-	s_log1p.c s_nan.c s_nextafter.c s_pow10.c \
-	s_rint.c s_logb.c s_log2.c \
-	s_fdim.c s_fma.c s_fmax.c s_fmin.c s_fpclassify.c \
-	s_lrint.c s_llrint.c \
-	s_lround.c s_llround.c s_nearbyint.c s_remquo.c s_round.c s_scalbln.c \
-	s_signbit.c s_trunc.c \
-	exp.c exp2.c exp_data.c math_err.c log.c log_data.c log2.c log2_data.c \
-	pow.c pow_log_data.c
-
-fsrc =	sf_finite.c sf_copysign.c sf_modf.c sf_scalbn.c \
-	sf_cbrt.c sf_exp10.c sf_expm1.c sf_ilogb.c \
-	sf_infinity.c sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c \
-	sf_log1p.c sf_nan.c sf_nextafter.c sf_pow10.c \
-	sf_rint.c sf_logb.c \
-	sf_fdim.c sf_fma.c sf_fmax.c sf_fmin.c sf_fpclassify.c \
-	sf_lrint.c sf_llrint.c \
-	sf_lround.c sf_llround.c sf_nearbyint.c sf_remquo.c sf_round.c \
-	sf_scalbln.c sf_trunc.c \
-	sf_exp.c sf_exp2.c sf_exp2_data.c sf_log.c sf_log_data.c \
-	sf_log2.c sf_log2_data.c sf_pow_log2_data.c sf_pow.c \
-	sinf.c cosf.c sincosf.c sincosf_data.c math_errf.c
-
-lsrc =	atanl.c cosl.c sinl.c tanl.c tanhl.c frexpl.c modfl.c ceill.c fabsl.c \
-	floorl.c log1pl.c expm1l.c acosl.c asinl.c atan2l.c coshl.c sinhl.c \
-	expl.c ldexpl.c logl.c log10l.c powl.c sqrtl.c fmodl.c hypotl.c \
-	copysignl.c nanl.c ilogbl.c asinhl.c cbrtl.c nextafterl.c rintl.c \
-	scalbnl.c exp2l.c scalblnl.c tgammal.c nearbyintl.c lrintl.c llrintl.c \
-	roundl.c lroundl.c llroundl.c truncl.c remquol.c fdiml.c fmaxl.c fminl.c \
-	fmal.c acoshl.c atanhl.c remainderl.c lgammal.c erfl.c erfcl.c \
-	logbl.c nexttowardf.c nexttoward.c nexttowardl.c log2l.c \
-	sl_finite.c
-
-lib_a_CFLAGS = -fbuiltin -fno-math-errno
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(src) $(fsrc)
-if HAVE_LONG_DOUBLE
-lib_a_SOURCES += $(lsrc)
-endif # HAVE_LONG_DOUBLE
-lib_a_CFLAGS += $(AM_CFLAGS)
-
-# A partial dependency list.
-
-$(lib_a_OBJECTS): $(srcdir)/../../libc/include/math.h fdlibm.h
diff --git a/newlib/libm/common/Makefile.inc b/newlib/libm/common/Makefile.inc
index b0d3013c522b..8b54acab6f4a 100644
--- a/newlib/libm/common/Makefile.inc
+++ b/newlib/libm/common/Makefile.inc
@@ -1,3 +1,82 @@
+%C%_src = \
+	%D%/s_finite.c \
+	%D%/s_copysign.c \
+	%D%/s_modf.c \
+	%D%/s_scalbn.c \
+	%D%/s_cbrt.c \
+	%D%/s_exp10.c \
+	%D%/s_expm1.c \
+	%D%/s_ilogb.c \
+	%D%/s_infinity.c \
+	%D%/s_isinf.c \
+	%D%/s_isinfd.c \
+	%D%/s_isnan.c \
+	%D%/s_isnand.c \
+	%D%/s_log1p.c \
+	%D%/s_nan.c \
+	%D%/s_nextafter.c \
+	%D%/s_pow10.c \
+	%D%/s_rint.c \
+	%D%/s_logb.c \
+	%D%/s_log2.c \
+	%D%/s_fdim.c \
+	%D%/s_fma.c \
+	%D%/s_fmax.c \
+	%D%/s_fmin.c \
+	%D%/s_fpclassify.c \
+	%D%/s_lrint.c \
+	%D%/s_llrint.c \
+	%D%/s_lround.c \
+	%D%/s_llround.c \
+	%D%/s_nearbyint.c \
+	%D%/s_remquo.c \
+	%D%/s_round.c \
+	%D%/s_scalbln.c \
+	%D%/s_signbit.c \
+	%D%/s_trunc.c \
+	%D%/exp.c \
+	%D%/exp2.c \
+	%D%/exp_data.c \
+	%D%/math_err.c \
+	%D%/log.c \
+	%D%/log_data.c \
+	%D%/log2.c \
+	%D%/log2_data.c \
+	%D%/pow.c \
+	%D%/pow_log_data.c
+
+%C%_fsrc = \
+	%D%/sf_finite.c %D%/sf_copysign.c %D%/sf_modf.c %D%/sf_scalbn.c \
+	%D%/sf_cbrt.c %D%/sf_exp10.c %D%/sf_expm1.c %D%/sf_ilogb.c \
+	%D%/sf_infinity.c %D%/sf_isinf.c %D%/sf_isinff.c %D%/sf_isnan.c %D%/sf_isnanf.c \
+	%D%/sf_log1p.c %D%/sf_nan.c %D%/sf_nextafter.c %D%/sf_pow10.c \
+	%D%/sf_rint.c %D%/sf_logb.c \
+	%D%/sf_fdim.c %D%/sf_fma.c %D%/sf_fmax.c %D%/sf_fmin.c %D%/sf_fpclassify.c \
+	%D%/sf_lrint.c %D%/sf_llrint.c \
+	%D%/sf_lround.c %D%/sf_llround.c %D%/sf_nearbyint.c %D%/sf_remquo.c %D%/sf_round.c \
+	%D%/sf_scalbln.c %D%/sf_trunc.c \
+	%D%/sf_exp.c %D%/sf_exp2.c %D%/sf_exp2_data.c %D%/sf_log.c %D%/sf_log_data.c \
+	%D%/sf_log2.c %D%/sf_log2_data.c %D%/sf_pow_log2_data.c %D%/sf_pow.c \
+	%D%/sinf.c %D%/cosf.c %D%/sincosf.c %D%/sincosf_data.c %D%/math_errf.c
+
+%C%_lsrc = \
+	%D%/atanl.c %D%/cosl.c %D%/sinl.c %D%/tanl.c %D%/tanhl.c %D%/frexpl.c %D%/modfl.c %D%/ceill.c %D%/fabsl.c \
+	%D%/floorl.c %D%/log1pl.c %D%/expm1l.c %D%/acosl.c %D%/asinl.c %D%/atan2l.c %D%/coshl.c %D%/sinhl.c \
+	%D%/expl.c %D%/ldexpl.c %D%/logl.c %D%/log10l.c %D%/powl.c %D%/sqrtl.c %D%/fmodl.c %D%/hypotl.c \
+	%D%/copysignl.c %D%/nanl.c %D%/ilogbl.c %D%/asinhl.c %D%/cbrtl.c %D%/nextafterl.c %D%/rintl.c \
+	%D%/scalbnl.c %D%/exp2l.c %D%/scalblnl.c %D%/tgammal.c %D%/nearbyintl.c %D%/lrintl.c %D%/llrintl.c \
+	%D%/roundl.c %D%/lroundl.c %D%/llroundl.c %D%/truncl.c %D%/remquol.c %D%/fdiml.c %D%/fmaxl.c %D%/fminl.c \
+	%D%/fmal.c %D%/acoshl.c %D%/atanhl.c %D%/remainderl.c %D%/lgammal.c %D%/erfl.c %D%/erfcl.c \
+	%D%/logbl.c %D%/nexttowardf.c %D%/nexttoward.c %D%/nexttowardl.c %D%/log2l.c \
+	%D%/sl_finite.c
+
+libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
+
+libm_a_SOURCES += $(%C%_src) $(%C%_fsrc)
+if HAVE_LONG_DOUBLE
+libm_a_SOURCES += $(%C%_lsrc)
+endif # HAVE_LONG_DOUBLE
+
 LIBM_CHEWOUT_FILES += \
 	%D%/s_cbrt.def %D%/s_copysign.def %D%/s_exp10.def %D%/s_expm1.def %D%/s_ilogb.def \
 	%D%/s_infinity.def %D%/s_isnan.def %D%/s_log1p.def %D%/s_modf.def \
diff --git a/newlib/libm/complex/Makefile.am b/newlib/libm/complex/Makefile.am
deleted file mode 100644
index 49c1e6b1638a..000000000000
--- a/newlib/libm/complex/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I$(srcdir)/../common -I$(srcdir)/ $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-src = cabs.c cacos.c cacosh.c carg.c casin.c casinh.c \
-      catan.c catanh.c ccos.c ccosh.c cephes_subr.c \
-      cexp.c cimag.c  clog.c clog10.c conj.c  \
-      cpow.c cproj.c  creal.c  \
-      csin.c csinh.c csqrt.c ctan.c ctanh.c
-
-lsrc = cabsl.c creall.c cimagl.c ccoshl.c cacoshl.c \
-       clogl.c csqrtl.c cargl.c cprojl.c cexpl.c \
-       cephes_subrl.c cacosl.c ccosl.c casinl.c \
-       catanhl.c conjl.c cpowl.c ctanhl.c ctanl.c \
-       casinhl.c csinhl.c csinl.c catanl.c
-
-fsrc =	cabsf.c casinf.c ccosf.c cimagf.c cprojf.c  \
-        csqrtf.c cacosf.c casinhf.c ccoshf.c clogf.c clog10f.c \
-        crealf.c ctanf.c cacoshf.c catanf.c   \
-        cephes_subrf.c conjf.c csinf.c ctanhf.c \
-        cargf.c catanhf.c cexpf.c cpowf.c csinhf.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(src) $(fsrc) $(lsrc)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-# A partial dependency list.
-
-$(lib_a_OBJECTS): $(srcdir)/../../libc/include/complex.h $(srcdir)/cephes_subr.h $(srcdir)/cephes_subrf.h  $(srcdir)/cephes_subrl.h
diff --git a/newlib/libm/complex/Makefile.inc b/newlib/libm/complex/Makefile.inc
index 94288082ea32..88a460910d36 100644
--- a/newlib/libm/complex/Makefile.inc
+++ b/newlib/libm/complex/Makefile.inc
@@ -1,3 +1,26 @@
+%C%_src = \
+	%D%/cabs.c %D%/cacos.c %D%/cacosh.c %D%/carg.c %D%/casin.c %D%/casinh.c \
+	%D%/catan.c %D%/catanh.c %D%/ccos.c %D%/ccosh.c %D%/cephes_subr.c \
+	%D%/cexp.c %D%/cimag.c %D%/clog.c %D%/clog10.c %D%/conj.c \
+	%D%/cpow.c %D%/cproj.c %D%/creal.c \
+	%D%/csin.c %D%/csinh.c %D%/csqrt.c %D%/ctan.c %D%/ctanh.c
+
+%C%_lsrc = \
+	%D%/cabsl.c %D%/creall.c %D%/cimagl.c %D%/ccoshl.c %D%/cacoshl.c \
+	%D%/clogl.c %D%/csqrtl.c %D%/cargl.c %D%/cprojl.c %D%/cexpl.c \
+	%D%/cephes_subrl.c %D%/cacosl.c %D%/ccosl.c %D%/casinl.c \
+	%D%/catanhl.c %D%/conjl.c %D%/cpowl.c %D%/ctanhl.c %D%/ctanl.c \
+	%D%/casinhl.c %D%/csinhl.c %D%/csinl.c %D%/catanl.c
+
+%C%_fsrc = \
+	%D%/cabsf.c %D%/casinf.c %D%/ccosf.c %D%/cimagf.c %D%/cprojf.c \
+	%D%/csqrtf.c %D%/cacosf.c %D%/casinhf.c %D%/ccoshf.c %D%/clogf.c %D%/clog10f.c \
+	%D%/crealf.c %D%/ctanf.c %D%/cacoshf.c %D%/catanf.c \
+	%D%/cephes_subrf.c %D%/conjf.c %D%/csinf.c %D%/ctanhf.c \
+	%D%/cargf.c %D%/catanhf.c %D%/cexpf.c %D%/cpowf.c %D%/csinhf.c
+
+libm_a_SOURCES += $(%C%_src) $(%C%_fsrc) $(%C%_lsrc)
+
 LIBM_CHEWOUT_FILES += \
 	%D%/cabs.def %D%/cacos.def %D%/cacosh.def %D%/carg.def \
 	%D%/casin.def %D%/casinh.def %D%/catan.def %D%/catanh.def \
diff --git a/newlib/libm/fenv/Makefile.am b/newlib/libm/fenv/Makefile.am
deleted file mode 100644
index ccd40c1a8134..000000000000
--- a/newlib/libm/fenv/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-src =	feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \
-	fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
-	fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(src)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-# A partial dependency list.
-
-$(lib_a_OBJECTS): $(srcdir)/../../libc/include/fenv.h
diff --git a/newlib/libm/fenv/Makefile.inc b/newlib/libm/fenv/Makefile.inc
index 0399638ad603..a9585d9bbac6 100644
--- a/newlib/libm/fenv/Makefile.inc
+++ b/newlib/libm/fenv/Makefile.inc
@@ -1,3 +1,10 @@
+%C%_src = \
+	%D%/feclearexcept.c %D%/fe_dfl_env.c %D%/fegetenv.c %D%/fegetexceptflag.c \
+	%D%/fegetround.c %D%/feholdexcept.c %D%/feraiseexcept.c %D%/fesetenv.c \
+	%D%/fesetexceptflag.c %D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c
+
+libm_a_SOURCES += $(%C%_src)
+
 LIBM_CHEWOUT_FILES += \
 	%D%/feclearexcept.def %D%/fegetenv.def \
 	%D%/fegetexceptflag.def %D%/fegetround.def %D%/feholdexcept.def \
diff --git a/newlib/libm/machine/aarch64/Makefile.am b/newlib/libm/machine/aarch64/Makefile.am
deleted file mode 100644
index 96e782f4a341..000000000000
--- a/newlib/libm/machine/aarch64/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	e_sqrt.c \
-	ef_sqrt.c \
-	s_ceil.c \
-	s_fabs.c \
-	s_floor.c \
-	s_fma.c \
-	s_fmax.c \
-	s_fmin.c \
-	s_llrint.c \
-	s_llround.c \
-	s_lrint.c \
-	s_lround.c \
-	s_nearbyint.c \
-	s_rint.c \
-	s_round.c \
-	s_trunc.c \
-	sf_ceil.c \
-	sf_fabs.c \
-	sf_floor.c \
-	sf_fma.c \
-	sf_fmax.c \
-	sf_fmin.c \
-	sf_llrint.c \
-	sf_llround.c \
-	sf_lrint.c \
-	sf_lround.c \
-	sf_nearbyint.c \
-	sf_rint.c \
-	sf_round.c \
-	sf_trunc.c \
-	fenv.c \
-	feclearexcept.c \
-	fegetenv.c \
-	fegetexceptflag.c \
-	fegetround.c \
-	feholdexcept.c \
-	feraiseexcept.c \
-	fesetenv.c \
-	fesetexceptflag.c \
-	fesetround.c \
-	fetestexcept.c \
-	feupdateenv.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/aarch64/Makefile.inc b/newlib/libm/machine/aarch64/Makefile.inc
new file mode 100644
index 000000000000..478aaeed8b05
--- /dev/null
+++ b/newlib/libm/machine/aarch64/Makefile.inc
@@ -0,0 +1,45 @@
+%C%_src = \
+	%D%/e_sqrt.c \
+	%D%/ef_sqrt.c \
+	%D%/s_ceil.c \
+	%D%/s_fabs.c \
+	%D%/s_floor.c \
+	%D%/s_fma.c \
+	%D%/s_fmax.c \
+	%D%/s_fmin.c \
+	%D%/s_llrint.c \
+	%D%/s_llround.c \
+	%D%/s_lrint.c \
+	%D%/s_lround.c \
+	%D%/s_nearbyint.c \
+	%D%/s_rint.c \
+	%D%/s_round.c \
+	%D%/s_trunc.c \
+	%D%/sf_ceil.c \
+	%D%/sf_fabs.c \
+	%D%/sf_floor.c \
+	%D%/sf_fma.c \
+	%D%/sf_fmax.c \
+	%D%/sf_fmin.c \
+	%D%/sf_llrint.c \
+	%D%/sf_llround.c \
+	%D%/sf_lrint.c \
+	%D%/sf_lround.c \
+	%D%/sf_nearbyint.c \
+	%D%/sf_rint.c \
+	%D%/sf_round.c \
+	%D%/sf_trunc.c \
+	%D%/fenv.c \
+	%D%/feclearexcept.c \
+	%D%/fegetenv.c \
+	%D%/fegetexceptflag.c \
+	%D%/fegetround.c \
+	%D%/feholdexcept.c \
+	%D%/feraiseexcept.c \
+	%D%/fesetenv.c \
+	%D%/fesetexceptflag.c \
+	%D%/fesetround.c \
+	%D%/fetestexcept.c \
+	%D%/feupdateenv.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/arm/Makefile.am b/newlib/libm/machine/arm/Makefile.am
deleted file mode 100644
index d8842f91705b..000000000000
--- a/newlib/libm/machine/arm/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	e_sqrt.c \
-	ef_sqrt.c \
-	s_ceil.c \
-	s_floor.c \
-	s_fma_arm.c \
-	s_nearbyint.c \
-	s_rint.c \
-	s_round.c \
-	s_trunc.c \
-	sf_ceil.c \
-	sf_floor.c \
-	sf_fma_arm.c \
-	sf_nearbyint.c \
-	sf_rint.c \
-	sf_round.c \
-	sf_trunc.c \
-	feclearexcept.c \
-	fe_dfl_env.c\
-	fegetenv.c \
-	fegetexceptflag.c \
-	fegetround.c \
-	feholdexcept.c \
-	fegetexcept.c \
-	feraiseexcept.c \
-	fesetenv.c \
-	fesetexceptflag.c \
-	fesetround.c \
-	fetestexcept.c \
-	feupdateenv.c \
-	feenableexcept.c \
-	fedisableexcept.c
-
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/arm/Makefile.inc b/newlib/libm/machine/arm/Makefile.inc
new file mode 100644
index 000000000000..988e2340006c
--- /dev/null
+++ b/newlib/libm/machine/arm/Makefile.inc
@@ -0,0 +1,34 @@
+%C%_src = \
+	%D%/e_sqrt.c \
+	%D%/ef_sqrt.c \
+	%D%/s_ceil.c \
+	%D%/s_floor.c \
+	%D%/s_fma_arm.c \
+	%D%/s_nearbyint.c \
+	%D%/s_rint.c \
+	%D%/s_round.c \
+	%D%/s_trunc.c \
+	%D%/sf_ceil.c \
+	%D%/sf_floor.c \
+	%D%/sf_fma_arm.c \
+	%D%/sf_nearbyint.c \
+	%D%/sf_rint.c \
+	%D%/sf_round.c \
+	%D%/sf_trunc.c \
+	%D%/feclearexcept.c \
+	%D%/fe_dfl_env.c\
+	%D%/fegetenv.c \
+	%D%/fegetexceptflag.c \
+	%D%/fegetround.c \
+	%D%/feholdexcept.c \
+	%D%/fegetexcept.c \
+	%D%/feraiseexcept.c \
+	%D%/fesetenv.c \
+	%D%/fesetexceptflag.c \
+	%D%/fesetround.c \
+	%D%/fetestexcept.c \
+	%D%/feupdateenv.c \
+	%D%/feenableexcept.c \
+	%D%/fedisableexcept.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/i386/Makefile.am b/newlib/libm/machine/i386/Makefile.am
deleted file mode 100644
index 4b9781883899..000000000000
--- a/newlib/libm/machine/i386/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-AM_CCASFLAGS = $(AM_CPPFLAGS)
-
-LIB_SOURCES = \
-	f_atan2.S f_atan2f.S f_exp.c f_expf.c \
-	f_frexp.S f_frexpf.S f_llrint.c f_llrintf.c f_llrintl.c \
-	f_log.S f_logf.S f_log10.S f_log10f.S \
-	f_ldexp.S f_ldexpf.S f_lrint.c f_lrintf.c f_lrintl.c \
-	f_pow.c f_powf.c f_rint.c f_rintf.c f_rintl.c \
-	f_tan.S f_tanf.S f_math.h i386mach.h \
-	fenv.c feclearexcept.c fegetenv.c fegetexceptflag.c \
-	fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
-	fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
-lib_a_CCASFLAGS = $(AM_CCASFLAGS)
diff --git a/newlib/libm/machine/i386/Makefile.inc b/newlib/libm/machine/i386/Makefile.inc
new file mode 100644
index 000000000000..420d25fbd4df
--- /dev/null
+++ b/newlib/libm/machine/i386/Makefile.inc
@@ -0,0 +1,12 @@
+%C%_src = \
+	%D%/f_atan2.S %D%/f_atan2f.S %D%/f_exp.c %D%/f_expf.c \
+	%D%/f_frexp.S %D%/f_frexpf.S %D%/f_llrint.c %D%/f_llrintf.c %D%/f_llrintl.c \
+	%D%/f_log.S %D%/f_logf.S %D%/f_log10.S %D%/f_log10f.S \
+	%D%/f_ldexp.S %D%/f_ldexpf.S %D%/f_lrint.c %D%/f_lrintf.c %D%/f_lrintl.c \
+	%D%/f_pow.c %D%/f_powf.c %D%/f_rint.c %D%/f_rintf.c %D%/f_rintl.c \
+	%D%/f_tan.S %D%/f_tanf.S %D%/f_math.h %D%/i386mach.h \
+	%D%/fenv.c %D%/feclearexcept.c %D%/fegetenv.c %D%/fegetexceptflag.c \
+	%D%/fegetround.c %D%/feholdexcept.c %D%/feraiseexcept.c %D%/fesetenv.c \
+	%D%/fesetexceptflag.c %D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/mips/Makefile.am b/newlib/libm/machine/mips/Makefile.am
deleted file mode 100644
index e72cd764aaa5..000000000000
--- a/newlib/libm/machine/mips/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	feclearexcept.c fegetenv.c fegetexceptflag.c \
-	fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
-	fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-lib_a_LIBADD = \
-	lib_a-fenv.$(OBJEXT)
-
-# fenv.c cannot be compiled as mips16 since it uses the cfc1 instruction
-lib_a-fenv.o: fenv.c
-	$(COMPILE) -mno-mips16 -c -o $@ `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c
-
-lib_a-fenv.obj: fenv.c
-	$(COMPILE) -mno-mips16 -c -o $@ `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi`
diff --git a/newlib/libm/machine/mips/Makefile.inc b/newlib/libm/machine/mips/Makefile.inc
new file mode 100644
index 000000000000..febae0d070d0
--- /dev/null
+++ b/newlib/libm/machine/mips/Makefile.inc
@@ -0,0 +1,10 @@
+%C%_src = \
+	%D%/feclearexcept.c %D%/fegetenv.c %D%/fegetexceptflag.c \
+	%D%/fegetround.c %D%/feholdexcept.c %D%/feraiseexcept.c %D%/fesetenv.c \
+	%D%/fesetexceptflag.c %D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c \
+	%D%/fenv.c
+
+libm_a_SOURCES += $(%C%_src)
+
+# fenv.c cannot be compiled as mips16 since it uses the cfc1 instruction.
+libm_a_CFLAGS_%C%_fenv.c = -mno-mips16
diff --git a/newlib/libm/machine/nds32/Makefile.am b/newlib/libm/machine/nds32/Makefile.am
deleted file mode 100644
index 8810f17f9409..000000000000
--- a/newlib/libm/machine/nds32/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-src =
-
-if HAS_NDS32_FPU_SP
-src += wf_sqrt.S
-endif
-
-if HAS_NDS32_FPU_DP
-src += w_sqrt.S
-endif
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(src)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/nds32/Makefile.inc b/newlib/libm/machine/nds32/Makefile.inc
new file mode 100644
index 000000000000..e404baac2742
--- /dev/null
+++ b/newlib/libm/machine/nds32/Makefile.inc
@@ -0,0 +1,10 @@
+%C%_src =
+if HAS_NDS32_FPU_SP
+%C%_src += %D%/wf_sqrt.S
+endif
+
+if HAS_NDS32_FPU_DP
+%C%_src += %D%/w_sqrt.S
+endif
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/powerpc/Makefile.am b/newlib/libm/machine/powerpc/Makefile.am
deleted file mode 100644
index 9a10297992ea..000000000000
--- a/newlib/libm/machine/powerpc/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	feclearexcept.c fegetenv.c fegetexceptflag.c \
-	fegetround.c feholdexcept.c fenv.c feraiseexcept.c fesetenv.c \
-	fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/powerpc/Makefile.inc b/newlib/libm/machine/powerpc/Makefile.inc
new file mode 100644
index 000000000000..79fc26103092
--- /dev/null
+++ b/newlib/libm/machine/powerpc/Makefile.inc
@@ -0,0 +1,6 @@
+%C%_src = \
+	%D%/feclearexcept.c %D%/fegetenv.c %D%/fegetexceptflag.c \
+	%D%/fegetround.c %D%/feholdexcept.c %D%/fenv.c %D%/feraiseexcept.c %D%/fesetenv.c \
+	%D%/fesetexceptflag.c %D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/pru/Makefile.am b/newlib/libm/machine/pru/Makefile.am
deleted file mode 100644
index b530c97f84f2..000000000000
--- a/newlib/libm/machine/pru/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	fpclassify.c fpclassifyf.c isfinite.c isfinitef.c isinf.c \
-	isinff.c isnan.c isnanf.c isnormal.c isnormalf.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/pru/Makefile.inc b/newlib/libm/machine/pru/Makefile.inc
new file mode 100644
index 000000000000..e711d0872821
--- /dev/null
+++ b/newlib/libm/machine/pru/Makefile.inc
@@ -0,0 +1,5 @@
+%C%_src = \
+	%D%/fpclassify.c %D%/fpclassifyf.c %D%/isfinite.c %D%/isfinitef.c %D%/isinf.c \
+	%D%/isinff.c %D%/isnan.c %D%/isnanf.c %D%/isnormal.c %D%/isnormalf.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/riscv/Makefile.am b/newlib/libm/machine/riscv/Makefile.am
deleted file mode 100644
index 1d228a868a3a..000000000000
--- a/newlib/libm/machine/riscv/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \
-	fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
-	fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \
-	s_fma.c e_sqrt.c sf_fma.c ef_sqrt.c \
-	s_fmax.c s_fmin.c sf_fmax.c sf_fmin.c \
-	s_fabs.c sf_fabs.c \
-	s_fpclassify.c sf_fpclassify.c \
-	s_finite.c sf_finite.c \
-	s_isinf.c sf_isinf.c \
-	s_isnan.c sf_isnan.c \
-	s_copysign.c sf_copysign.c \
-	s_lrint.c sf_lrint.c \
-	s_lround.c sf_lround.c \
-	s_llrint.c sf_llrint.c \
-	s_llround.c sf_llround.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/riscv/Makefile.inc b/newlib/libm/machine/riscv/Makefile.inc
new file mode 100644
index 000000000000..9ce71e7be622
--- /dev/null
+++ b/newlib/libm/machine/riscv/Makefile.inc
@@ -0,0 +1,18 @@
+%C%_src = \
+	%D%/feclearexcept.c %D%/fe_dfl_env.c %D%/fegetenv.c %D%/fegetexceptflag.c \
+	%D%/fegetround.c %D%/feholdexcept.c %D%/feraiseexcept.c %D%/fesetenv.c \
+	%D%/fesetexceptflag.c %D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c \
+	%D%/s_fma.c %D%/e_sqrt.c %D%/sf_fma.c %D%/ef_sqrt.c \
+	%D%/s_fmax.c %D%/s_fmin.c %D%/sf_fmax.c %D%/sf_fmin.c \
+	%D%/s_fabs.c %D%/sf_fabs.c \
+	%D%/s_fpclassify.c %D%/sf_fpclassify.c \
+	%D%/s_finite.c %D%/sf_finite.c \
+	%D%/s_isinf.c %D%/sf_isinf.c \
+	%D%/s_isnan.c %D%/sf_isnan.c \
+	%D%/s_copysign.c %D%/sf_copysign.c \
+	%D%/s_lrint.c %D%/sf_lrint.c \
+	%D%/s_lround.c %D%/sf_lround.c \
+	%D%/s_llrint.c %D%/sf_llrint.c \
+	%D%/s_llround.c %D%/sf_llround.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/sparc/Makefile.am b/newlib/libm/machine/sparc/Makefile.am
deleted file mode 100644
index d0addf6702a3..000000000000
--- a/newlib/libm/machine/sparc/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	feclearexcept.c  fegetenv.c fegetexceptflag.c \
-	fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
-	fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \
-	fenv.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/sparc/Makefile.inc b/newlib/libm/machine/sparc/Makefile.inc
new file mode 100644
index 000000000000..df510a4da9d2
--- /dev/null
+++ b/newlib/libm/machine/sparc/Makefile.inc
@@ -0,0 +1,7 @@
+%C%_src = \
+	%D%/feclearexcept.c  %D%/fegetenv.c %D%/fegetexceptflag.c \
+	%D%/fegetround.c %D%/feholdexcept.c %D%/feraiseexcept.c %D%/fesetenv.c \
+	%D%/fesetexceptflag.c %D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c \
+	%D%/fenv.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/spu/Makefile.am b/newlib/libm/machine/spu/Makefile.am
deleted file mode 100644
index c1c6b4ac0c9a..000000000000
--- a/newlib/libm/machine/spu/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \
-	fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
-	fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \
-	llrint.c llrintf.c llround.c llroundf.c log2.c log2f.c s_asinh.c \
-	s_atan.c s_cbrt.c s_ceil.c s_copysign.c s_cos.c s_erf.c s_expm1.c \
-	s_fabs.c sf_asinh.c sf_atan.c sf_cbrt.c sf_ceil.c sf_copysign.c \
-	sf_cos.c s_fdim.c sf_erf.c sf_expm1.c sf_fabs.c sf_fdim.c \
-	sf_finite.c sf_floor.c sf_fma.c sf_fmax.c sf_fmin.c \
-	sf_fpclassify.c sf_frexp.c sf_ilogb.c sf_isinf.c sf_isinff.c \
-	sf_isnan.c sf_isnanf.c sf_ldexp.c sf_log1p.c sf_logb.c s_floor.c \
-	sf_lrint.c sf_lround.c s_fma.c s_fmax.c s_fmin.c sf_nan.c \
-	sf_nearbyint.c sf_nextafter.c sf_remquo.c s_frexp.c sf_rint.c \
-	sf_round.c sf_scalbn.c sf_sin.c sf_tan.c sf_tanh.c sf_trunc.c \
-	s_ilogb.c s_isnan.c s_ldexp.c s_log1p.c s_lrint.c s_lround.c \
-	s_nearbyint.c s_nextafter.c s_remquo.c s_rint.c s_round.c \
-	s_scalbn.c s_sin.c s_tan.c s_tanh.c s_trunc.c w_acos.c w_acosh.c \
-	w_asin.c w_atan2.c w_atanh.c w_cosh.c w_exp2.c w_exp.c wf_acos.c \
-	wf_acosh.c wf_asin.c wf_atan2.c wf_atanh.c wf_cosh.c wf_exp2.c \
-	wf_exp.c wf_fmod.c wf_hypot.c wf_lgamma.c wf_log10.c wf_log.c \
-	w_fmod.c wf_pow.c wf_remainder.c wf_sincos.c wf_sinh.c wf_sqrt.c \
-	wf_tgamma.c w_hypot.c w_lgamma.c w_log10.c w_log.c w_pow.c \
-	w_remainder.c w_sincos.c w_sinh.c w_sqrt.c w_tgamma.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/spu/Makefile.inc b/newlib/libm/machine/spu/Makefile.inc
new file mode 100644
index 000000000000..8dec3dedc536
--- /dev/null
+++ b/newlib/libm/machine/spu/Makefile.inc
@@ -0,0 +1,25 @@
+%C%_src = \
+	%D%/feclearexcept.c %D%/fe_dfl_env.c %D%/fegetenv.c %D%/fegetexceptflag.c \
+	%D%/fegetround.c %D%/feholdexcept.c %D%/feraiseexcept.c %D%/fesetenv.c \
+	%D%/fesetexceptflag.c %D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c \
+	%D%/llrint.c %D%/llrintf.c %D%/llround.c %D%/llroundf.c %D%/log2.c %D%/log2f.c %D%/s_asinh.c \
+	%D%/s_atan.c %D%/s_cbrt.c %D%/s_ceil.c %D%/s_copysign.c %D%/s_cos.c %D%/s_erf.c %D%/s_expm1.c \
+	%D%/s_fabs.c %D%/sf_asinh.c %D%/sf_atan.c %D%/sf_cbrt.c %D%/sf_ceil.c %D%/sf_copysign.c \
+	%D%/sf_cos.c %D%/s_fdim.c %D%/sf_erf.c %D%/sf_expm1.c %D%/sf_fabs.c %D%/sf_fdim.c \
+	%D%/sf_finite.c %D%/sf_floor.c %D%/sf_fma.c %D%/sf_fmax.c %D%/sf_fmin.c \
+	%D%/sf_fpclassify.c %D%/sf_frexp.c %D%/sf_ilogb.c %D%/sf_isinf.c %D%/sf_isinff.c \
+	%D%/sf_isnan.c %D%/sf_isnanf.c %D%/sf_ldexp.c %D%/sf_log1p.c %D%/sf_logb.c %D%/s_floor.c \
+	%D%/sf_lrint.c %D%/sf_lround.c %D%/s_fma.c %D%/s_fmax.c %D%/s_fmin.c %D%/sf_nan.c \
+	%D%/sf_nearbyint.c %D%/sf_nextafter.c %D%/sf_remquo.c %D%/s_frexp.c %D%/sf_rint.c \
+	%D%/sf_round.c %D%/sf_scalbn.c %D%/sf_sin.c %D%/sf_tan.c %D%/sf_tanh.c %D%/sf_trunc.c \
+	%D%/s_ilogb.c %D%/s_isnan.c %D%/s_ldexp.c %D%/s_log1p.c %D%/s_lrint.c %D%/s_lround.c \
+	%D%/s_nearbyint.c %D%/s_nextafter.c %D%/s_remquo.c %D%/s_rint.c %D%/s_round.c \
+	%D%/s_scalbn.c %D%/s_sin.c %D%/s_tan.c %D%/s_tanh.c %D%/s_trunc.c %D%/w_acos.c %D%/w_acosh.c \
+	%D%/w_asin.c %D%/w_atan2.c %D%/w_atanh.c %D%/w_cosh.c %D%/w_exp2.c %D%/w_exp.c %D%/wf_acos.c \
+	%D%/wf_acosh.c %D%/wf_asin.c %D%/wf_atan2.c %D%/wf_atanh.c %D%/wf_cosh.c %D%/wf_exp2.c \
+	%D%/wf_exp.c %D%/wf_fmod.c %D%/wf_hypot.c %D%/wf_lgamma.c %D%/wf_log10.c %D%/wf_log.c \
+	%D%/w_fmod.c %D%/wf_pow.c %D%/wf_remainder.c %D%/wf_sincos.c %D%/wf_sinh.c %D%/wf_sqrt.c \
+	%D%/wf_tgamma.c %D%/w_hypot.c %D%/w_lgamma.c %D%/w_log10.c %D%/w_log.c %D%/w_pow.c \
+	%D%/w_remainder.c %D%/w_sincos.c %D%/w_sinh.c %D%/w_sqrt.c %D%/w_tgamma.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/machine/x86_64/Makefile.am b/newlib/libm/machine/x86_64/Makefile.am
deleted file mode 100644
index 5815dc91e6af..000000000000
--- a/newlib/libm/machine/x86_64/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-LIB_SOURCES = \
-	feclearexcept.c fegetenv.c fegetexceptflag.c fegetround.c \
-	feholdexcept.c fenv.c feraiseexcept.c fesetenv.c fesetexceptflag.c \
-	fesetround.c fetestexcept.c feupdateenv.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
-lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libm/machine/x86_64/Makefile.inc b/newlib/libm/machine/x86_64/Makefile.inc
new file mode 100644
index 000000000000..48a1f71b276f
--- /dev/null
+++ b/newlib/libm/machine/x86_64/Makefile.inc
@@ -0,0 +1,6 @@
+%C%_src = \
+	%D%/feclearexcept.c %D%/fegetenv.c %D%/fegetexceptflag.c %D%/fegetround.c \
+	%D%/feholdexcept.c %D%/fenv.c %D%/feraiseexcept.c %D%/fesetenv.c %D%/fesetexceptflag.c \
+	%D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c
+
+libm_a_SOURCES += $(%C%_src)
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am
deleted file mode 100644
index 2baefb069e51..000000000000
--- a/newlib/libm/math/Makefile.am
+++ /dev/null
@@ -1,60 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I$(srcdir)/../common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-src = 	k_standard.c k_rem_pio2.c \
-	k_cos.c k_sin.c k_tan.c \
-	e_acos.c e_acosh.c e_asin.c e_atan2.c \
-	e_atanh.c e_cosh.c e_exp.c e_fmod.c \
-	e_tgamma.c e_hypot.c e_j0.c \
-	e_j1.c e_jn.c er_lgamma.c \
-	e_log.c e_log10.c e_pow.c e_rem_pio2.c e_remainder.c \
-	e_scalb.c e_sinh.c e_sqrt.c \
-	w_acos.c w_acosh.c w_asin.c w_atan2.c \
-	w_atanh.c w_cosh.c w_exp.c w_fmod.c \
-	w_gamma.c wr_gamma.c w_hypot.c w_j0.c \
-	w_j1.c w_jn.c w_lgamma.c wr_lgamma.c \
-	w_log.c w_log10.c w_pow.c w_remainder.c \
-	w_scalb.c w_sinh.c w_sqrt.c \
-	w_sincos.c \
-	w_drem.c \
-	s_asinh.c s_atan.c s_ceil.c \
-	s_cos.c s_erf.c s_fabs.c s_floor.c \
-	s_frexp.c s_ldexp.c \
-	s_signif.c s_sin.c \
-	s_tan.c s_tanh.c \
-	w_exp2.c w_tgamma.c
-
-fsrc =	kf_rem_pio2.c \
-	kf_cos.c kf_sin.c kf_tan.c \
-	ef_acos.c ef_acosh.c ef_asin.c ef_atan2.c \
-	ef_atanh.c ef_cosh.c ef_exp.c ef_fmod.c \
-	ef_tgamma.c ef_hypot.c ef_j0.c \
-	ef_j1.c ef_jn.c erf_lgamma.c \
-	ef_log.c ef_log10.c ef_pow.c ef_rem_pio2.c ef_remainder.c \
-	ef_scalb.c ef_sinh.c ef_sqrt.c \
-	wf_acos.c wf_acosh.c wf_asin.c wf_atan2.c \
-	wf_atanh.c wf_cosh.c wf_exp.c wf_fmod.c \
-	wf_gamma.c wrf_gamma.c wf_hypot.c wf_j0.c \
-	wf_j1.c wf_jn.c wf_lgamma.c wrf_lgamma.c \
-	wf_log.c wf_log10.c wf_pow.c wf_remainder.c \
-	wf_scalb.c wf_sinh.c wf_sqrt.c \
-	wf_sincos.c \
-	wf_drem.c \
-	sf_asinh.c sf_atan.c sf_ceil.c \
-	sf_cos.c sf_erf.c sf_fabs.c sf_floor.c \
-	sf_frexp.c sf_ldexp.c \
-	sf_signif.c sf_sin.c \
-	sf_tan.c sf_tanh.c \
-	wf_exp2.c wf_tgamma.c \
-	wf_log2.c
-
-lsrc = el_hypot.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(src) $(fsrc) $(lsrc)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-# A partial dependency list.
-
-$(lib_a_OBJECTS): $(srcdir)/../../libc/include/math.h $(srcdir)/../common/fdlibm.h
diff --git a/newlib/libm/math/Makefile.inc b/newlib/libm/math/Makefile.inc
index bc3205e0b156..1b61d6dd30d5 100644
--- a/newlib/libm/math/Makefile.inc
+++ b/newlib/libm/math/Makefile.inc
@@ -1,3 +1,56 @@
+%C%_src = \
+	%D%/k_standard.c %D%/k_rem_pio2.c \
+	%D%/k_cos.c %D%/k_sin.c %D%/k_tan.c \
+	%D%/e_acos.c %D%/e_acosh.c %D%/e_asin.c %D%/e_atan2.c \
+	%D%/e_atanh.c %D%/e_cosh.c %D%/e_exp.c %D%/e_fmod.c \
+	%D%/e_tgamma.c %D%/e_hypot.c %D%/e_j0.c \
+	%D%/e_j1.c %D%/e_jn.c %D%/er_lgamma.c \
+	%D%/e_log.c %D%/e_log10.c %D%/e_pow.c %D%/e_rem_pio2.c %D%/e_remainder.c \
+	%D%/e_scalb.c %D%/e_sinh.c %D%/e_sqrt.c \
+	%D%/w_acos.c %D%/w_acosh.c %D%/w_asin.c %D%/w_atan2.c \
+	%D%/w_atanh.c %D%/w_cosh.c %D%/w_exp.c %D%/w_fmod.c \
+	%D%/w_gamma.c %D%/wr_gamma.c %D%/w_hypot.c %D%/w_j0.c \
+	%D%/w_j1.c %D%/w_jn.c %D%/w_lgamma.c %D%/wr_lgamma.c \
+	%D%/w_log.c %D%/w_log10.c %D%/w_pow.c %D%/w_remainder.c \
+	%D%/w_scalb.c %D%/w_sinh.c %D%/w_sqrt.c \
+	%D%/w_sincos.c \
+	%D%/w_drem.c \
+	%D%/s_asinh.c %D%/s_atan.c %D%/s_ceil.c \
+	%D%/s_cos.c %D%/s_erf.c %D%/s_fabs.c %D%/s_floor.c \
+	%D%/s_frexp.c %D%/s_ldexp.c \
+	%D%/s_signif.c %D%/s_sin.c \
+	%D%/s_tan.c %D%/s_tanh.c \
+	%D%/w_exp2.c %D%/w_tgamma.c
+
+%C%_fsrc = \
+	%D%/kf_rem_pio2.c \
+	%D%/kf_cos.c %D%/kf_sin.c %D%/kf_tan.c \
+	%D%/ef_acos.c %D%/ef_acosh.c %D%/ef_asin.c %D%/ef_atan2.c \
+	%D%/ef_atanh.c %D%/ef_cosh.c %D%/ef_exp.c %D%/ef_fmod.c \
+	%D%/ef_tgamma.c %D%/ef_hypot.c %D%/ef_j0.c \
+	%D%/ef_j1.c %D%/ef_jn.c %D%/erf_lgamma.c \
+	%D%/ef_log.c %D%/ef_log10.c %D%/ef_pow.c %D%/ef_rem_pio2.c %D%/ef_remainder.c \
+	%D%/ef_scalb.c %D%/ef_sinh.c %D%/ef_sqrt.c \
+	%D%/wf_acos.c %D%/wf_acosh.c %D%/wf_asin.c %D%/wf_atan2.c \
+	%D%/wf_atanh.c %D%/wf_cosh.c %D%/wf_exp.c %D%/wf_fmod.c \
+	%D%/wf_gamma.c %D%/wrf_gamma.c %D%/wf_hypot.c %D%/wf_j0.c \
+	%D%/wf_j1.c %D%/wf_jn.c %D%/wf_lgamma.c %D%/wrf_lgamma.c \
+	%D%/wf_log.c %D%/wf_log10.c %D%/wf_pow.c %D%/wf_remainder.c \
+	%D%/wf_scalb.c %D%/wf_sinh.c %D%/wf_sqrt.c \
+	%D%/wf_sincos.c \
+	%D%/wf_drem.c \
+	%D%/sf_asinh.c %D%/sf_atan.c %D%/sf_ceil.c \
+	%D%/sf_cos.c %D%/sf_erf.c %D%/sf_fabs.c %D%/sf_floor.c \
+	%D%/sf_frexp.c %D%/sf_ldexp.c \
+	%D%/sf_signif.c %D%/sf_sin.c \
+	%D%/sf_tan.c %D%/sf_tanh.c \
+	%D%/wf_exp2.c %D%/wf_tgamma.c \
+	%D%/wf_log2.c
+
+%C%_lsrc = %D%/el_hypot.c
+
+libm_a_SOURCES += $(%C%_src) $(%C%_fsrc) $(%C%_lsrc)
+
 LIBM_CHEWOUT_FILES += \
 	%D%/w_acos.def %D%/w_acosh.def %D%/w_asin.def %D%/s_asinh.def \
 	%D%/s_atan.def %D%/w_atan2.def %D%/w_atanh.def %D%/w_j0.def \
diff --git a/newlib/libm/mathfp/Makefile.am b/newlib/libm/mathfp/Makefile.am
deleted file mode 100644
index bd77fb16de6d..000000000000
--- a/newlib/libm/mathfp/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AM_CPPFLAGS = -I$(srcdir)/../common $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
-
-src =	s_acos.c s_frexp.c s_mathcnst.c \
-	s_cos.c s_sinh.c \
-	s_asin.c\
-	s_asine.c s_cosh.c s_ispos.c s_numtest.c s_sqrt.c \
-	s_exp.c s_ldexp.c s_pow.c s_tan.c \
-	s_atan.c \
-	s_atan2.c s_fabs.c s_log.c s_tanh.c \
-	s_log10.c s_sin.c \
-	s_floor.c s_sine.c \
-	s_sincos.c \
-	s_atangent.c s_logarithm.c \
-	s_sineh.c \
-	s_ceil.c \
-	e_acosh.c e_atanh.c e_remainder.c \
-	er_gamma.c er_lgamma.c \
-	s_erf.c e_j0.c e_j1.c w_jn.c e_hypot.c \
-	w_cabs.c w_drem.c s_asinh.c s_fmod.c \
-	e_scalb.c s_signif.c \
-	s_exp2.c s_tgamma.c
-
-fsrc =	sf_ceil.c \
-	sf_acos.c sf_frexp.c \
-	sf_cos.c sf_sinh.c \
-	sf_asine.c sf_cosh.c sf_ispos.c sf_numtest.c sf_sqrt.c \
-	sf_asin.c \
-	sf_exp.c sf_ldexp.c sf_pow.c sf_tan.c \
-	sf_atan2.c sf_fabs.c sf_tanh.c \
-	sf_atan.c sf_log10.c sf_sin.c\
-	sf_floor.c sf_sine.c \
-	sf_sincos.c \
-	sf_atangent.c sf_logarithm.c sf_sineh.c \
-	sf_log.c sf_sineh.c \
-	ef_acosh.c ef_atanh.c ef_remainder.c \
-	erf_gamma.c erf_lgamma.c \
-	sf_erf.c ef_j0.c ef_j1.c wf_jn.c ef_hypot.c \
-	wf_cabs.c wf_drem.c sf_asinh.c sf_fmod.c \
-	ef_scalb.c sf_signif.c \
-	sf_exp2.c sf_tgamma.c
-
-noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(src) $(fsrc)
-lib_a_CFLAGS = $(AM_CFLAGS)
-
-# A partial dependency list.
-
-$(lib_a_OBJECTS): $(srcdir)/../../libc/include/math.h $(srcdir)/../common/fdlibm.h
diff --git a/newlib/libm/mathfp/Makefile.inc b/newlib/libm/mathfp/Makefile.inc
index 739e41f16d0b..f1e6da83211a 100644
--- a/newlib/libm/mathfp/Makefile.inc
+++ b/newlib/libm/mathfp/Makefile.inc
@@ -1,3 +1,46 @@
+%C%_src = \
+	%D%/s_acos.c %D%/s_frexp.c %D%/s_mathcnst.c \
+	%D%/s_cos.c %D%/s_sinh.c \
+	%D%/s_asin.c\
+	%D%/s_asine.c %D%/s_cosh.c %D%/s_ispos.c %D%/s_numtest.c %D%/s_sqrt.c \
+	%D%/s_exp.c %D%/s_ldexp.c %D%/s_pow.c %D%/s_tan.c \
+	%D%/s_atan.c \
+	%D%/s_atan2.c %D%/s_fabs.c %D%/s_log.c %D%/s_tanh.c \
+	%D%/s_log10.c %D%/s_sin.c \
+	%D%/s_floor.c %D%/s_sine.c \
+	%D%/s_sincos.c \
+	%D%/s_atangent.c %D%/s_logarithm.c \
+	%D%/s_sineh.c \
+	%D%/s_ceil.c \
+	%D%/e_acosh.c %D%/e_atanh.c %D%/e_remainder.c \
+	%D%/er_gamma.c %D%/er_lgamma.c \
+	%D%/s_erf.c %D%/e_j0.c %D%/e_j1.c %D%/w_jn.c %D%/e_hypot.c \
+	%D%/w_cabs.c %D%/w_drem.c %D%/s_asinh.c %D%/s_fmod.c \
+	%D%/e_scalb.c %D%/s_signif.c \
+	%D%/s_exp2.c %D%/s_tgamma.c
+
+%C%_fsrc = \
+	%D%/sf_ceil.c \
+	%D%/sf_acos.c %D%/sf_frexp.c \
+	%D%/sf_cos.c %D%/sf_sinh.c \
+	%D%/sf_asine.c %D%/sf_cosh.c %D%/sf_ispos.c %D%/sf_numtest.c %D%/sf_sqrt.c \
+	%D%/sf_asin.c \
+	%D%/sf_exp.c %D%/sf_ldexp.c %D%/sf_pow.c %D%/sf_tan.c \
+	%D%/sf_atan2.c %D%/sf_fabs.c %D%/sf_tanh.c \
+	%D%/sf_atan.c %D%/sf_log10.c %D%/sf_sin.c\
+	%D%/sf_floor.c %D%/sf_sine.c \
+	%D%/sf_sincos.c \
+	%D%/sf_atangent.c %D%/sf_logarithm.c %D%/sf_sineh.c \
+	%D%/sf_log.c %D%/sf_sineh.c \
+	%D%/ef_acosh.c %D%/ef_atanh.c %D%/ef_remainder.c \
+	%D%/erf_gamma.c %D%/erf_lgamma.c \
+	%D%/sf_erf.c %D%/ef_j0.c %D%/ef_j1.c %D%/wf_jn.c %D%/ef_hypot.c \
+	%D%/wf_cabs.c %D%/wf_drem.c %D%/sf_asinh.c %D%/sf_fmod.c \
+	%D%/ef_scalb.c %D%/sf_signif.c \
+	%D%/sf_exp2.c %D%/sf_tgamma.c
+
+libm_a_SOURCES += $(%C%_src) $(%C%_fsrc)
+
 LIBM_CHEWOUT_FILES += \
 	%D%/e_acosh.def \
 	%D%/e_atanh.def \
-- 
2.34.1


  parent reply	other threads:[~2022-02-17  4:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-12 20:34 [PATCH] " Mike Frysinger
2022-02-16  8:50 ` [HEADSUP] " Corinna Vinschen
2022-02-16  9:40   ` Sebastian Huber
2022-02-16 10:48     ` Corinna Vinschen
2022-02-17  4:38   ` Mike Frysinger
2022-02-17  4:42 ` Mike Frysinger [this message]
2022-02-17 12:08   ` [PATCH v2] " Corinna Vinschen
2022-02-21 11:20   ` Corinna Vinschen
2022-02-21 18:00     ` Mike Frysinger
2022-02-21 18:04       ` Jon Turney
2022-02-21 18:30         ` Mike Frysinger
2022-02-21 19:12           ` Jon Turney
2022-02-21 19:24             ` Corinna Vinschen
2022-02-21 20:30               ` Mike Frysinger
2022-02-21 20:31         ` Mike Frysinger
2022-02-21 18:28       ` Mike Frysinger
2022-02-21 20:43     ` [PATCH] newlib: libm: workaround ar duplicate member behavior Mike Frysinger
2022-02-21 20:51       ` Joel Sherrill
2022-02-21 22:12         ` Mike Frysinger
2022-02-21 22:14           ` Joel Sherrill
2022-02-22  0:21       ` [PATCH v2] " Mike Frysinger
2022-02-22 11:31         ` Corinna Vinschen
2022-02-22 12:34           ` Jon Turney
2022-02-22 17:17             ` Mike Frysinger
2022-02-23  8:56               ` 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=20220217044256.5483-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).