genode/libports/lib/mk/libm.mk
Christian Prochaska 2d290c0898 Preliminary 'log2()' and 'log2f()' implementation
The 'log2()' and 'log2f()' functions have been added in FreeBSD's libc
version 9.0.0, but they are missing in version 8.2.0, which is used in
Genode. This patch provides preliminary implementations of these
functions until the Genode libc gets updated to version 9.0.0 or above.

Fixes #143.
2012-03-08 10:42:21 +01:00

86 lines
2.2 KiB
Makefile

LIBC_DIR = $(REP_DIR)/contrib/libc-8.2.0
LIBM_DIR = $(LIBC_DIR)/msun
LIBS = libc
#
# finding 'math_private.h'
#
INC_DIR += $(LIBM_DIR)/src
#
# finding 'invtrig.h', included by 'e_acosl.c'
#
INC_DIR += $(LIBM_DIR)/ld80
#
# finding 'fpmath.h', included by 'invtrig.h'
#
INC_DIR += $(LIBC_DIR)/libc/include
FILTER_OUT += s_exp2l.c
#
# Files that are included by other sources (e.g., 's_sin.c'). Hence, we need
# to remove them from the build. Otherwise, we would end up with doubly
# defined symbols (and compiler warnings since those files are apparently
# not meant to be compiled individually).
#
FILTER_OUT += e_rem_pio2.c e_rem_pio2f.c
#
# Disable warnings for selected files, i.e., to suppress
# 'is static but used in inline function which is not static'
# messages
#
CC_OPT_s_tanf = -w
CC_OPT_s_tan = -w
CC_OPT_s_sin = -w
CC_OPT_s_cos = -w
CC_OPT_s_cosf = -w
CC_OPT_s_sinf = -w
CC_OPT_k_cosf = -w
CC_OPT_k_sinf = -w
CC_OPT_k_tanf = -w
#
# Work-around to get over doubly defined symbols produced by several sources
# that include 'e_rem_pio2.c' and 'e_rem_pio2f.c'. To avoid symbol clashes,
# we rename each occurrence by adding the basename of the compilation unit
# as suffix.
#
CC_OPT_s_sin += -D__ieee754_rem_pio2=__ieee754_rem_pio2_s_sin
CC_OPT_s_cos += -D__ieee754_rem_pio2=__ieee754_rem_pio2_s_cos
CC_OPT_s_sinf += -D__ieee754_rem_pio2f=__ieee754_rem_pio2f_s_sinf
CC_OPT_s_sinf += -D__kernel_cosdf=__kernel_cosdf_sinf
CC_OPT_s_cosf += -D__ieee754_rem_pio2f=__ieee754_rem_pio2f_s_cosf
CC_OPT_s_cosf += -D__kernel_sindf=__kernel_sindf_cosf
CC_OPT_s_tanf += -D__ieee754_rem_pio2f=__ieee754_rem_pio2f_s_tanf
#
# Use default warning level rather than -Wall because we do not want to touch
# the imported source code to improve build aesthetics.
#
CC_WARN =
SRC_C = $(wildcard $(LIBM_DIR)/src/*.c) \
$(wildcard $(LIBM_DIR)/ld80/*.c) \
$(wildcard $(LIBM_DIR)/bsdsrc/*.c)
SRC_C := $(filter-out $(FILTER_OUT),$(notdir $(SRC_C)))
# remove on update to version 9
SRC_C += log2.c
#
# 'e_rem_pio2.c' uses '__inline'
#
CC_OPT += -D__inline=inline
vpath %.c $(LIBM_DIR)/src
vpath %.c $(LIBM_DIR)/ld80
vpath %.c $(LIBM_DIR)/bsdsrc
# remove on update to version 9
vpath log2.c $(REP_DIR)/src/lib/libc
SHARED_LIB = yes