public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] newlib: simplify nds32 automake checks
@ 2022-02-07  6:18 Mike Frysinger
  2022-02-08  9:27 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2022-02-07  6:18 UTC (permalink / raw)
  To: newlib

This code is a bit more convoluted than it needs to be.  GPR_SOURCES
is never set to anything, and the automake checks use negative logic
to add the SP & DP source files to dedicated variables that are only
expanded once.  Get rid of the unused variable, use normal boolean
logic, and collapse the source settings into a single variable.
---
 newlib/libm/machine/nds32/Makefile.am | 17 +++++++----------
 newlib/libm/machine/nds32/Makefile.in | 18 ++++++++----------
 2 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/newlib/libm/machine/nds32/Makefile.am b/newlib/libm/machine/nds32/Makefile.am
index 6e63d1aa8a36..8ce9350c4fe0 100644
--- a/newlib/libm/machine/nds32/Makefile.am
+++ b/newlib/libm/machine/nds32/Makefile.am
@@ -3,21 +3,18 @@
 AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) \
 	$(CROSS_CFLAGS) $(TARGET_CFLAGS)
 
-if HAS_NDS32_FPU_SP_FALSE
-GPR_SOURCES =
-else
-FPU_SP_SOURCES = wf_sqrt.S
-endif
+src =
 
-if HAS_NDS32_FPU_DP_FALSE
-else
-FPU_DP_SOURCES = w_sqrt.S
+if HAS_NDS32_FPU_SP
+src += wf_sqrt.S
 endif
 
-LIB_SOURCES = $(GPR_SOURCES) $(FPU_SP_SOURCES) $(FPU_DP_SOURCES)
+if HAS_NDS32_FPU_DP
+src += w_sqrt.S
+endif
 
 noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
+lib_a_SOURCES = $(src)
 lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA =
 
diff --git a/newlib/libm/machine/nds32/Makefile.in b/newlib/libm/machine/nds32/Makefile.in
index f26a071c59b8..d2febe5e7b31 100644
--- a/newlib/libm/machine/nds32/Makefile.in
+++ b/newlib/libm/machine/nds32/Makefile.in
@@ -89,6 +89,8 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
+@HAS_NDS32_FPU_SP_TRUE@am__append_1 = wf_sqrt.S
+@HAS_NDS32_FPU_DP_TRUE@am__append_2 = w_sqrt.S
 subdir = machine/nds32
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
@@ -116,11 +118,10 @@ am__v_AR_0 = @echo "  AR      " $@;
 am__v_AR_1 = 
 lib_a_AR = $(AR) $(ARFLAGS)
 lib_a_LIBADD =
-am__objects_1 =
-@HAS_NDS32_FPU_SP_TRUE@am__objects_2 = wf_sqrt.$(OBJEXT)
-@HAS_NDS32_FPU_DP_TRUE@am__objects_3 = w_sqrt.$(OBJEXT)
-am__objects_4 = $(am__objects_1) $(am__objects_2) $(am__objects_3)
-am_lib_a_OBJECTS = $(am__objects_4)
+@HAS_NDS32_FPU_SP_TRUE@am__objects_1 = wf_sqrt.$(OBJEXT)
+@HAS_NDS32_FPU_DP_TRUE@am__objects_2 = w_sqrt.$(OBJEXT)
+am__objects_3 = $(am__objects_1) $(am__objects_2)
+am_lib_a_OBJECTS = $(am__objects_3)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -328,12 +329,9 @@ top_srcdir = @top_srcdir@
 AM_CPPFLAGS = -I $(abs_newlib_basedir)/libm/common $(NEWLIB_CFLAGS) \
 	$(CROSS_CFLAGS) $(TARGET_CFLAGS)
 
-@HAS_NDS32_FPU_SP_FALSE@GPR_SOURCES = 
-@HAS_NDS32_FPU_SP_TRUE@FPU_SP_SOURCES = wf_sqrt.S
-@HAS_NDS32_FPU_DP_TRUE@FPU_DP_SOURCES = w_sqrt.S
-LIB_SOURCES = $(GPR_SOURCES) $(FPU_SP_SOURCES) $(FPU_DP_SOURCES)
+src = $(am__append_1) $(am__append_2)
 noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(LIB_SOURCES)
+lib_a_SOURCES = $(src)
 lib_a_CFLAGS = $(AM_CFLAGS)
 noinst_DATA = 
 all: all-am
-- 
2.34.1


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

* Re: [PATCH] newlib: simplify nds32 automake checks
  2022-02-07  6:18 [PATCH] newlib: simplify nds32 automake checks Mike Frysinger
@ 2022-02-08  9:27 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2022-02-08  9:27 UTC (permalink / raw)
  To: newlib

On Feb  7 01:18, Mike Frysinger wrote:
> This code is a bit more convoluted than it needs to be.  GPR_SOURCES
> is never set to anything, and the automake checks use negative logic
> to add the SP & DP source files to dedicated variables that are only
> expanded once.  Get rid of the unused variable, use normal boolean
> logic, and collapse the source settings into a single variable.
> ---
>  newlib/libm/machine/nds32/Makefile.am | 17 +++++++----------
>  newlib/libm/machine/nds32/Makefile.in | 18 ++++++++----------
>  2 files changed, 15 insertions(+), 20 deletions(-)

LGTM


Thanks,
Corinna


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

end of thread, other threads:[~2022-02-08  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07  6:18 [PATCH] newlib: simplify nds32 automake checks Mike Frysinger
2022-02-08  9:27 ` 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).