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
|
--- src/DoConfig.orig 2009-05-05 07:46:39.000000000 +0100
+++ src/DoConfig 2009-08-10 19:24:43.000000000 +0100
@@ -25,14 +25,16 @@
'LDFLAGS_CXX' => '$(LDFLAGS)',
'LDLIBS' => '-lm',
'LDLIBS_CXX' => '$(LDLIBS)',
+'PICFLAG' => '-fPIC',
'CPPFLAGS' => '',
-'DEF_PREFIX' => '/usr/local',
+'DEF_PREFIX' => '/usr',
'PREFIX' => '$(DEF_PREFIX)',
'LIBDIR' => '$(PREFIX)/lib',
'INCLUDEDIR' => '$(PREFIX)/include',
'DOCDIR' => '$(PREFIX)/share/doc',
+'SHMAKE' => 'non-gld',
'GMP_PREFIX' => '$(DEF_PREFIX)',
'GMP_INCDIR' => '$(GMP_PREFIX)/include',
@@ -87,11 +89,6 @@
foreach $arg (@ARGV) {
- if ($arg =~ '-h|help|-help|--help') {
- system("more ../doc/config.txt");
- exit;
- }
-
if (($name, $val) = ($arg =~ /(.*?)=(.*)/)) {
if (exists($MakeFlag{$name}) && ($val =~ 'on|off')) {
--- src/mfile.orig 2009-05-05 07:46:39.000000000 +0100
+++ src/mfile 2009-08-10 20:31:36.000000000 +0100
@@ -77,6 +77,11 @@
# where to install NTL
###############################################################
+# choose the appropriate shared object makefile
+###############################################################
+SHMAKE=@{SHMAKE}
+
+###############################################################
#
# Second, if you want to use GMP (the GNU Multi-Precision library),
# define the variables GMP_OPT_INCDIR, GMP_OPT_LIBDIR, GMP_OPT_LIB below.
@@ -141,6 +146,16 @@
WIZARD=@{WIZARD}
# Set to off if you want to bypass the wizard; otherwise, set to on.
+###############################################################
+#
+# New addition for shared library building. With gcc you need to
+# choose the Position Indepent Code flag. You have a choice of
+# -fpic better code but in rare case not available (ppc)
+# -fPIC slightly slower code but guaranted to work anywhere.
+#
+###############################################################
+
+PICFLAG=@{PICFLAG}
#################################################################
#
@@ -173,6 +188,27 @@
OBJ=$(O19)
+SHOBJ=FFT.lo FacVec.lo GF2.lo GF2E.lo GF2EX.lo GF2EXFactoring.lo GF2X.lo GF2X1.lo \
+ GF2XFactoring.lo GF2XVec.lo GetTime.lo HNF.lo ctools.lo LLL.lo LLL_FP.lo \
+ LLL_QP.lo LLL_RR.lo LLL_XD.lo RR.lo WordVector.lo ZZ.lo ZZVec.lo \
+ ZZX.lo ZZX1.lo ZZXCharPoly.lo ZZXFactoring.lo ZZ_p.lo ZZ_pE.lo ZZ_pEX.lo \
+ ZZ_pEXFactoring.lo ZZ_pX.lo ZZ_pX1.lo ZZ_pXCharPoly.lo ZZ_pXFactoring.lo \
+ fileio.lo lip.lo lzz_p.lo lzz_pE.lo lzz_pEX.lo lzz_pEXFactoring.lo \
+ lzz_pX.lo lzz_pX1.lo lzz_pXCharPoly.lo lzz_pXFactoring.lo \
+ mat_GF2.lo mat_GF2E.lo mat_RR.lo mat_ZZ.lo mat_ZZ_p.lo \
+ mat_ZZ_pE.lo mat_lzz_p.lo mat_lzz_pE.lo mat_poly_ZZ.lo \
+ mat_poly_ZZ_p.lo mat_poly_lzz_p.lo pair_GF2EX_long.lo \
+ pair_GF2X_long.lo pair_ZZX_long.lo pair_ZZ_pEX_long.lo \
+ pair_ZZ_pX_long.lo pair_lzz_pEX_long.lo pair_lzz_pX_long.lo \
+ quad_float.lo tools.lo vec_GF2.lo vec_GF2E.lo vec_GF2XVec.lo \
+ vec_RR.lo vec_ZZ.lo vec_ZZVec.lo vec_ZZ_p.lo vec_ZZ_pE.lo \
+ vec_double.lo vec_long.lo vec_lzz_p.lo vec_lzz_pE.lo vec_quad_float.lo \
+ vec_vec_GF2.lo vec_vec_GF2E.lo vec_vec_RR.lo vec_vec_ZZ.lo \
+ vec_vec_ZZ_p.lo vec_vec_ZZ_pE.lo vec_vec_long.lo vec_vec_lzz_p.lo \
+ vec_vec_lzz_pE.lo vec_xdouble.lo xdouble.lo \
+ G_LLL_FP.lo G_LLL_QP.lo G_LLL_XD.lo G_LLL_RR.lo vec_ulong.lo vec_vec_ulong.lo
+
+
# library source files
@@ -320,7 +356,7 @@
LINK = $(CC) $(NTL_INCLUDE) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
LINK_CXX = $(CXX) $(NTL_INCLUDE) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS_CXX)
-
+.SUFFIXES: .lo
# 'make all' does a complete make, including all setup.
# It also creates the file 'all', which means you should
@@ -328,11 +364,11 @@
# again.
all:
- make setup1
- make setup2
- make setup3
- make setup4
- make ntl.a
+ $(MAKE) setup1
+ $(MAKE) setup2
+ $(MAKE) setup3
+ $(MAKE) setup4
+ $(MAKE) ntl.a
touch all
@@ -378,18 +414,31 @@
lip.o: lip.c g_lip_impl.h c_lip_impl.h lip_gmp_aux_impl.h
$(LCOMP) $(COMPILE) $(GMP_OPT_INCDIR) lip.c
+lip.lo: lip.c g_lip_impl.h c_lip_impl.h lip_gmp_aux_impl.h
+ $(LCOMP) $(COMPILE) $(PICFLAG) $(GMP_INCDIR) lip.c -o lip.lo
+
+
+
ctools.o: ctools.c
$(LCOMP) $(COMPILE) ctools.c
+ctools.lo: ctools.c
+ $(LCOMP) $(COMPILE) $(PICFLAG) ctools.c -o ctools.lo
+
GetTime.o: GetTime.c
$(LCOMP) $(COMPILE) GetTime.c
-
+GetTime.lo: GetTime.c
+ $(LCOMP) $(COMPILE) $(PICFLAG) GetTime.c -o GetTime.lo
.c.o:
$(LCOMP) $(COMPILE_CXX) $(GF2X_OPT_INCDIR) $<
+.c.lo:
+ $(LCOMP) $(COMPILE_CXX) $(PICFLAG) $(GF2X_OPT_INCDIR) -o $@ $<
+
+
.c:
@{LSTAT} $(LINK_CXX) -o $@ $< ntl.a $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB) $(LDLIBS_CXX) #LSTAT
@{LSHAR} $(LIBTOOL) --mode=link $(LINK_CXX) -o $@ $< libntl.la #LSHAR
@@ -403,7 +452,7 @@
check:
sh RemoveProg $(PROGS)
- make QuickTest
+ $(MAKE) QuickTest
./QuickTest
sh RemoveProg QuickTest
sh TestScript
@@ -460,19 +509,18 @@
#
#################################################################
-clobber:
+clobber: clean
rm -f ntl.a mach_desc.h ../include/NTL/mach_desc.h GetTime.c
rm -f lip_gmp_aux_impl.h ../include/NTL/gmp_aux.h
- sh RemoveProg $(PROGS) MakeDesc TestGetTime gen_lip_gmp_aux gen_gmp_aux
- rm -f *.o
- rm -rf small
+ sh RemoveProg $(PROGS)
+ rm -f libntl*.so*
rm -f cfileout mfileout
rm -rf .libs *.lo libntl.la
rm -f all
clean:
sh RemoveProg MakeDesc TestGetTime gen_lip_gmp_aux gen_gmp_aux
- rm -f *.o
+ rm -f *.o *.lo
rm -rf small
@{LSHAR} - $(LIBTOOL) --mode=clean rm -f libntl.la *.lo #LSHAR
@@ -549,3 +597,4 @@
+sinclude $(SHMAKE).mk
|