From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id 12A943858D20; Fri, 18 Feb 2022 02:41:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12A943858D20 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] newlib: libm: merge build up a directory X-Act-Checkin: newlib-cygwin X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: f2b053f49ed2bd7b4da8cf4ed3a608dc2f425c2b X-Git-Newrev: ac9f8c46b1bc37df1a4209d9bff6e911f7d6b281 Message-Id: <20220218024159.12A943858D20@sourceware.org> Date: Fri, 18 Feb 2022 02:41:59 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Feb 2022 02:41:59 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dac9f8c46b1b= c37df1a4209d9bff6e911f7d6b281 commit ac9f8c46b1bc37df1a4209d9bff6e911f7d6b281 Author: Mike Frysinger Date: Thu Feb 10 00:50:36 2022 -0500 newlib: libm: merge build up a directory =20 Convert all the libm/ subdir makes into the top-level Makefile. This allows us to build all of libm from the top Makefile without using any recursive make calls. This is faster and avoids the funky lib.a logic where we unpack subdir archives to repack into a single libm.a. The machine override logic is maintained though by way of Makefile include ordering, and source file accumulation in libm_a_SOURCES. =20 One thing to note is that this will require GNU Make because of: libm_a_CFLAGS =3D ... $(libm_a_CFLAGS_$(subst /,_,$(@D))) This was the only way I could find to supporting per-dir compiler settings, and I couldn't find a POSIX compatible way of transforming the variable content. I don't think this is a big deal as other Makefiles in the tree are using GNU Make-specific syntax, but I call this out as it's the only one so far in the new automake code that I've been writing. =20 Automake doesn't provide precise control over the output object names (by design). This is fine by default as we get consistent names in all the subdirs: libm_a-.o. But this relies on using the same set of compiler flags for all objects. We currently compile libm/common/ with different optimizations than the rest. =20 If we want to compile objects differently, we can create an intermediate archive with the subset of objects with unique flags, and then add those objects to the main archive. But Automake will use a different prefix for the objects, and thus we can't rely on ordering to override. =20 But if we leverage $@, we can turn Automake's CFLAGS into a multiplex on a per-dir (and even per-file if we wanted) basis. Unfortunately, since $@ contains /, Automake complains it's an invalid name. While GNU Make supports this, it's a POSIX extension, so Automake flags it. Using $(subst) avoids the Automake warning to get a POSIX compliant name, albeit with a GNU Make extension. Diff: --- newlib/Makefile.am | 39 +- newlib/Makefile.in | 7756 ++++++++++++++++++++++++++= +++- newlib/configure | 202 +- newlib/libm/Makefile.am | 28 - newlib/libm/Makefile.in | 594 --- newlib/libm/Makefile.inc | 45 +- newlib/libm/acinclude.m4 | 31 +- newlib/libm/common/Makefile.am | 51 - newlib/libm/common/Makefile.in | 1553 ------ newlib/libm/common/Makefile.inc | 79 + newlib/libm/complex/Makefile.am | 29 - newlib/libm/complex/Makefile.in | 1007 ---- newlib/libm/complex/Makefile.inc | 23 + newlib/libm/fenv/Makefile.am | 15 - newlib/libm/fenv/Makefile.in | 610 --- newlib/libm/fenv/Makefile.inc | 7 + newlib/libm/machine/aarch64/Makefile.am | 51 - newlib/libm/machine/aarch64/Makefile.in | 840 ---- newlib/libm/machine/aarch64/Makefile.inc | 45 + newlib/libm/machine/arm/Makefile.am | 41 - newlib/libm/machine/arm/Makefile.in | 758 --- newlib/libm/machine/arm/Makefile.inc | 34 + newlib/libm/machine/i386/Makefile.am | 21 - newlib/libm/machine/i386/Makefile.in | 789 --- newlib/libm/machine/i386/Makefile.inc | 12 + newlib/libm/machine/mips/Makefile.am | 22 - newlib/libm/machine/mips/Makefile.in | 610 --- newlib/libm/machine/mips/Makefile.inc | 10 + newlib/libm/machine/nds32/Makefile.am | 17 - newlib/libm/machine/nds32/Makefile.in | 531 -- newlib/libm/machine/nds32/Makefile.inc | 10 + newlib/libm/machine/powerpc/Makefile.am | 12 - newlib/libm/machine/powerpc/Makefile.in | 606 --- newlib/libm/machine/powerpc/Makefile.inc | 6 + newlib/libm/machine/pru/Makefile.am | 11 - newlib/libm/machine/pru/Makefile.in | 592 --- newlib/libm/machine/pru/Makefile.inc | 5 + newlib/libm/machine/riscv/Makefile.am | 24 - newlib/libm/machine/riscv/Makefile.in | 801 --- newlib/libm/machine/riscv/Makefile.inc | 18 + newlib/libm/machine/sparc/Makefile.am | 13 - newlib/libm/machine/sparc/Makefile.in | 607 --- newlib/libm/machine/sparc/Makefile.inc | 7 + newlib/libm/machine/spu/Makefile.am | 31 - newlib/libm/machine/spu/Makefile.in | 1360 ------ newlib/libm/machine/spu/Makefile.inc | 25 + newlib/libm/machine/x86_64/Makefile.am | 12 - newlib/libm/machine/x86_64/Makefile.in | 606 --- newlib/libm/machine/x86_64/Makefile.inc | 6 + newlib/libm/math/Makefile.am | 60 - newlib/libm/math/Makefile.in | 1453 ------ newlib/libm/math/Makefile.inc | 53 + newlib/libm/mathfp/Makefile.am | 50 - newlib/libm/mathfp/Makefile.in | 1172 ----- newlib/libm/mathfp/Makefile.inc | 43 + 55 files changed, 8090 insertions(+), 15343 deletions(-) diff --git a/newlib/Makefile.am b/newlib/Makefile.am index 3e4b824d7..80256952d 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -60,11 +60,12 @@ AM_MAKEFLAGS =3D \ =20 FLAGS_TO_PASS=3D$(AM_MAKEFLAGS) =20 -SUBDIRS =3D libc libm . +SUBDIRS =3D libc . =20 tooldir =3D $(exec_prefix)/$(host_alias) toollibdir =3D $(tooldir)/lib$(MULTISUBDIR) =20 +AM_CPPFLAGS =3D $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) AR_FLAGS =3D rc =20 noinst_DATA +=3D stmp-targ-include @@ -88,19 +89,19 @@ CLEANFILES +=3D libg.a # both libc.a and libm.a. We build them in libm.a and copy them over, # along with some required supporting routines. MATHOBJS_IN_LIBC =3D \ - $(lpfx)s_fpclassify.o $(lpfx)sf_fpclassify.o \ - $(lpfx)s_isinf.o $(lpfx)sf_isinf.o \ - $(lpfx)s_isnan.o $(lpfx)sf_isnan.o \ - $(lpfx)s_isinfd.o $(lpfx)sf_isinff.o \ - $(lpfx)s_isnand.o $(lpfx)sf_isnanf.o \ - $(lpfx)s_nan.o $(lpfx)sf_nan.o \ - $(lpfx)s_ldexp.o $(lpfx)sf_ldexp.o \ - $(lpfx)s_frexp.o $(lpfx)sf_frexp.o $(lpfx)frexpl.o \ - $(lpfx)s_modf.o \ - $(lpfx)sf_modf.o $(lpfx)s_scalbn.o \ - $(lpfx)sf_scalbn.o \ - $(lpfx)s_finite.o $(lpfx)sf_finite.o \ - $(lpfx)s_copysign.o $(lpfx)sf_copysign.o + libm_a-s_fpclassify.o libm_a-sf_fpclassify.o \ + libm_a-s_isinf.o libm_a-sf_isinf.o \ + libm_a-s_isnan.o libm_a-sf_isnan.o \ + libm_a-s_isinfd.o libm_a-sf_isinff.o \ + libm_a-s_isnand.o libm_a-sf_isnanf.o \ + libm_a-s_nan.o libm_a-sf_nan.o \ + libm_a-s_ldexp.o libm_a-sf_ldexp.o \ + libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-frexpl.o \ + libm_a-s_modf.o \ + libm_a-sf_modf.o libm_a-s_scalbn.o \ + libm_a-sf_scalbn.o \ + libm_a-s_finite.o libm_a-sf_finite.o \ + libm_a-s_copysign.o libm_a-sf_copysign.o =20 libc.a: libc/libc.a libm.a rm -rf libc.a tmp @@ -117,11 +118,11 @@ libc/libc.a: ; @true libg.a: libc.a $(AM_V_GEN)ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a =20 -libm.a: libm/libm.a - rm -f $@ - ln $< $@ >/dev/null 2>/dev/null || cp $< $@ - -libm/libm.a: ; @true +libm_a_SOURCES =3D +libm_a_CFLAGS =3D $(AM_CFLAGS) $(libm_a_CFLAGS_$(subst /,_,$(@D))) $(libm_= a_CFLAGS_$(subst /,_,$(@D)_$( /dev/null am__v_texidevnull_1 =3D=20 -am__dirstamp =3D $(am__leading_dot)dirstamp INFO_DEPS =3D $(srcdir)/libc/libc.info $(srcdir)/libm/libm.info am__TEXINFO_TEX_DIR =3D $(srcdir)/../texinfo DVIS =3D libc/libc.dvi libm/libm.dvi @@ -351,8 +1204,6 @@ INSTALL_PROGRAM =3D @INSTALL_PROGRAM@ INSTALL_SCRIPT =3D @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM =3D @INSTALL_STRIP_PROGRAM@ LDFLAGS =3D @LDFLAGS@ -LIBM_MACHINE_DIR =3D @LIBM_MACHINE_DIR@ -LIBM_MACHINE_LIB =3D @LIBM_MACHINE_LIB@ LIBOBJS =3D @LIBOBJS@ LIBS =3D @LIBS@ LTLIBOBJS =3D @LTLIBOBJS@ @@ -500,9 +1351,10 @@ AM_MAKEFLAGS =3D \ "DESTDIR=3D$(DESTDIR)" =20 FLAGS_TO_PASS =3D $(AM_MAKEFLAGS) -SUBDIRS =3D libc libm . +SUBDIRS =3D libc . tooldir =3D $(exec_prefix)/$(host_alias) toollibdir =3D $(tooldir)/lib$(MULTISUBDIR) +AM_CPPFLAGS =3D $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) AR_FLAGS =3D rc toollib_LIBRARIES =3D libm.a \ libc.a @@ -514,20 +1366,30 @@ toollib_DATA =3D $(CRT0) $(CRT1) # both libc.a and libm.a. We build them in libm.a and copy them over, # along with some required supporting routines. MATHOBJS_IN_LIBC =3D \ - $(lpfx)s_fpclassify.o $(lpfx)sf_fpclassify.o \ - $(lpfx)s_isinf.o $(lpfx)sf_isinf.o \ - $(lpfx)s_isnan.o $(lpfx)sf_isnan.o \ - $(lpfx)s_isinfd.o $(lpfx)sf_isinff.o \ - $(lpfx)s_isnand.o $(lpfx)sf_isnanf.o \ - $(lpfx)s_nan.o $(lpfx)sf_nan.o \ - $(lpfx)s_ldexp.o $(lpfx)sf_ldexp.o \ - $(lpfx)s_frexp.o $(lpfx)sf_frexp.o $(lpfx)frexpl.o \ - $(lpfx)s_modf.o \ - $(lpfx)sf_modf.o $(lpfx)s_scalbn.o \ - $(lpfx)sf_scalbn.o \ - $(lpfx)s_finite.o $(lpfx)sf_finite.o \ - $(lpfx)s_copysign.o $(lpfx)sf_copysign.o - + libm_a-s_fpclassify.o libm_a-sf_fpclassify.o \ + libm_a-s_isinf.o libm_a-sf_isinf.o \ + libm_a-s_isnan.o libm_a-sf_isnan.o \ + libm_a-s_isinfd.o libm_a-sf_isinff.o \ + libm_a-s_isnand.o libm_a-sf_isnanf.o \ + libm_a-s_nan.o libm_a-sf_nan.o \ + libm_a-s_ldexp.o libm_a-sf_ldexp.o \ + libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-frexpl.o \ + libm_a-s_modf.o \ + libm_a-sf_modf.o libm_a-s_scalbn.o \ + libm_a-sf_scalbn.o \ + libm_a-s_finite.o libm_a-sf_finite.o \ + libm_a-s_copysign.o libm_a-sf_copysign.o + +libm_a_SOURCES =3D $(am__append_6) $(am__append_9) $(libm_common_src) \ + $(libm_common_fsrc) $(am__append_12) $(libm_complex_src) \ + $(libm_complex_fsrc) $(libm_complex_lsrc) $(libm_fenv_src) \ + $(am__append_13) $(am__append_14) $(am__append_15) \ + $(am__append_16) $(am__append_19) $(am__append_20) \ + $(am__append_21) $(am__append_22) $(am__append_23) \ + $(am__append_24) $(am__append_25) +libm_a_CFLAGS =3D $(AM_CFLAGS) $(libm_a_CFLAGS_$(subst /,_,$(@D))) $(libm_= a_CFLAGS_$(subst /,_,$(@D)_$( libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_acos.$(OBJEXT): libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_frexp.$(OBJEXT): libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_mathcnst.$(OBJEXT): libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_cos.$(OBJEXT): libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_sinh.$(OBJEXT): libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_asin.$(OBJEXT): libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_asine.$(OBJEXT): libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_cosh.$(OBJEXT): libm/mathfp/$(am__dirstamp) +libm/mathfp/libm_a-s_ispos.$(O[...] [diff truncated at 100000 bytes]