newlib-cygwin/newlib/libm/machine/i386/Makefile.inc

13 lines
658 B
PHP
Raw Permalink Normal View History

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.
2022-02-10 13:50:36 +08:00
%C%_src = \
%D%/f_atan2.S %D%/f_atan2f.S %D%/f_exp.c %D%/f_expf.c \
%D%/f_frexp.S %D%/f_frexpf.S %D%/f_llrint.c %D%/f_llrintf.c %D%/f_llrintl.c \
%D%/f_log.S %D%/f_logf.S %D%/f_log10.S %D%/f_log10f.S \
%D%/f_ldexp.S %D%/f_ldexpf.S %D%/f_lrint.c %D%/f_lrintf.c %D%/f_lrintl.c \
%D%/f_pow.c %D%/f_powf.c %D%/f_rint.c %D%/f_rintf.c %D%/f_rintl.c \
%D%/f_tan.S %D%/f_tanf.S %D%/f_math.h %D%/i386mach.h \
%D%/fenv.c %D%/feclearexcept.c %D%/fegetenv.c %D%/fegetexceptflag.c \
%D%/fegetround.c %D%/feholdexcept.c %D%/feraiseexcept.c %D%/fesetenv.c \
%D%/fesetexceptflag.c %D%/fesetround.c %D%/fetestexcept.c %D%/feupdateenv.c
libm_a_SOURCES += $(%C%_src)