1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
|
#!/bin/sh
# file kernel/n/remake: compile rules for the libnumerix-n library
#-----------------------------------------------------------------------+
# Copyright 2005-2006, Michel Quercia (michel.quercia@prepas.org) |
# |
# This file is part of Numerix. Numerix is free software; you can |
# redistribute it and/or modify it under the terms of the GNU Lesser |
# General Public License as published by the Free Software Foundation; |
# either version 2.1 of the License, or (at your option) any later |
# version. |
# |
# The Numerix Library is distributed in the hope that it will be |
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
# Lesser General Public License for more details. |
# |
# You should have received a copy of the GNU Lesser General Public |
# License along with the GNU MP Library; see the file COPYING. If not, |
# write to the Free Software Foundation, Inc., 59 Temple Place - |
# Suite 330, Boston, MA 02111-1307, USA. |
#-----------------------------------------------------------------------+
# |
# Rgles de construction de libnumerix-n |
# |
#-----------------------------------------------------------------------+
# m_list = liste des modes (c/d/s)
# t_list = mode additionnel (t) pour la version assembleur
m_list=
t_list=
if test "$USE_CLONG" = "1"; then m_list="${m_list} c"; fi
if test "$USE_DLONG" = "1"; then m_list="${m_list} d"; fi
if test "$USE_SLONG" = "1"; then m_list="${m_list} s"; t_list="t"; fi
# code machine pour le module Slong
case "$PROCESSOR" in
x86-64) proc=x86-64;;
x86*) proc=x86;;
alpha) proc=alpha;;
ppc32) proc=ppc32;;
*) proc=;;
esac
# On y va
cat <<EOF
# File kernel/n/makefile: compile rules for the libnumerix-n library
EOF
sed -n -e '3,/^$/p' $0
cat <<EOF
# This file was generated by the kernel/n/remake script
# switches:
# USE_CLONG=$USE_CLONG
# USE_DLONG=$USE_DLONG
# USE_SLONG=$USE_SLONG
# USE_GMP=$USE_GMP
# PROCESSOR=$PROCESSOR
#-------------------- config files
lib_n_config = Makefile kernel/config.h kernel/n/makefile
#-------------------- source files
lib_n_c_src = \\
kernel/n/c/numerix.c \\
kernel/n/c/add.c \\
kernel/n/c/alloc.c \\
kernel/n/c/burnikel.c \\
kernel/n/c/cmp.c \\
kernel/n/c/div_n2.c \\
kernel/n/c/dump.c \\
kernel/n/c/fft.c \\
kernel/n/c/fftmul.c \\
kernel/n/c/gcd.c \\
kernel/n/c/karatsuba.c \\
kernel/n/c/karp.c \\
kernel/n/c/mmod.c \\
kernel/n/c/moddiv.c \\
kernel/n/c/montgomery.c \\
kernel/n/c/mul_n2.c \\
kernel/n/c/pow.c \\
kernel/n/c/powmod.c \\
kernel/n/c/prime.c \\
kernel/n/c/random.c \\
kernel/n/c/shift.c \\
kernel/n/c/smod.c \\
kernel/n/c/sqrt_n2.c \\
kernel/n/c/toom.c \\
kernel/n/c/zimmermann.c
lib_n_h_src = \\
kernel/n/h/numerix.h \\
kernel/n/h/add.h \\
kernel/n/h/alloc.h \\
kernel/n/h/burnikel.h \\
kernel/n/h/cmp.h \\
kernel/n/h/div_n2.h \\
kernel/n/h/dump.h \\
kernel/n/h/fft.h \\
kernel/n/h/fftmul.h \\
kernel/n/h/gcd.h \\
kernel/n/h/karatsuba.h \\
kernel/n/h/karp.h \\
kernel/n/h/mmod.h \\
kernel/n/h/moddiv.h \\
kernel/n/h/montgomery.h \\
kernel/n/h/mul_n2.h \\
kernel/n/h/pow.h \\
kernel/n/h/powmod.h \\
kernel/n/h/prime.h \\
kernel/n/h/random.h \\
kernel/n/h/shift.h \\
kernel/n/h/smod.h \\
kernel/n/h/sqrt_n2.h \\
kernel/n/h/toom.h \\
kernel/n/h/zimmermann.h
EOF
if test "$USE_SLONG" = "1"; then cat <<EOF
lib_n_s_src = \\
kernel/n/$proc/numerix.S \\
kernel/n/$proc/add.S \\
kernel/n/$proc/burnikel.S \\
kernel/n/$proc/cmp.S \\
kernel/n/$proc/div_n2.S \\
kernel/n/$proc/dumpreg.S \\
kernel/n/$proc/gcd_n2.S \\
kernel/n/$proc/karatsuba.S \\
kernel/n/$proc/mmod.S \\
kernel/n/$proc/montgomery.S \\
kernel/n/$proc/mul_n2.S \\
kernel/n/$proc/shift.S \\
kernel/n/$proc/smod.S \\
kernel/n/$proc/sqrt_n2.S \\
kernel/n/$proc/toom.S
EOF
fi
cat <<EOF
#-------------------- object file list
EOF
echo -n "lib_n_obj = "
for m in $m_list $t_list; do echo -n "\\
kernel/n/o/numerix-$m.o "
done
echo
cat <<EOF
#-------------------- library compile rules
EOF
for m in $m_list; do cat <<EOF
kernel/n/o/numerix-$m.o: \$(lib_n_config) \$(lib_n_c_src) \$(lib_n_h_src)
\$(GCC) \$(PIC) -Duse_${m}long -c -o \$@ kernel/n/c/numerix.c
EOF
done
if test "$USE_SLONG" = "1"; then cat <<EOF
kernel/n/o/numerix-t.o: \$(lib_n_config) \$(lib_n_s_src)
\$(GCC) \$(PIC) -Duse_slong -c -o \$@ kernel/n/$proc/numerix.S
EOF
fi
tests="timing"
cat <<EOF
#-------------------- test programs
EOF
for p in $tests; do
for m in $m_list; do
if test "$m" = "s"; then nt=kernel/n/o/numerix-t.o; else nt=""; fi
cat <<EOF
$p: kernel/n/o/$p-$m
kernel/n/o/$p-$m: kernel/n/c/$p.c kernel/n/o/numerix-$m.o $nt
\$(GCC) -Duse_${m}long -o \$@ kernel/n/c/$p.c kernel/n/o/numerix-$m.o $nt
EOF
done
done
if test "$USE_GMP" = "1"; then cat <<EOF
timing: kernel/n/o/timing-g
kernel/n/o/timing-g: kernel/n/c/timing-gmp.c
\$(GCC) -o \$@ kernel/n/c/timing-gmp.c -lgmp
EOF
fi
cat <<EOF
.PHONY: clean_n
clean_n:
rm -f kernel/n/o/*
#-------------------- done
lib: \$(lib_n_obj)
clean: clean_n
EOF
|