public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] newlib: powerpc: move libc machine list to Makefile
@ 2022-01-23  5:41 Mike Frysinger
  2022-01-24 16:41 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2022-01-23  5:41 UTC (permalink / raw)
  To: newlib

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] newlib: powerpc: move libc machine list to Makefile
  2022-01-23  5:41 [PATCH] newlib: powerpc: move libc machine list to Makefile Mike Frysinger
@ 2022-01-24 16:41 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2022-01-24 16:41 UTC (permalink / raw)
  To: newlib

On Jan 23 00:41, Mike Frysinger wrote:
> 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(-)

LGTM

Thanks,
Corinna


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-24 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23  5:41 [PATCH] newlib: powerpc: move libc machine list to Makefile Mike Frysinger
2022-01-24 16:41 ` Corinna Vinschen

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