diff options
Diffstat (limited to 'math/Makefile')
-rw-r--r-- | math/Makefile | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/math/Makefile b/math/Makefile index 38a4709..2ff1405 100644 --- a/math/Makefile +++ b/math/Makefile @@ -43,6 +43,10 @@ libm-support = s_lib_version s_matherr s_signgam \ fesetenv feupdateenv t_exp fedisblxcpt feenablxcpt \ fegetexcept fesetexcept +# Wrappers for these functions generated per type using a file named +# <func>_template.c and the appropriate math-type-macros-<TYPE>.h. +gen-libm-calls = cargF conjF cimagF crealF cabsF + libm-calls = \ e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \ e_hypotF e_j0F e_j1F e_jnF e_lgammaF_r e_logF e_log10F e_powF \ @@ -59,13 +63,13 @@ libm-calls = \ w_ilogbF \ s_fpclassifyF s_fmaxF s_fminF s_fdimF s_nanF s_truncF \ s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF \ - conjF cimagF crealF cabsF cargF s_cexpF s_csinhF s_ccoshF s_clogF \ + s_cexpF s_csinhF s_ccoshF s_clogF \ s_catanF s_casinF s_ccosF s_csinF s_ctanF s_ctanhF s_cacosF \ s_casinhF s_cacoshF s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F \ s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \ s_issignalingF $(calls:s_%=m_%) x2y2m1F k_casinhF \ gamma_productF lgamma_negF lgamma_productF \ - s_nextupF s_nextdownF + s_nextupF s_nextdownF $(gen-libm-calls) libm-compat-calls-ldouble-yes = w_lgamma_compatl k_standardl libm-compat-calls = w_lgamma_compatf w_lgamma_compat k_standard k_standardf \ @@ -265,6 +269,29 @@ extra-objs += libieee.a ieee-math.o include ../Rules +generated += $(addsuffix .c,$(call type-foreach,$(gen-libm-calls))) \ + gen-libm-templates.stmp + +# Create wrappers in the math build directory. +$(objpfx)gen-libm-templates.stmp: + for gcall in $(gen-libm-calls); do \ + func=$${gcall%F*}$${gcall#*F}; \ + for type in $(foreach t,$(types),$(t)__$(type-$(t)-suffix)); do \ + suff=$${type#*__}; \ + type=$${type%__*}; \ + file=$(objpfx)$${gcall%F*}$${suff}$${gcall#*F}.c; \ + ( \ + echo "#include <math-type-macros-$${type}.h>"; \ + echo "#include <$${func}_template.c>"; \ + ) > $${file}; \ + done; \ + done; \ + echo > $(@) + +# Add dependency to ensure the generator runs prior. +$(foreach t, $(call type-foreach, $(gen-libm-calls)), \ + $(objpfx)$(t).c): $(objpfx)gen-libm-templates.stmp + ifneq (no,$(PERL)) # This must come after the inclusion of sysdeps Makefiles via Rules. $(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test.stmp |