[PATCH] newlib: powerpc: move libc machine list to Makefile

Mike Frysinger vapier@gentoo.org
Sun Jan 23 05:41:03 GMT 2022


This makes the makefile logic a bit cleaner so we don't have two
files maintaining lists of sources & objects.  Since the logic is
tied to cpu capabilities, past those boolean settings down from
the configure logic to the makefile logic.

This will also make it easier to throw away the configure script
in a follow up commit and just keep the makefile.
---
 newlib/libc/machine/powerpc/Makefile.am  | 35 +++++++++++++++++++--
 newlib/libc/machine/powerpc/Makefile.in  | 34 +++++++++++++++++++--
 newlib/libc/machine/powerpc/configure    | 39 +++++++++++++++++++-----
 newlib/libc/machine/powerpc/configure.ac | 14 ++++-----
 4 files changed, 101 insertions(+), 21 deletions(-)

diff --git a/newlib/libc/machine/powerpc/Makefile.am b/newlib/libc/machine/powerpc/Makefile.am
index e8a0f8fa012d..cb046334efff 100644
--- a/newlib/libc/machine/powerpc/Makefile.am
+++ b/newlib/libc/machine/powerpc/Makefile.am
@@ -10,8 +10,39 @@ AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
 
 lib_a_SOURCES = setjmp.S
 lib_a_CFLAGS=$(AM_CFLAGS)
-lib_a_LIBADD = @extra_objs@
-lib_a_DEPENDENCIES = @extra_objs@
+lib_a_LIBADD =
+if HAVE_POWERPC_ALTIVEC
+lib_a_LIBADD += \
+	lib_a-vfprintf.o \
+	lib_a-vfscanf.o \
+	lib_a-vec_malloc.o \
+	lib_a-vec_calloc.o \
+	lib_a-vec_free.o \
+	lib_a-vec_realloc.o \
+	lib_a-vec_mallocr.o \
+	lib_a-vec_callocr.o \
+	lib_a-vec_reallocr.o
+endif
+if HAVE_POWERPC_SPE
+lib_a_LIBADD += \
+	lib_a-atosfix16.o \
+	lib_a-atosfix32.o \
+	lib_a-atosfix64.o \
+	lib_a-atoufix16.o \
+	lib_a-atoufix32.o \
+	lib_a-atoufix64.o \
+	lib_a-simdldtoa.o \
+	lib_a-strtosfix16.o \
+	lib_a-strtosfix32.o \
+	lib_a-strtosfix64.o \
+	lib_a-strtoufix16.o \
+	lib_a-strtoufix32.o \
+	lib_a-strtoufix64.o \
+	lib_a-ufix64toa.o \
+	lib_a-vfprintf.o \
+	lib_a-vfscanf.o
+endif
+lib_a_DEPENDENCIES = $(lib_a_LIBADD)
 EXTRA_lib_a_SOURCES = \
   vfprintf.c vfscanf.c \
   vec_malloc.c vec_calloc.c vec_free.c vec_realloc.c vec_mallocr.c \
diff --git a/newlib/libc/machine/powerpc/configure.ac b/newlib/libc/machine/powerpc/configure.ac
index e86ac6efbc90..fca0dd19737d 100644
--- a/newlib/libc/machine/powerpc/configure.ac
+++ b/newlib/libc/machine/powerpc/configure.ac
@@ -9,16 +9,14 @@ AC_CONFIG_AUX_DIR(../../../..)
 
 NEWLIB_CONFIGURE(../../..)
 
-extra_objs=
+HAVE_POWERPC_ALTIVEC=no
+HAVE_POWERPC_SPE=no
 case $host in
-  powerpc*-*altivec*)
-	extra_objs="lib_a-vfprintf.o lib_a-vfscanf.o lib_a-vec_malloc.o lib_a-vec_calloc.o lib_a-vec_free.o lib_a-vec_realloc.o lib_a-vec_mallocr.o lib_a-vec_callocr.o lib_a-vec_reallocr.o"
-	;;
-  powerpc*-*spe*)
-	extra_objs="lib_a-atosfix16.o lib_a-atosfix32.o lib_a-atosfix64.o lib_a-atoufix16.o lib_a-atoufix32.o lib_a-atoufix64.o lib_a-simdldtoa.o lib_a-strtosfix16.o lib_a-strtosfix32.o lib_a-strtosfix64.o lib_a-strtoufix16.o lib_a-strtoufix32.o lib_a-strtoufix64.o lib_a-ufix64toa.o lib_a-vfprintf.o lib_a-vfscanf.o"
-	;;
+  powerpc*-*altivec*) HAVE_POWERPC_ALTIVEC=yes ;;
+  powerpc*-*spe*) HAVE_POWERPC_SPE=yes ;;
 esac
-AC_SUBST(extra_objs)
+AM_CONDITIONAL(HAVE_POWERPC_ALTIVEC, [test "$HAVE_POWERPC_ALTIVEC" = yes])
+AM_CONDITIONAL(HAVE_POWERPC_SPE, [test "$HAVE_POWERPC_SPE" = yes])
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
-- 
2.34.1



More information about the Newlib mailing list