comparison libtommath/Makefile.in @ 1470:8bba51a55704

Update to libtommath v1.0.1
author Matt Johnston <matt@ucc.asn.au>
date Thu, 08 Feb 2018 23:11:40 +0800
parents ef310db5ccec
children 47fcbdd12d9b
comparison
equal deleted inserted replaced
1469:51043e868f55 1470:8bba51a55704
12 silent= 12 silent=
13 else 13 else
14 silent=@ 14 silent=@
15 endif 15 endif
16 16
17 %.o: %.c
18 ifneq ($V,1)
19 @echo " * ${CC} $@"
20 endif
21 ${silent} ${CC} -c ${CFLAGS} $^ -o $@
22
23 #default files to install 17 #default files to install
24 ifndef LIBNAME 18 ifndef LIBNAME
25 LIBNAME=libtommath.a 19 LIBNAME=libtommath.a
26 endif 20 endif
27 21
28 coverage: LIBNAME:=-Wl,--whole-archive $(LIBNAME) -Wl,--no-whole-archive 22 coverage: LIBNAME:=-Wl,--whole-archive $(LIBNAME) -Wl,--no-whole-archive
23
24 include $(srcdir)/makefile_include.mk
25
26 %.o: %.c
27 ifneq ($V,1)
28 @echo " * ${CC} $@"
29 endif
30 ${silent} ${CC} -c ${CFLAGS} $< -o $@
29 31
30 LCOV_ARGS=--directory . 32 LCOV_ARGS=--directory .
31 33
32 #START_INS 34 #START_INS
33 OBJECTS=bncore.o bn_error.o bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \ 35 OBJECTS=bncore.o bn_error.o bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
54 bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o \ 56 bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o \
55 bn_prime_tab.o bn_reverse.o bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o bn_s_mp_mul_high_digs.o \ 57 bn_prime_tab.o bn_reverse.o bn_s_mp_add.o bn_s_mp_exptmod.o bn_s_mp_mul_digs.o bn_s_mp_mul_high_digs.o \
56 bn_s_mp_sqr.o bn_s_mp_sub.o 58 bn_s_mp_sqr.o bn_s_mp_sub.o
57 59
58 #END_INS 60 #END_INS
61
62 $(OBJECTS): $(HEADERS)
59 63
60 $(LIBNAME): $(OBJECTS) 64 $(LIBNAME): $(OBJECTS)
61 $(AR) $(ARFLAGS) $@ $(OBJECTS) 65 $(AR) $(ARFLAGS) $@ $(OBJECTS)
62 $(RANLIB) $@ 66 $(RANLIB) $@
63 67
88 install -d $(DESTDIR)$(LIBPATH) 92 install -d $(DESTDIR)$(LIBPATH)
89 install -d $(DESTDIR)$(INCPATH) 93 install -d $(DESTDIR)$(INCPATH)
90 install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH) 94 install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)
91 install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH) 95 install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
92 96
97 uninstall:
98 rm $(DESTDIR)$(LIBPATH)/$(LIBNAME)
99 rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%)
100
93 test: $(LIBNAME) demo/demo.o 101 test: $(LIBNAME) demo/demo.o
94 $(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test 102 $(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test
95 103
96 test_standalone: $(LIBNAME) demo/demo.o 104 test_standalone: $(LIBNAME) demo/demo.o
97 $(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test 105 $(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test
98 106
99 .PHONY: mtest 107 .PHONY: mtest
100 mtest: 108 mtest:
101 cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest 109 cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest
102 110
111 travis_mtest: test mtest
112 @ for i in `seq 1 10` ; do sleep 500 && echo alive; done &
113 ./mtest/mtest 666666 | ./test > test.log
114
103 timing: $(LIBNAME) 115 timing: $(LIBNAME)
104 $(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest 116 $(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest
105 117
106 coveralls: coverage 118 # You have to create a file .coveralls.yml with the content "repo_token: <the token>"
107 cpp-coveralls 119 # in the base folder to be able to submit to coveralls
120 coveralls: lcov
121 coveralls-lcov
108 122
109 # makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think] 123 docdvi poster docs mandvi manual:
110 docdvi: tommath.src 124 $(MAKE) -C doc/ $@ V=$(V)
111 cd pics ; MAKE=${MAKE} ${MAKE}
112 echo "hello" > tommath.ind
113 perl booker.pl
114 latex tommath > /dev/null
115 latex tommath > /dev/null
116 makeindex tommath
117 latex tommath > /dev/null
118
119 # poster, makes the single page PDF poster
120 poster: poster.tex
121 cp poster.tex poster.bak
122 touch --reference=poster.tex poster.bak
123 (printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y poster.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > poster-deterministic.tex
124 printf "%s\n" "\pdfinfo{" >> poster-deterministic.tex
125 printf "%s\n" " /CreationDate (\fixedpdfdate)" >> poster-deterministic.tex
126 printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> poster-deterministic.tex
127 cat poster.tex >> poster-deterministic.tex
128 mv poster-deterministic.tex poster.tex
129 touch --reference=poster.bak poster.tex
130 pdflatex poster
131 sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' poster.pdf
132 mv poster.bak poster.tex
133 rm -f poster.aux poster.log poster.out
134
135 # makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files
136 docs: docdvi
137 dvipdf tommath
138 rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg
139 cd pics ; MAKE=${MAKE} ${MAKE} clean
140
141 #LTM user manual
142 mandvi: bn.tex
143 cp bn.tex bn.bak
144 touch --reference=bn.tex bn.bak
145 (printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y bn.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > bn-deterministic.tex
146 printf "%s\n" "\pdfinfo{" >> bn-deterministic.tex
147 printf "%s\n" " /CreationDate (\fixedpdfdate)" >> bn-deterministic.tex
148 printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> bn-deterministic.tex
149 cat bn.tex >> bn-deterministic.tex
150 mv bn-deterministic.tex bn.tex
151 touch --reference=bn.bak bn.tex
152 echo "hello" > bn.ind
153 latex bn > /dev/null
154 latex bn > /dev/null
155 makeindex bn
156 latex bn > /dev/null
157
158 #LTM user manual [pdf]
159 manual: mandvi
160 pdflatex bn >/dev/null
161 sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' bn.pdf
162 mv bn.bak bn.tex
163 rm -f bn.aux bn.dvi bn.log bn.idx bn.lof bn.out bn.toc
164 125
165 pretty: 126 pretty:
166 perl pretty.build 127 perl pretty.build
128
129 #\zipup the project (take that!)
130 no_oops: clean
131 cd .. ; cvs commit
132 echo Scanning for scratch/dirty files
133 find . -type f | grep -v CVS | xargs -n 1 bash mess.sh
167 134
168 clean: 135 clean:
169 rm -f *.bat *.pdf *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \ 136 rm -f *.bat *.pdf *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \
170 *.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 137 *.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
171 rm -rf .libs 138 rm -rf .libs
172 -cd etc && MAKE=${MAKE} ${MAKE} clean 139 -cd etc && MAKE=${MAKE} ${MAKE} clean
173 -cd pics && MAKE=${MAKE} ${MAKE} clean 140 -cd pics && MAKE=${MAKE} ${MAKE} clean
174 141
175 #\zipup the project (take that!)
176 no_oops: clean
177 cd .. ; cvs commit
178 echo Scanning for scratch/dirty files
179 find . -type f | grep -v CVS | xargs -n 1 bash mess.sh
180
181 .PHONY: pre_gen 142 .PHONY: pre_gen
182 pre_gen: 143 pre_gen:
183 perl gen.pl 144 perl gen.pl
184 sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c 145 sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
185 rm mpi.c 146 rm mpi.c
186 147
187 zipup: 148 zipup: clean pre_gen new_file manual poster docs
188 rm -rf ../libtommath-$(VERSION) \ 149 @# Update the index, so diff-index won't fail in case the pdf has been created.
189 && rm -f ../ltm-$(VERSION).zip ../ltm-$(VERSION).zip.asc ../ltm-$(VERSION).tar.xz ../ltm-$(VERSION).tar.xz.asc 150 @# As the pdf creation modifies the tex files, git sometimes detects the
190 git archive HEAD --prefix=libtommath-$(VERSION)/ > ../libtommath-$(VERSION).tar 151 @# modified files, but misses that it's put back to its original version.
191 cd .. ; tar xf libtommath-$(VERSION).tar 152 @git update-index --refresh
192 MAKE=${MAKE} ${MAKE} -C ../libtommath-$(VERSION) clean manual poster docs 153 @git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 )
193 tar -c ../libtommath-$(VERSION)/* | xz -9 > ../ltm-$(VERSION).tar.xz 154 rm -rf libtommath-$(VERSION) ltm-$(VERSION).*
194 find ../libtommath-$(VERSION)/ -type f -exec unix2dos -q {} \; 155 @# files/dirs excluded from "git archive" are defined in .gitattributes
195 cd .. ; zip -9r ltm-$(VERSION).zip libtommath-$(VERSION) 156 git archive --format=tar --prefix=libtommath-$(VERSION)/ HEAD | tar x
196 gpg -b -a ../ltm-$(VERSION).tar.xz && gpg -b -a ../ltm-$(VERSION).zip 157 mkdir -p libtommath-$(VERSION)/doc
158 cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/
159 tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz
160 zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION)
161 rm -rf libtommath-$(VERSION)
162 gpg -b -a ltm-$(VERSION).tar.xz
163 gpg -b -a ltm-$(VERSION).zip
197 164
198 new_file: 165 new_file:
199 bash updatemakes.sh 166 bash updatemakes.sh
200 perl dep.pl 167 perl dep.pl
168
169 perlcritic:
170 perlcritic *.pl