public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: newlib@sourceware.org
Subject: [PATCH] newlib: libm: merge machine/ trampoline up a level
Date: Sat, 22 Jan 2022 19:59:45 -0500	[thread overview]
Message-ID: <20220123005945.23393-1-vapier@gentoo.org> (raw)

The machine/{configure,Makefile} files exist only to fan out to the
specific machine/$arch/ subdir.  We already have all that same info
in the libm/ dir itself, so by moving the recursive configure and
make calls into it, we can cut off this logic entirely and save the
overhead.

For arches that don't have a machine subdir, it means they can skip
the logic entirely.
---
 newlib/libm/Makefile.am          |     5 +-
 newlib/libm/Makefile.in          |     6 +-
 newlib/libm/common/Makefile.in   |     1 +
 newlib/libm/complex/Makefile.in  |     1 +
 newlib/libm/configure            |    63 +-
 newlib/libm/configure.ac         |    23 +-
 newlib/libm/fenv/Makefile.in     |     1 +
 newlib/libm/machine/Makefile.am  |    26 -
 newlib/libm/machine/Makefile.in  |   650 --
 newlib/libm/machine/aclocal.m4   |  1178 ---
 newlib/libm/machine/configure    | 14383 -----------------------------
 newlib/libm/machine/configure.ac |    53 -
 newlib/libm/math/Makefile.in     |     1 +
 newlib/libm/mathfp/Makefile.in   |     1 +
 14 files changed, 91 insertions(+), 16301 deletions(-)
 delete mode 100644 newlib/libm/machine/Makefile.am
 delete mode 100644 newlib/libm/machine/Makefile.in
 delete mode 100644 newlib/libm/machine/aclocal.m4
 delete mode 100755 newlib/libm/machine/configure
 delete mode 100644 newlib/libm/machine/configure.ac

diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
index 8d355cbf6f69..5165ff34b9c0 100644
--- a/newlib/libm/Makefile.am
+++ b/newlib/libm/Makefile.am
@@ -6,7 +6,10 @@ else
 MATHDIR = math
 endif
 
-SUBDIRS = $(MATHDIR) common complex fenv machine
+SUBDIRS = $(MATHDIR) common complex fenv
+if HAVE_LIBM_MACHINE_DIR
+SUBDIRS += $(LIBM_MACHINE_DIR)
+endif
 
 libm_la_LDFLAGS = -Xcompiler -nostdlib
 
diff --git a/newlib/libm/configure.ac b/newlib/libm/configure.ac
index 3f9c01e1563f..500a542f64f1 100644
--- a/newlib/libm/configure.ac
+++ b/newlib/libm/configure.ac
@@ -34,13 +34,30 @@ AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
 
 LIBM_MACHINE_LIB=
 if test -n "${libm_machine_dir}"; then
+  case ${libm_machine_dir} in
+	aarch64) AC_CONFIG_SUBDIRS(machine/aarch64) ;;
+	arm) AC_CONFIG_SUBDIRS(machine/arm) ;;
+	i386) AC_CONFIG_SUBDIRS(machine/i386) ;;
+	nds32) AC_CONFIG_SUBDIRS(machine/nds32) ;;
+	pru) AC_CONFIG_SUBDIRS(machine/pru) ;;
+	spu) AC_CONFIG_SUBDIRS(machine/spu) ;;
+	riscv) AC_CONFIG_SUBDIRS(machine/riscv) ;;
+	x86_64) AC_CONFIG_SUBDIRS(machine/x86_64) ;;
+	powerpc) AC_CONFIG_SUBDIRS(machine/powerpc) ;;
+	sparc) AC_CONFIG_SUBDIRS(machine/sparc) ;;
+	mips) AC_CONFIG_SUBDIRS(machine/mips) ;;
+	*) AC_MSG_ERROR([unsupported libm_machine_dir "${libm_machine_dir}"]) ;;
+  esac
+
+  LIBM_MACHINE_DIR=machine/${libm_machine_dir}
   if test "${use_libtool}" = "yes"; then
-    LIBM_MACHINE_LIB=machine/${libm_machine_dir}/lib${libm_machine_dir}.${aext}
+    LIBM_MACHINE_LIB=${LIBM_MACHINE_DIR}/lib${libm_machine_dir}.${aext}
   else
-    LIBM_MACHINE_LIB=machine/lib.${aext}
+    LIBM_MACHINE_LIB=${LIBM_MACHINE_DIR}/lib.${aext}
   fi
 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([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile fenv/Makefile])
-- 
2.34.1


             reply	other threads:[~2022-01-23  0:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23  0:59 Mike Frysinger [this message]
2022-01-23  5:49 ` Mike Frysinger

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=20220123005945.23393-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).