public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] newlib: separate out libg from libc
@ 2022-02-17  4:45 Mike Frysinger
  2022-02-17 14:08 ` Corinna Vinschen
  2022-02-24  3:06 ` [PATCH/committed] newlib: fix multilib libg.a parallel builds Mike Frysinger
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Frysinger @ 2022-02-17  4:45 UTC (permalink / raw)
  To: newlib

Make this a separate target from libc so that we can migrate libc over
to automake more easily.  Having it integrated into the libc target is
difficult to handle when using automake rules which expect a one-to-one
mapping between names & inputs.
---
 newlib/Makefile.am | 13 +++++++++----
 newlib/Makefile.in | 21 +++++++++++----------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 6d3b60b330b0..a0f76865e640 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -4,6 +4,7 @@ AUTOMAKE_OPTIONS = dejagnu
 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 
 # Variables that will accumulate in subdirs.
+CLEANFILES =
 PHONY =
 SUFFIXES =
 info_TEXINFOS =
@@ -70,6 +71,7 @@ noinst_DATA += stmp-targ-include
 
 toollib_LIBRARIES = libm.a \
 	libc.a
+noinst_DATA += libg.a
 if HAVE_MULTISUBDIR
 BUILD_MULTISUBDIR = $(builddir)$(MULTISUBDIR)
 if HAVE_CRT0
@@ -80,6 +82,8 @@ endif
 
 toollib_DATA = $(CRT0) $(CRT1)
 
+CLEANFILES += libg.a
+
 # The functions ldexp, frexp and modf are traditionally supplied in
 # both libc.a and libm.a.  We build them in libm.a and copy them over,
 # along with some required supporting routines.
@@ -99,18 +103,20 @@ MATHOBJS_IN_LIBC = \
 	$(lpfx)s_copysign.o $(lpfx)sf_copysign.o
 
 libc.a: libc/libc.a libm.a
-	rm -rf libc.a libg.a tmp
+	rm -rf libc.a tmp
 	mkdir tmp
 	cd tmp; \
 	 $(AR) x ../libm.a $(MATHOBJS_IN_LIBC) ; \
 	 $(AR) x ../libc/libc.a ; \
 	 $(AR) $(AR_FLAGS) ../$@ *.o
 	$(RANLIB) libc.a
-	ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a
 	rm -rf tmp
 
 libc/libc.a: ; @true
 
+libg.a: libc.a
+	ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a
+
 libm.a: libm/libm.a
 	rm -f $@
 	ln $< $@ >/dev/null 2>/dev/null || cp $< $@
@@ -247,13 +253,12 @@ stmp-targ-include: config.status
 	$(MAKE) targ-include/newlib.h
 	touch $@
 
-CLEANFILES = stmp-targ-include
+CLEANFILES += stmp-targ-include
 
 ## We hook install-multi because this Makefile doesn't have any exec targets,
 ## only data targets.  If that ever changes, this should be removed and the
 ## install-exec-local in ../multilib.am will kick in.
 install-data-local: install-toollibLIBRARIES install-multi
-	rm -f $(DESTDIR)$(toollibdir)/libg.a
 	ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a >/dev/null 2>/dev/null || cp $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
 	-if [ -z "$(MULTISUBDIR)" ]; then \
 	  $(mkinstalldirs) $(DESTDIR)$(tooldir)/include; \
-- 
2.34.1


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

* Re: [PATCH] newlib: separate out libg from libc
  2022-02-17  4:45 [PATCH] newlib: separate out libg from libc Mike Frysinger
@ 2022-02-17 14:08 ` Corinna Vinschen
  2022-02-24  3:06 ` [PATCH/committed] newlib: fix multilib libg.a parallel builds Mike Frysinger
  1 sibling, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2022-02-17 14:08 UTC (permalink / raw)
  To: newlib

On Feb 16 23:45, Mike Frysinger wrote:
> Make this a separate target from libc so that we can migrate libc over
> to automake more easily.  Having it integrated into the libc target is
> difficult to handle when using automake rules which expect a one-to-one
> mapping between names & inputs.
> ---
>  newlib/Makefile.am | 13 +++++++++----
>  newlib/Makefile.in | 21 +++++++++++----------
>  2 files changed, 20 insertions(+), 14 deletions(-)

LGTM,
Corinna


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

* [PATCH/committed] newlib: fix multilib libg.a parallel builds
  2022-02-17  4:45 [PATCH] newlib: separate out libg from libc Mike Frysinger
  2022-02-17 14:08 ` Corinna Vinschen
@ 2022-02-24  3:06 ` Mike Frysinger
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2022-02-24  3:06 UTC (permalink / raw)
  To: newlib

I split libg.a out into a sep target from libc.a for the main dir in
commit f2b053f49ed2bd7b4da8cf4ed3a608dc2f425c2b ("newlib: separate out
libg from libc"), but missed the multilib dirs.  That leads to an
uncommon parallel build failure:
- libc.a rule runs & finishes
- $(BUILD_MULTISUBDIR)/libc.a rule runs
  -> failure due to libg.a not yet existing
- libg.a rule runs & finishes

Split the multilib libg rule out from libc too so it can depend on the
main libg directly and avoid this race.
---
 newlib/Makefile.am | 8 +++++---
 newlib/Makefile.in | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 1a5123f0a4c6..0479ca4f5b61 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -161,10 +161,12 @@ $(BUILD_MULTISUBDIR)/crt0.o: $(CRT0_DIR)$(CRT0) $(BUILD_MULTISUBDIR)
 	ln $< $@ >/dev/null 2>/dev/null || cp $< $@
 
 $(BUILD_MULTISUBDIR)/libc.a: libc.a $(BUILD_MULTISUBDIR)
-	rm -f $@ $(BUILD_MULTISUBDIR)/libg.a
+	rm -f $@
+	ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+
+$(BUILD_MULTISUBDIR)/libg.a: libg.a ${BUILD_MULTISUBDIR}
+	rm -f $@
 	ln $< $@ >/dev/null 2>/dev/null || cp $< $@
-	ln libg.a $(BUILD_MULTISUBDIR)/libg.a >/dev/null 2>/dev/null || \
-	cp libg.a $(BUILD_MULTISUBDIR)/libg.a
 
 $(BUILD_MULTISUBDIR)/libm.a: libm.a $(BUILD_MULTISUBDIR)
 	rm -f $@
-- 
2.34.1


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

end of thread, other threads:[~2022-02-24  3:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17  4:45 [PATCH] newlib: separate out libg from libc Mike Frysinger
2022-02-17 14:08 ` Corinna Vinschen
2022-02-24  3:06 ` [PATCH/committed] newlib: fix multilib libg.a parallel builds Mike Frysinger

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