Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2022-02-10 08:50:36 +0300
committerMike Frysinger <vapier@gentoo.org>2022-02-18 04:56:32 +0300
commitac9f8c46b1bc37df1a4209d9bff6e911f7d6b281 (patch)
tree3fc189353f8f577e2825e86d7c7893c3ed690ec2 /newlib/Makefile.am
parentf2b053f49ed2bd7b4da8cf4ed3a608dc2f425c2b (diff)
newlib: libm: merge build up a directory
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. One thing to note is that this will require GNU Make because of: libm_a_CFLAGS = ... $(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. 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-<source>.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. 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. 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.
Diffstat (limited to 'newlib/Makefile.am')
-rw-r--r--newlib/Makefile.am39
1 files changed, 20 insertions, 19 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 = \
FLAGS_TO_PASS=$(AM_MAKEFLAGS)
-SUBDIRS = libc libm .
+SUBDIRS = libc .
tooldir = $(exec_prefix)/$(host_alias)
toollibdir = $(tooldir)/lib$(MULTISUBDIR)
+AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
AR_FLAGS = rc
noinst_DATA += stmp-targ-include
@@ -88,19 +89,19 @@ CLEANFILES += 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 = \
- $(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
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
-libm.a: libm/libm.a
- rm -f $@
- ln $< $@ >/dev/null 2>/dev/null || cp $< $@
-
-libm/libm.a: ; @true
+libm_a_SOURCES =
+libm_a_CFLAGS = $(AM_CFLAGS) $(libm_a_CFLAGS_$(subst /,_,$(@D))) $(libm_a_CFLAGS_$(subst /,_,$(@D)_$(<F)))
+libm_a_CCASFLAGS = $(AM_CCASFLAGS) $(libm_a_CCASFLAGS_$(subst /,_,$(@D))) $(libm_a_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
+libm_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libm/common $(libm_a_CPPFLAGS_$(subst /,_,$(@D))) $(libm_a_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
+$(libm_a_OBJECTS): stmp-targ-include
if HAVE_MULTISUBDIR
$(BUILD_MULTISUBDIR):