source: git/ntl/src/makefile @ 2cfffe

spielwiese
Last change on this file since 2cfffe was 2cfffe, checked in by Hans Schönemann <hannes@…>, 21 years ago
This commit was generated by cvs2svn to compensate for changes in r6316, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@6317 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 14.9 KB
Line 
1###############################################################
2#
3#  First, choose a C and C++ compilers, and set compiler flags.
4#  This is done by setting the variables CXX, CC, CFLAGS, and
5#  CXXFLAGS.
6#
7###############################################################
8
9
10CC=gcc
11# A C or C++ compiler, e. g., gcc, cc, xlc.
12# There are a few components written in C which may be compiled
13# under C++, but C compilers tend to generate slightly better code.
14# The C++ and C compilers (if different) must generate
15# compatible code.
16
17
18CXX=g++
19# A C++ compiler, e.g., g++, CC, xlC
20
21
22CFLAGS=-O2
23# Flags for the C compiler
24# Some useful flags:
25#   -O2   --  recommended level of optimization
26#   -g    --  debugging
27#   -mv8  --  needed with gcc/g++ to get the full instruction set
28#             of a SparcStation
29#   -qarch=ppc  -- needed with xlc/C to get the full instruction set
30#                  of a PowerPC
31
32
33
34CXXFLAGS=$(CFLAGS)
35# Flags for the C++ compiler (usually the same as CFLAGS)
36# Some useful flags:
37#   -+  -- needed with xlC to make it treat .c files as C++ files
38
39# Here are a few more variables for standard utilities.
40# The defaults should almost always be OK.
41
42
43AR=ar
44# command to make a library
45
46ARFLAGS=ruv
47# arguments for AR
48
49RANLIB=ranlib
50# set to echo if you want to disable it completely
51
52LDFLAGS=
53# arguments for linker for C++ programs
54
55LDFLAGS_CXX=$(LDFLAGS)
56# libraries for linking C programs
57
58LDLIBS=-lm
59# libraries for linking C++ programs
60
61LDLIBS_CXX=$(LDLIBS)
62# libraries for linking C++ programs
63
64CPPFLAGS=
65# arguments for the C preprocessor
66
67PREFIX=/usr/local
68LIBDIR=$(PREFIX)/lib
69INCLUDEDIR=$(PREFIX)/include
70DOCDIR=$(PREFIX)/doc
71# where to install NTL
72
73###############################################################
74#
75#  Second, if you want to use GMP (the GNU Multi-Precision library),
76#  define the variables GMP_INCDIR, GMP_LIBDIR, GMP_LIB below.
77#  Otherwise, leave these defined as empty.
78#  You also will have to set either NTL_GMP_LIP or NTL_GMP_HACK
79#  in the config.h file.
80#
81#  Using GMP can lead to significant performance gains on some
82#  platforms.  You can obtain GMP from http://www.swox.com/gmp.
83#  Once you unpack it into a directory, just execute
84#     ./configure; make
85#  in that directory.
86#
87###############################################################
88
89
90GMP_INCDIR=
91# Set to -I<directory containing gmp.h> if using GMP and GMP
92# is not installed in a standard system directory, empty otherwise
93
94GMP_LIBDIR=
95# Set to -L<directory containing libgmp.a> if using GMP and GMP
96# is not installed in a standard system directory, empty otherwise
97
98GMP_LIB=
99# Set to -lgmp if using GMP, empty otherwise
100
101###############################################################
102#
103# Third, if you do not want to run the wizard that automagically
104# sets some performace related flags in config.h, set the flag below.
105#
106###############################################################
107
108
109WIZARD=on
110# Set to off if you want to bypass the wizard; otherwise, set to on.
111
112
113#################################################################
114#
115#  That's it!  You can ignore everything else in this file!
116#
117#################################################################
118
119
120# object files
121
122O01=FFT.o FacVec.o GF2.o GF2E.o GF2EX.o GF2EXFactoring.o GF2X.o GF2X1.o
123O02=$(O01) GF2XFactoring.o GF2XVec.o GetTime.o HNF.o IsFinite.o LLL.o LLL_FP.o
124O03=$(O02) LLL_QP.o LLL_RR.o LLL_XD.o RR.o WordVector.o ZZ.o ZZVec.o
125O04=$(O03) ZZX.o ZZX1.o ZZXCharPoly.o ZZXFactoring.o ZZ_p.o ZZ_pE.o ZZ_pEX.o
126O05=$(O04) ZZ_pEXFactoring.o ZZ_pX.o ZZ_pX1.o ZZ_pXCharPoly.o ZZ_pXFactoring.o
127O06=$(O05) fileio.o lip.o lzz_p.o lzz_pE.o lzz_pEX.o lzz_pEXFactoring.o
128O07=$(O06) lzz_pX.o lzz_pX1.o lzz_pXCharPoly.o lzz_pXFactoring.o
129O08=$(O07) mat_GF2.o mat_GF2E.o mat_RR.o mat_ZZ.o mat_ZZ_p.o
130O09=$(O08) mat_ZZ_pE.o mat_lzz_p.o mat_lzz_pE.o mat_poly_ZZ.o
131O10=$(O09) mat_poly_ZZ_p.o mat_poly_lzz_p.o pair_GF2EX_long.o
132O11=$(O10) pair_GF2X_long.o pair_ZZX_long.o pair_ZZ_pEX_long.o
133O12=$(O11) pair_ZZ_pX_long.o pair_lzz_pEX_long.o pair_lzz_pX_long.o
134O13=$(O12) quad_float.o tools.o vec_GF2.o vec_GF2E.o vec_GF2XVec.o
135O14=$(O13) vec_RR.o vec_ZZ.o vec_ZZVec.o vec_ZZ_p.o vec_ZZ_pE.o
136O15=$(O14) vec_double.o vec_long.o vec_lzz_p.o vec_lzz_pE.o vec_quad_float.o
137O16=$(O15) vec_vec_GF2.o vec_vec_GF2E.o vec_vec_RR.o vec_vec_ZZ.o
138O17=$(O16) vec_vec_ZZ_p.o vec_vec_ZZ_pE.o vec_vec_long.o vec_vec_lzz_p.o
139O18=$(O17) vec_vec_lzz_pE.o vec_xdouble.o xdouble.o
140O19=$(O18) G_LLL_FP.o G_LLL_QP.o G_LLL_XD.o G_LLL_RR.o vec_ulong.o vec_vec_ulong.o
141
142OBJ=$(O19)
143
144# library source files
145
146
147S01=FFT.c FacVec.c GF2.c GF2E.c GF2EX.c GF2EXFactoring.c GF2X.c GF2X1.c
148S02=$(S01) GF2XFactoring.c GF2XVec.c HNF.c IsFinite.c LLL.c LLL_FP.c LLL_QP.c
149S03=$(S02) LLL_RR.c LLL_XD.c RR.c WordVector.c ZZ.c ZZVec.c ZZX.c ZZX1.c
150S04=$(S03) ZZXCharPoly.c ZZXFactoring.c ZZ_p.c ZZ_pE.c ZZ_pEX.c
151S05=$(S04) ZZ_pEXFactoring.c ZZ_pX.c ZZ_pX1.c ZZ_pXCharPoly.c
152S06=$(S05) ZZ_pXFactoring.c fileio.c lip.c lzz_p.c lzz_pE.c lzz_pEX.c
153S07=$(S06) lzz_pEXFactoring.c lzz_pX.c lzz_pX1.c
154S08=$(S07) lzz_pXCharPoly.c lzz_pXFactoring.c mat_GF2.c mat_GF2E.c
155S09=$(S08) mat_RR.c mat_ZZ.c mat_ZZ_p.c mat_ZZ_pE.c mat_lzz_p.c mat_lzz_pE.c
156S10=$(S09) mat_poly_ZZ.c mat_poly_ZZ_p.c mat_poly_lzz_p.c pair_GF2EX_long.c
157S11=$(S10) pair_GF2X_long.c pair_ZZX_long.c pair_ZZ_pEX_long.c
158S12=$(S11) pair_ZZ_pX_long.c pair_lzz_pEX_long.c pair_lzz_pX_long.c
159S13=$(S12) quad_float.c tools.c vec_GF2.c vec_GF2E.c vec_GF2XVec.c vec_RR.c
160S14=$(S13) vec_ZZ.c vec_ZZVec.c vec_ZZ_p.c vec_ZZ_pE.c vec_double.c
161S15=$(S14) vec_long.c vec_lzz_p.c vec_lzz_pE.c vec_quad_float.c
162S16=$(S15) vec_vec_GF2.c vec_vec_GF2E.c vec_vec_RR.c vec_vec_ZZ.c
163S17=$(S16) vec_vec_ZZ_p.c vec_vec_ZZ_pE.c vec_vec_long.c vec_vec_lzz_p.c
164S18=$(S17) vec_vec_lzz_pE.c vec_xdouble.c xdouble.c
165S19=$(S18) G_LLL_FP.c G_LLL_QP.c G_LLL_XD.c G_LLL_RR.c
166S20=$(S19) vec_ulong.c vec_vec_ulong.c
167
168SRC = $(S20)
169
170# library source files that are header files
171
172SINC = c_lip_impl.h g_lip_impl.h
173
174
175
176
177
178# library header files
179
180IN01= FFT.h FacVec.h GF2.h GF2E.h GF2EX.h GF2EXFactoring.h GF2X.h
181IN02=$(IN01) GF2XFactoring.h GF2XVec.h HNF.h IsFinite.h LLL.h
182IN03=$(IN02) RR.h WordVector.h ZZ.h ZZVec.h ZZX.h ZZXFactoring.h ZZ_p.h
183IN04=$(IN03) ZZ_pE.h ZZ_pEX.h ZZ_pEXFactoring.h ZZ_pX.h ZZ_pXFactoring.h
184IN05=$(IN04) fileio.h lip.h lzz_p.h lzz_pE.h lzz_pEX.h lzz_pEXFactoring.h
185IN06=$(IN05) lzz_pX.h lzz_pXFactoring.h mat_GF2.h mat_GF2E.h mat_RR.h
186IN07=$(IN06) mat_ZZ.h mat_ZZ_p.h mat_ZZ_pE.h mat_lzz_p.h mat_lzz_pE.h
187IN08=$(IN07) mat_poly_ZZ.h mat_poly_ZZ_p.h mat_poly_lzz_p.h matrix.h
188IN09=$(IN08) pair.h vector.h pair_GF2EX_long.h pair_GF2X_long.h
189IN10=$(IN09) pair_ZZX_long.h pair_ZZ_pEX_long.h pair_ZZ_pX_long.h
190IN11=$(IN10) pair_lzz_pEX_long.h pair_lzz_pX_long.h quad_float.h
191IN12=$(IN11) tools.h vec_GF2.h vec_GF2E.h vec_GF2XVec.h vec_RR.h
192IN13=$(IN12) vec_ZZ.h vec_ZZVec.h vec_ZZ_p.h vec_ZZ_pE.h vec_double.h
193IN14=$(IN13) vec_long.h vec_lzz_p.h vec_lzz_pE.h vec_quad_float.h
194IN15=$(IN14) vec_vec_GF2.h vec_vec_GF2E.h vec_vec_RR.h vec_vec_ZZ.h
195IN16=$(IN15) vec_vec_ZZ_p.h vec_vec_ZZ_pE.h vec_vec_long.h vec_vec_lzz_p.h
196IN17=$(IN16) vec_vec_lzz_pE.h vec_xdouble.h xdouble.h config.h version.h
197IN18=$(IN17) def_config.h new.h vec_ulong.h vec_vec_ulong.h c_lip.h g_lip.h
198
199INCL=$(IN18)
200
201
202
203# test data
204
205TD1=BerlekampTestIn BerlekampTestOut CanZassTestIn CanZassTestOut
206TD2=$(TD1) ZZXFacTestIn ZZXFacTestOut MoreFacTestIn LLLTestIn LLLTestOut RRTestIn RRTestOut
207TD3=$(TD2) MatrixTestIn MatrixTestOut CharPolyTestIn 
208TD4=$(TD3) CharPolyTestOut QuadTestIn QuadTestOut
209
210TD = $(TD4)
211
212# test source files
213
214TS1=Test.c BerlekampTest.c CanZassTest.c ZZXFacTest.c MoreFacTest.c LLLTest.c
215TS2=$(TS1) subset.c MatrixTest.c CharPolyTest.c RRTest.c QuadTest.c
216TS3=$(TS2) GF2EXTest.c BitMatTest.c ZZ_pEXTest.c lzz_pEXTest.c
217
218TS = $(TS3)
219
220# scripts
221
222SCRIPTS1=MakeGetTime TestScript dosify unixify RemoveProg Select Select1 Select2
223SCRIPTS2=$(SCRIPTS1) Check1 Check2 configure make.config flags.config make.tail
224
225SCRIPTS=$(SCRIPTS2)
226
227# auxilliary source
228
229MD=MakeDesc.c MakeDescAux.c newnames.c gen_lip_gmp_aux.c gen_gmp_aux.c
230
231GT=GetTime1.c GetTime2.c GetTime3.c GetTime4.c GetTime5.c TestGetTime.c
232
233
234# documentation
235
236
237D01=copying.txt GF2.txt GF2E.txt GF2EX.txt GF2EXFactoring.txt GF2X.txt
238D02=$(D01) GF2XFactoring.txt GF2XVec.txt HNF.txt LLL.txt RR.txt
239D03=$(D02) ZZ.txt ZZVec.txt ZZX.txt ZZXFactoring.txt ZZ_p.txt ZZ_pE.txt
240D04=$(D03) ZZ_pEX.txt ZZ_pEXFactoring.txt ZZ_pX.txt ZZ_pXFactoring.txt
241D05=$(D04) conversions.txt flags.txt lzz_p.txt lzz_pE.txt lzz_pEX.txt
242D06=$(D05) lzz_pEXFactoring.txt lzz_pX.txt lzz_pXFactoring.txt mat_GF2.txt
243D07=$(D06) mat_GF2E.txt mat_RR.txt mat_ZZ.txt mat_ZZ_p.txt mat_ZZ_pE.txt
244D08=$(D07) mat_lzz_p.txt mat_lzz_pE.txt mat_poly_ZZ.txt mat_poly_ZZ_p.txt
245D09=$(D08) mat_poly_lzz_p.txt matrix.txt pair.txt vector.txt
246D10=$(D09) quad_float.txt sedscript.txt tools.txt vec_GF2.txt
247D11=$(D10) vec_GF2E.txt vec_RR.txt vec_ZZ.txt vec_ZZ_p.txt vec_ZZ_pE.txt
248D12=$(D11) vec_lzz_p.txt vec_lzz_pE.txt xdouble.txt names.txt
249D13=$(D12) tour-ack.html tour-intro.html tour-time.html tour-changes.html
250D14=$(D13) tour-modules.html tour-stdcxx.html tour-unix.html tour-examples.html
251D15=$(D14) tour-roadmap.html tour-win.html tour-impl.html tour-struct.html
252D16=$(D15) tour.html tour-ex1.html tour-ex2.html tour-ex3.html tour-ex4.html
253D17=$(D16) tour-ex5.html tour-ex6.html arrow1.gif arrow2.gif arrow3.gif
254D18=$(D17) tour-gmp.html config.txt version.txt
255
256DOC = $(D18)
257
258
259
260# test program executables
261
262PROG1=Test BerlekampTest CanZassTest ZZXFacTest MoreFacTest LLLTest  BitMatTest
263PROG2=$(PROG1) MatrixTest CharPolyTest RRTest QuadTest
264PROG3=$(PROG2) GF2EXTest subset ZZ_pEXTest lzz_pEXTest
265PROGS = $(PROG3)
266
267# things to save to a tar file
268
269SFI1=makefile $(SRC) $(SINC) $(SCRIPTS) $(MD) $(GT) $(TS) $(TD) mach_desc.win
270SFI2=$(SFI1) MulTimeTest.c PolyTimeTest.c clr_AVOID_BRANCHING clr_AVOID_FLOAT
271SFI3=$(SFI2) clr_FFT_PIPELINE clr_LONG_LONG clr_TBL_REM clr_WIZARD_HACK
272SFI4=$(SFI3) InitSettings.c mul_banner poly_banner set_AVOID_BRANCHING set_AVOID_FLOAT
273SFI5=$(SFI4) set_FFT_PIPELINE set_LONG_LONG set_TBL_REM set_WIZARD_HACK
274SFI6=$(SFI5) WizComp.c DispSettings.c config_template WizardAux Wizard def_makefile
275SFILES=$(SFI6)
276
277
278#################################################################
279#
280#  Rules for compiling the library
281#
282#################################################################
283
284
285NTL_INCLUDE = -I../include -I.
286# NTL needs this to find its include files
287
288COMPILE = $(CC) $(NTL_INCLUDE) $(CPPFLAGS) $(CFLAGS) -c
289COMPILE_CXX = $(CXX) $(NTL_INCLUDE) $(CPPFLAGS) $(CXXFLAGS) -c
290
291LINK = $(CC) $(NTL_INCLUDE) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
292LINK_CXX = $(CXX) $(NTL_INCLUDE) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS_CXX)
293
294
295
296all:
297        make setup1
298        make setup2
299        make setup3
300        make setup4
301        make ntl.a
302
303
304# setup1 generates the file ../incluse/NTL/mach_desc.h
305
306setup1:
307        $(COMPILE) MakeDescAux.c
308        $(LINK) -o MakeDesc MakeDesc.c MakeDescAux.o $(LDLIBS)
309        ./MakeDesc
310        mv mach_desc.h ../include/NTL/mach_desc.h
311
312# setup2 generates the file GetTime.c
313
314setup2:
315        sh MakeGetTime "$(LINK)" "$(LDLIBS)"
316
317# setup3 generates the files lip_gmp_aux.c and ../include/NTL/gmp_aux.h
318# The file lip_gmp_aux.c is included when lip.c when NTL_GMP_HACK is set.
319# The file ../include/NTL/gmp_aux.h is included in ../include/NTL/lip.h
320# when NTL_GMP_LIP is set.
321# When these flags are not set, empty files are produced.
322
323setup3:
324        $(LINK) $(GMP_FLAG) $(GMP_INCDIR) -o gen_lip_gmp_aux gen_lip_gmp_aux.c $(GMP_LIBDIR) $(GMP_LIB) $(LDLIBS)
325        ./gen_lip_gmp_aux > lip_gmp_aux_impl.h
326        $(LINK) $(GMP_FLAG) $(GMP_INCDIR) -o gen_gmp_aux gen_gmp_aux.c $(GMP_LIBDIR) $(GMP_LIB) $(LDLIBS)
327        ./gen_gmp_aux > ../include/NTL/gmp_aux.h
328
329# setup4 runs the wizard
330
331setup4:
332        sh Wizard $(WIZARD)
333
334
335ntl.a:  $(OBJ) 
336        $(AR) $(ARFLAGS) ntl.a $(OBJ)
337        - $(RANLIB) ntl.a
338
339lip.o:  lip.c g_lip_impl.h c_lip_impl.h lip_gmp_aux_impl.h
340        $(COMPILE) $(GMP_INCDIR) lip.c
341
342IsFinite.o:     IsFinite.c
343        $(COMPILE) IsFinite.c
344
345
346GetTime.o: GetTime.c
347        $(COMPILE) GetTime.c
348
349
350.c.o: 
351        $(COMPILE_CXX) $<
352
353.c: 
354        $(LINK_CXX) -o $@ $< ntl.a  $(GMP_LIBDIR) $(GMP_LIB) $(LDLIBS_CXX) 
355
356#################################################################
357#
358# Rule for running tests
359# make check runs a series of tests
360#
361#################################################################
362
363check:
364        make Test
365        ./Test
366        - sh RemoveProg Test
367        sh TestScript
368
369#################################################################
370#
371# Rule for installing
372# make install just does a simple copy of the include file
373#   and library
374# make uninstall removes these files
375#   
376#################################################################
377
378
379
380
381install:
382        mkdir -p $(LIBDIR)
383        cp ntl.a $(LIBDIR)/libntl.a
384        mkdir -p $(INCLUDEDIR)
385        - rm -r $(INCLUDEDIR)/NTL
386        mkdir $(INCLUDEDIR)/NTL
387        cp ../include/NTL/*.h $(INCLUDEDIR)/NTL
388        mkdir -p $(DOCDIR)
389        - rm -r $(DOCDIR)/NTL
390        mkdir $(DOCDIR)/NTL
391        cp ../doc/*.txt $(DOCDIR)/NTL
392        cp ../doc/*.html $(DOCDIR)/NTL
393        cp ../doc/*.gif $(DOCDIR)/NTL
394
395
396uninstall:
397        - rm $(LIBDIR)/libntl.a
398        - rm -r $(INCLUDEDIR)/NTL
399        - rm -r $(DOCDIR)/NTL
400
401#################################################################
402#
403#  Rules for cleaning up
404#
405#  make clobber removes *everything* created by make,
406#    but it does not restore config.h to its default.
407#
408#  make clean tidies up a bit
409#
410#################################################################
411
412clobber:       
413        - rm ntl.a mach_desc.h ../include/NTL/mach_desc.h  GetTime.c
414        - rm lip_gmp_aux_impl.h ../include/NTL/gmp_aux.h
415        - sh RemoveProg $(PROGS) MakeDesc TestGetTime gen_lip_gmp_aux gen_gmp_aux
416        - rm *.o
417        - rm -r small
418
419clean:
420        - rm *.o
421        - sh RemoveProg MakeDesc TestGetTime gen_lip_gmp_aux gen_gmp_aux
422        - rm -r small
423
424#################################################################
425#
426#  Rules for making tar and zip files
427#
428#  make package creates a tar.gz file suitable for Unix
429#
430#  make winpack creates a zip file suitable for Windows
431#
432#################################################################
433
434
435DIRNAME=ntl-5.2
436WINDIR=WinNTL-5_2
437
438package:
439        sh unixify "$(SFILES)" "$(INCL)" "$(DOC)" 
440        -rm -r $(DIRNAME)
441        mv unix $(DIRNAME)
442        chmod -R a+rX $(DIRNAME)
443        tar -cvf $(DIRNAME).tar $(DIRNAME)
444        gzip $(DIRNAME).tar
445        - rm -r $(DIRNAME)
446
447winpack:
448        sh dosify "$(SRC)" "$(INCL)" "$(DOC)" "$(TS)" "$(TD)" "$(SINC)"
449        - rm -r $(WINDIR)
450        mv dos $(WINDIR)
451        chmod -R a+rX $(WINDIR)
452        find ./$(WINDIR) '!' -name '*.gif' -print | zip -l $(WINDIR) -@
453        find ./$(WINDIR) -name '*.gif' -print | zip -u $(WINDIR) -@
454        rm -r $(WINDIR)
455
456
457
458######################################################################
459#
460#  config wizard related stuff
461#
462######################################################################
463
464WO1 = FFT.o  GetTime.o IsFinite.o ZZ.o ZZVec.o ZZ_p.o ZZ_pX.o
465WO2 = $(WO1) ZZ_pX1.o lip.o tools.o vec_ZZ.o vec_ZZ_p.o vec_long.o
466
467WOBJ = $(WO2)
468
469
470wntl.a: $(WOBJ) 
471        $(AR) $(ARFLAGS) wntl.a $(WOBJ)
472        - $(RANLIB) wntl.a
473
474
475
476MulTimeTest:
477        $(LINK_CXX) -o MulTimeTest MulTimeTest.c wntl.a  $(GMP_LIBDIR) $(GMP_LIB)  $(LDLIBS_CXX)
478
479PolyTimeTest:
480        $(LINK_CXX) -o PolyTimeTest PolyTimeTest.c wntl.a  $(GMP_LIBDIR) $(GMP_LIB) $(LDLIBS_CXX)
481
482InitSettings:
483        $(LINK_CXX) -o InitSettings InitSettings.c  $(LDLIBS_CXX)
484
485WizComp:
486        $(LINK_CXX) -o WizComp WizComp.c $(LDLIBS_CXX)
487
488DispSettings:
489        $(LINK_CXX) -o DispSettings DispSettings.c $(LDLIBS_CXX)
Note: See TracBrowser for help on using the repository browser.