1ifeq ($(subdir),math)
2#
3# Some files which need to go both into libc and libm have external
4# dependencies which need to be resolved differently for libc
5# vs. libm.  For example, inside libc, __libm_error_support needs to
6# resolve to HIDDEN_JUMPTARGET(__libm_error_support) whereas within
7# libm it always resolves to __libm_error_support.  Such files need to
8# be compiled twice.  Fortunately, math/Makefile already has logic to
9# support this: if a file starts with "s_", make will automatically
10# generate a matching file whose name starts with "m_" which simply
11# includes the corresponding "s_" file.
12#
13duplicated-routines = s_libm_ldexp s_libm_ldexpf s_libm_ldexpl \
14		      s_libm_scalbn s_libm_scalbnf s_libm_scalbnl
15
16libm-sysdep_routines += s_erfc s_erfcf s_erfcl \
17			s_matherrf s_matherrl libm_reduce \
18			libm_error \
19			libm_frexp libm_frexpf libm_frexpl \
20			libm_sincos libm_sincosf libm_sincosl \
21			libm_sincos_large \
22			libm_lgamma libm_lgammaf libm_lgammal \
23			libm_scalblnf \
24			$(duplicated-routines:s_%=m_%)
25
26sysdep_routines += libc_libm_error libm_frexp libm_frexpf libm_frexpl \
27		   $(duplicated-routines)
28
29sysdep-CPPFLAGS += -include libm-symbols.h \
30	-D__POSIX__ -Dopensource \
31	-D_LIB_VERSIONIMF=_LIB_VERSION \
32	-DSIZE_INT_32 -DSIZE_LONG_INT_64 -DSIZE_LONG_LONG_INT_64 \
33	-DSIZE_LONG_64 -DIA64
34endif
35