[newlib-cygwin] newlib: powerpc: move libc machine list to Makefile

Michael Frysinger vapier@sourceware.org
Tue Jan 25 01:00:37 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5dc4e2089afdc0f21792e32bb4ba408e001106d5

commit 5dc4e2089afdc0f21792e32bb4ba408e001106d5
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun Jan 23 00:19:08 2022 -0500

    newlib: powerpc: move libc machine list to Makefile
    
    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.

Diff:
---
 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 e8a0f8fa0..cb046334e 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/Makefile.in b/newlib/libc/machine/powerpc/Makefile.in
index a4de0cd18..b2a18bb70 100644
--- a/newlib/libc/machine/powerpc/Makefile.in
+++ b/newlib/libc/machine/powerpc/Makefile.in
@@ -88,6 +88,35 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
+@HAVE_POWERPC_ALTIVEC_TRUE@am__append_1 = \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vfprintf.o \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vfscanf.o \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vec_malloc.o \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vec_calloc.o \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vec_free.o \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vec_realloc.o \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vec_mallocr.o \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vec_callocr.o \
+@HAVE_POWERPC_ALTIVEC_TRUE@	lib_a-vec_reallocr.o
+
+@HAVE_POWERPC_SPE_TRUE@am__append_2 = \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-atosfix16.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-atosfix32.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-atosfix64.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-atoufix16.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-atoufix32.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-atoufix64.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-simdldtoa.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-strtosfix16.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-strtosfix32.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-strtosfix64.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-strtoufix16.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-strtoufix32.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-strtoufix64.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-ufix64toa.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-vfprintf.o \
+@HAVE_POWERPC_SPE_TRUE@	lib_a-vfscanf.o
+
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../../../../config/depstand.m4 \
@@ -245,7 +274,6 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
-extra_objs = @extra_objs@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -287,8 +315,8 @@ noinst_LIBRARIES = lib.a
 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 = $(am__append_1) $(am__append_2)
+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 b/newlib/libc/machine/powerpc/configure
index cbb87a892..6c88ac582 100755
--- a/newlib/libc/machine/powerpc/configure
+++ b/newlib/libc/machine/powerpc/configure
@@ -584,7 +584,10 @@ PACKAGE_URL=''
 ac_unique_file="setjmp.S"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
-extra_objs
+HAVE_POWERPC_SPE_FALSE
+HAVE_POWERPC_SPE_TRUE
+HAVE_POWERPC_ALTIVEC_FALSE
+HAVE_POWERPC_ALTIVEC_TRUE
 sys_dir
 shared_machine_dir
 machine_dir
@@ -3607,15 +3610,27 @@ OBJEXT=${oext}
 
 
 
-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
+ if test "$HAVE_POWERPC_ALTIVEC" = yes; then
+  HAVE_POWERPC_ALTIVEC_TRUE=
+  HAVE_POWERPC_ALTIVEC_FALSE='#'
+else
+  HAVE_POWERPC_ALTIVEC_TRUE='#'
+  HAVE_POWERPC_ALTIVEC_FALSE=
+fi
+
+ if test "$HAVE_POWERPC_SPE" = yes; then
+  HAVE_POWERPC_SPE_TRUE=
+  HAVE_POWERPC_SPE_FALSE='#'
+else
+  HAVE_POWERPC_SPE_TRUE='#'
+  HAVE_POWERPC_SPE_FALSE=
+fi
 
 
 ac_config_files="$ac_config_files Makefile"
@@ -3818,6 +3833,14 @@ if test -z "${USE_LIBTOOL_TRUE}" && test -z "${USE_LIBTOOL_FALSE}"; then
   as_fn_error $? "conditional \"USE_LIBTOOL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${HAVE_POWERPC_ALTIVEC_TRUE}" && test -z "${HAVE_POWERPC_ALTIVEC_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_POWERPC_ALTIVEC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_POWERPC_SPE_TRUE}" && test -z "${HAVE_POWERPC_SPE_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_POWERPC_SPE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
diff --git a/newlib/libc/machine/powerpc/configure.ac b/newlib/libc/machine/powerpc/configure.ac
index e86ac6efb..fca0dd197 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


More information about the Newlib-cvs mailing list