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/libm/Makefile.inc
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/libm/Makefile.inc')
-rw-r--r--newlib/libm/Makefile.inc45
1 files changed, 42 insertions, 3 deletions
diff --git a/newlib/libm/Makefile.inc b/newlib/libm/Makefile.inc
index 7fdea0ca5..e43ec7855 100644
--- a/newlib/libm/Makefile.inc
+++ b/newlib/libm/Makefile.inc
@@ -34,14 +34,53 @@ man: %C%_man
$(INSTALL_DATA) %D%/*.3 $(DESTDIR)$(mandir)/man3/
install-man: %C%_install-man
-include %D%/common/Makefile.inc
-include %D%/complex/Makefile.inc
-include %D%/fenv/Makefile.inc
+## The order of includes is important for two reasons:
+## * The integrated documentation (chapter ordering).
+## * Object overridding -- machine dir must come last.
+## Do not change the order without considering the doc impact.
+
if NEWLIB_HW_FP
include %D%/mathfp/Makefile.inc
else
include %D%/math/Makefile.inc
endif
+include %D%/common/Makefile.inc
+include %D%/complex/Makefile.inc
+include %D%/fenv/Makefile.inc
+
+if HAVE_LIBM_MACHINE_AARCH64
+include %D%/machine/aarch64/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_ARM
+include %D%/machine/arm/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_I386
+include %D%/machine/i386/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_MIPS
+include %D%/machine/mips/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_NDS32
+include %D%/machine/nds32/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_POWERPC
+include %D%/machine/powerpc/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_PRU
+include %D%/machine/pru/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_SPARC
+include %D%/machine/sparc/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_SPU
+include %D%/machine/spu/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_RISCV
+include %D%/machine/riscv/Makefile.inc
+endif
+if HAVE_LIBM_MACHINE_X86_64
+include %D%/machine/x86_64/Makefile.inc
+endif
CLEANFILES += \
%D%/targetdep.tex \