comparison makefile @ 386:97db060d0ef5 libtommath-orig libtommath-0.40

Update to LibTomMath 0.40
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 03:11:15 +0000
parents 91fbc376f010
children
comparison
equal deleted inserted replaced
282:91fbc376f010 386:97db060d0ef5
1 #Makefile for GCC 1 #Makefile for GCC
2 # 2 #
3 #Tom St Denis 3 #Tom St Denis
4 4
5 #version of library 5 #version of library
6 VERSION=0.35 6 VERSION=0.40
7 7
8 CFLAGS += -I./ -Wall -W -Wshadow -Wsign-compare 8 CFLAGS += -I./ -Wall -W -Wshadow -Wsign-compare
9 9
10 ifndef MAKE
11 MAKE=make
12 endif
13
14 ifndef IGNORE_SPEED
15
10 #for speed 16 #for speed
11 CFLAGS += -O3 -funroll-all-loops 17 CFLAGS += -O3 -funroll-loops
12 18
13 #for size 19 #for size
14 #CFLAGS += -Os 20 #CFLAGS += -Os
15 21
16 #x86 optimizations [should be valid for any GCC install though] 22 #x86 optimizations [should be valid for any GCC install though]
17 CFLAGS += -fomit-frame-pointer 23 CFLAGS += -fomit-frame-pointer
18 24
19 #debug 25 #debug
20 #CFLAGS += -g3 26 #CFLAGS += -g3
21 27
28 endif
29
22 #install as this user 30 #install as this user
23 USER=root 31 ifndef INSTALL_GROUP
24 GROUP=root 32 GROUP=wheel
33 else
34 GROUP=$(INSTALL_GROUP)
35 endif
25 36
26 default: libtommath.a 37 ifndef INSTALL_USER
38 USER=root
39 else
40 USER=$(INSTALL_USER)
41 endif
27 42
28 #default files to install 43 #default files to install
29 LIBNAME=libtommath.a 44 ifndef LIBNAME
45 LIBNAME=libtommath.a
46 endif
47
48 default: ${LIBNAME}
49
30 HEADERS=tommath.h tommath_class.h tommath_superclass.h 50 HEADERS=tommath.h tommath_class.h tommath_superclass.h
31 51
32 #LIBPATH-The directory for libtommath to be installed to. 52 #LIBPATH-The directory for libtommath to be installed to.
33 #INCPATH-The directory to install the header files for libtommath. 53 #INCPATH-The directory to install the header files for libtommath.
34 #DATAPATH-The directory to install the pdf docs. 54 #DATAPATH-The directory to install the pdf docs.
63 bn_mp_init_multi.o bn_mp_clear_multi.o bn_mp_exteuclid.o bn_mp_toradix_n.o \ 83 bn_mp_init_multi.o bn_mp_clear_multi.o bn_mp_exteuclid.o bn_mp_toradix_n.o \
64 bn_mp_prime_random_ex.o bn_mp_get_int.o bn_mp_sqrt.o bn_mp_is_square.o bn_mp_init_set.o \ 84 bn_mp_prime_random_ex.o bn_mp_get_int.o bn_mp_sqrt.o bn_mp_is_square.o bn_mp_init_set.o \
65 bn_mp_init_set_int.o bn_mp_invmod_slow.o bn_mp_prime_rabin_miller_trials.o \ 85 bn_mp_init_set_int.o bn_mp_invmod_slow.o bn_mp_prime_rabin_miller_trials.o \
66 bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin_n.o 86 bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin_n.o
67 87
68 libtommath.a: $(OBJECTS) 88 $(LIBNAME): $(OBJECTS)
69 $(AR) $(ARFLAGS) libtommath.a $(OBJECTS) 89 $(AR) $(ARFLAGS) $@ $(OBJECTS)
70 ranlib libtommath.a 90 ranlib $@
71 91
72 #make a profiled library (takes a while!!!) 92 #make a profiled library (takes a while!!!)
73 # 93 #
74 # This will build the library with profile generation 94 # This will build the library with profile generation
75 # then run the test demo and rebuild the library. 95 # then run the test demo and rebuild the library.
87 $(CC) $(CFLAGS) -fprofile-arcs -DTESTING -c mpi.c -o mpi.o 107 $(CC) $(CFLAGS) -fprofile-arcs -DTESTING -c mpi.c -o mpi.o
88 $(CC) $(CFLAGS) -DTESTING -DTIMER demo/timing.c mpi.o -o ltmtest 108 $(CC) $(CFLAGS) -DTESTING -DTIMER demo/timing.c mpi.o -o ltmtest
89 ./ltmtest 109 ./ltmtest
90 rm -f *.o ltmtest 110 rm -f *.o ltmtest
91 $(CC) $(CFLAGS) -fbranch-probabilities -DTESTING -c mpi.c -o mpi.o 111 $(CC) $(CFLAGS) -fbranch-probabilities -DTESTING -c mpi.c -o mpi.o
92 $(AR) $(ARFLAGS) libtommath.a mpi.o 112 $(AR) $(ARFLAGS) $(LIBNAME) mpi.o
93 ranlib libtommath.a 113 ranlib $(LIBNAME)
94 114
95 install: libtommath.a 115 install: $(LIBNAME)
96 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH) 116 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
97 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH) 117 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
98 install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH) 118 install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
99 install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH) 119 install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
100 120
101 test: libtommath.a demo/demo.o 121 test: $(LIBNAME) demo/demo.o
102 $(CC) $(CFLAGS) demo/demo.o libtommath.a -o test 122 $(CC) $(CFLAGS) demo/demo.o $(LIBNAME) -o test
103 123
104 mtest: test 124 mtest: test
105 cd mtest ; $(CC) $(CFLAGS) mtest.c -o mtest 125 cd mtest ; $(CC) $(CFLAGS) mtest.c -o mtest
106 126
107 timing: libtommath.a 127 timing: $(LIBNAME)
108 $(CC) $(CFLAGS) -DTIMER demo/timing.c libtommath.a -o ltmtest 128 $(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) -o ltmtest
109 129
110 # makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think] 130 # makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think]
111 docdvi: tommath.src 131 docdvi: tommath.src
112 cd pics ; make 132 cd pics ; MAKE=${MAKE} ${MAKE}
113 echo "hello" > tommath.ind 133 echo "hello" > tommath.ind
114 perl booker.pl 134 perl booker.pl
115 latex tommath > /dev/null 135 latex tommath > /dev/null
116 latex tommath > /dev/null 136 latex tommath > /dev/null
117 makeindex tommath 137 makeindex tommath
124 144
125 # makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files 145 # makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files
126 docs: docdvi 146 docs: docdvi
127 dvipdf tommath 147 dvipdf tommath
128 rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg 148 rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg
129 cd pics ; make clean 149 cd pics ; MAKE=${MAKE} ${MAKE} clean
130 150
131 #LTM user manual 151 #LTM user manual
132 mandvi: bn.tex 152 mandvi: bn.tex
133 echo "hello" > bn.ind 153 echo "hello" > bn.ind
134 latex bn > /dev/null 154 latex bn > /dev/null
144 pretty: 164 pretty:
145 perl pretty.build 165 perl pretty.build
146 166
147 clean: 167 clean:
148 rm -f *.bat *.pdf *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \ 168 rm -f *.bat *.pdf *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \
149 *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find -type f | grep [~] | xargs` *.lo *.la 169 *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la
150 rm -rf .libs 170 rm -rf .libs
151 cd etc ; make clean 171 cd etc ; MAKE=${MAKE} ${MAKE} clean
152 cd pics ; make clean 172 cd pics ; MAKE=${MAKE} ${MAKE} clean
173
174 #zipup the project (take that!)
175 no_oops: clean
176 cd .. ; cvs commit
177 echo Scanning for scratch/dirty files
178 find . -type f | grep -v CVS | xargs -n 1 bash mess.sh
153 179
154 zipup: clean manual poster docs 180 zipup: clean manual poster docs
155 perl gen.pl ; mv mpi.c pre_gen/ ; \ 181 perl gen.pl ; mv mpi.c pre_gen/ ; \
156 cd .. ; rm -rf ltm* libtommath-$(VERSION) ; mkdir libtommath-$(VERSION) ; \ 182 cd .. ; rm -rf ltm* libtommath-$(VERSION) ; mkdir libtommath-$(VERSION) ; \
157 cp -R ./libtommath/* ./libtommath-$(VERSION)/ ; \ 183 cp -R ./libtommath/* ./libtommath-$(VERSION)/ ; \
158 tar -c libtommath-$(VERSION)/* | bzip2 -9vvc > ltm-$(VERSION).tar.bz2 ; \ 184 tar -c libtommath-$(VERSION)/* | bzip2 -9vvc > ltm-$(VERSION).tar.bz2 ; \
159 zip -9 -r ltm-$(VERSION).zip libtommath-$(VERSION)/* 185 zip -9 -r ltm-$(VERSION).zip libtommath-$(VERSION)/* ; \
186 mv -f ltm* ~ ; rm -rf libtommath-$(VERSION)