1#!/bin/sh 2 3# Notes: 4 5# We don't import copysign finite, fpclassify, isinf, isnan, and signbit 6# since our own versions are nicer and just as correct and fast (except 7# perhaps that they don't handle non-finite arguments well?). 8# 9# Also, leave out cabs for now since it doesn't seem overridable in 10# glibc. 11 12libm_dir=$1 13 14import_s() { 15 # $1 = name 16 # $2 = source file-name 17 # $3 = destination file-name 18 echo "Importing $1 from $2 -> $3" 19 rm -f $3 20 awk -f import_file.awk FUNC=$1 $2 > $3 21} 22 23import_c() { 24 # $1 = name 25 # $2 = source file-name 26 # $3 = destination file-name 27 echo "Importing $1 from $2 -> $3" 28 rm -f $3 29 awk -f import_file.awk LICENSE_ONLY=y $2 > $3 30} 31 32do_imports() { 33 while read func_pattern src_file dst_file; do 34 case $src_file in 35 *.[ch]) 36 import_c "$func_pattern" "$src_file" "$dst_file" 37 ;; 38 *) 39 import_s "$func_pattern" "$src_file" "$dst_file" 40 ;; 41 esac 42 done 43} 44 45./gen_import_file_list $libm_dir > import_file_list 46 47do_imports < import_file_list 48 49emptyfiles=" 50e_gamma_r.c 51e_gammaf_r.c 52e_gammal_r.c 53s_sincos.c 54s_sincosf.c 55s_sincosl.c 56t_exp.c 57w_acosh.c 58w_acoshf.c 59w_acoshl.c 60w_atanh.c 61w_atanhf.c 62w_atanhl.c 63w_exp10.c 64w_exp10f.c 65w_exp10l.c 66w_exp2.c 67w_exp2f.c 68w_exp2l.c 69w_expl.c 70w_lgamma_r.c 71w_lgammaf_r.c 72w_lgammal_r.c 73w_log2.c 74w_log2f.c 75w_log2l.c 76w_sinh.c 77w_sinhf.c 78w_sinhl.c 79" 80for f in $emptyfiles 81do 82 rm -f $f 83 echo "/* Not needed. */" > $f 84done 85 86removedfiles=" 87libm_atan2_reg.S 88s_ldexp.S 89s_ldexpf.S 90s_ldexpl.S 91s_scalbn.S 92s_scalbnf.S 93s_scalbnl.S 94" 95 96rm -f $removedfiles 97 98for f in lgammaf_r.c lgammal_r.c lgamma_r.c 99do 100 import_c $f $libm_dir/$f e_$f 101done 102 103for f in lgamma.c lgammaf.c lgammal.c 104do 105 import_c $f $libm_dir/$f w_$f 106done 107