Rearrange the file tree.
[u/mdw/catacomb] / math / Makefile.am
CommitLineData
0f00dc4c
MW
1### -*-makefile-*-
2###
3### Build script for mathematical infrastructure
4###
5### (c) 2013 Straylight/Edgeware
6###
7
8###----- Licensing notice ---------------------------------------------------
9###
10### This file is part of Catacomb.
11###
12### Catacomb is free software; you can redistribute it and/or modify
13### it under the terms of the GNU Library General Public License as
14### published by the Free Software Foundation; either version 2 of the
15### License, or (at your option) any later version.
16###
17### Catacomb is distributed in the hope that it will be useful,
18### but WITHOUT ANY WARRANTY; without even the implied warranty of
19### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20### GNU Library General Public License for more details.
21###
22### You should have received a copy of the GNU Library General Public
23### License along with Catacomb; if not, write to the Free
24### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25### MA 02111-1307, USA.
26
27include $(top_srcdir)/vars.am
28
29noinst_LTLIBRARIES = libmath.la
30libmath_la_SOURCES =
31nodist_libmath_la_SOURCES =
32libmath_la_LIBADD =
33
34TEST_LIBS = libmath.la
35
36###--------------------------------------------------------------------------
37### Main multiprecision integer library.
38
39## This library is unfortunately intertwined with some of the code generation
40## programs, so we must be rather careful. The important bits of the maths
41## library needed by these programs is separated out into `libmpbase'. There
42## is work going on to fix this unpleasant situation by generating the
43## relevant files from Python scripts rather than C programs, using
44## information gathered by `configure'.
45noinst_LTLIBRARIES += libmpbase.la
46libmath_la_LIBADD += libmpbase.la
47libmpbase_la_LIBADD = $(mLib_LIBS)
48libmpbase_la_SOURCES =
49$(libmpbase_la_OBJECTS): mptypes.h
50
51## Additional buffer I/O functions for mathematical objects.
52pkginclude_HEADERS += buf.h
53libmath_la_SOURCES += buf.c
54
55## Infrastructure for fast exponentiation.
56pkginclude_HEADERS += exp.h
57libmath_la_SOURCES += exp.c
58
59## Main user-visible multiprecision arithmetic.
60pkginclude_HEADERS += mp.h
61libmpbase_la_SOURCES += mp-arith.c
62TESTS += mp-arith.$t
63libmpbase_la_SOURCES += mp-const.c
64libmath_la_SOURCES += mp-exp.c mp-exp.h
65libmath_la_SOURCES += mp-gcd.c
66TESTS += mp-gcd.$t
67libmpbase_la_SOURCES += mp-io.c
68libmath_la_SOURCES += mp-jacobi.c
69TESTS += mp-jacobi.$t
70libmpbase_la_SOURCES += mp-mem.c
71libmpbase_la_SOURCES += mp-misc.c
72libmath_la_SOURCES += mp-modexp.c
73TESTS += mp-modexp.$t
74libmath_la_SOURCES += mp-modsqrt.c
75TESTS += mp-modsqrt.$t
76libmath_la_SOURCES += mp-sqrt.c
77TESTS += mp-sqrt.$t
78libmath_la_SOURCES += mp-test.c
79EXTRA_DIST += t/mp
80
81## Computing Fibonacci numbers.
82pkginclude_HEADERS += mp-fibonacci.h
83libmath_la_SOURCES += mp-fibonacci.c
84TESTS += mp-fibonacci.$t
85
86## Special memory allocation for multiprecision integers.
87pkginclude_HEADERS += mparena.h
88libmpbase_la_SOURCES += mparena.c
89
90## Barrett reduction, an efficient method for modular reduction.
91pkginclude_HEADERS += mpbarrett.h
92libmath_la_SOURCES += mpbarrett.c
93TESTS += mpbarrett.$t
94libmath_la_SOURCES += mpbarrett-exp.c mpbarrett-mexp.c mpbarrett-exp.h
95TESTS += mpbarrett-exp.$t mpbarrett-mexp.$t
96TESTS += mpbarrett.$t
97EXTRA_DIST += t/mpbarrett
98
99## Solving congruences using the Chinese Remainder Theorem.
100pkginclude_HEADERS += mpcrt.h
101libmath_la_SOURCES += mpcrt.c
102TESTS += mpcrt.$t
103EXTRA_DIST += t/mpcrt
104
105## Conversions between machine-native and multiprecision integers.
106pkginclude_HEADERS += mpint.h
107libmath_la_SOURCES += mpint.c
108TESTS += mpint.$t
109EXTRA_DIST += t/mpint
110
111## Table of upper and lower limits of various types of machine integers, as
112## multiprecision integers.
113nodist_archinclude_HEADERS += mplimits.h
114nodist_libmath_la_SOURCES += mplimits.c
115CLEANFILES += mplimits.h mplimits.c
116noinst_PROGRAMS += genlimits
117genlimits_LDADD = libmpbase.la
118mplimits.c: genlimits$e
119 $(AM_V_GEN)./genlimits c >mplimits.c.new && \
120 mv mplimits.c.new mplimits.c
121mplimits.h: genlimits$e
122 $(AM_V_GEN)./genlimits h >mplimits.h.new && \
123 mv mplimits.h.new mplimits.h
124$(genlimits_OBJECTS): mptypes.h
125mplimits.lo: mplimits.h
126
127## Montgomery reduction, a clever method for modular arithmetic.
128pkginclude_HEADERS += mpmont.h
129libmath_la_SOURCES += mpmont.c
130TESTS += mpmont.$t
131libmath_la_SOURCES += mpmont-exp.c mpmont-mexp.c mpmont-exp.h
132TESTS += mpmont-exp.$t mpmont-mexp.$t
133EXTRA_DIST += t/mpmont
134
135## Efficient multiplication of many small numbers.
136pkginclude_HEADERS += mpmul.h
137libmath_la_SOURCES += mpmul.c
138TESTS += mpmul.$t
139
140## Generating random numbers.
141pkginclude_HEADERS += mprand.h
142libmath_la_SOURCES += mprand.c
143
144## Efficient reduction modulo numbers with conveninent binary
145## representations.
146pkginclude_HEADERS += mpreduce.h
147libmath_la_SOURCES += mpreduce.c mpreduce-exp.h
148TESTS += mpreduce.$t
149EXTRA_DIST += t/mpreduce
150
151## Iteratiion over the bianry representation of multiprecision integers.
152pkginclude_HEADERS += mpscan.h
153libmpbase_la_SOURCES += mpscan.c
154
155## Conversion between multiprecision integers and their textual
156## representations.
157pkginclude_HEADERS += mptext.h
158libmpbase_la_SOURCES += mptext.c
159TESTS += mptext.$t
160libmath_la_SOURCES += mptext-dstr.c
161libmath_la_SOURCES += mptext-file.c
162libmath_la_SOURCES += mptext-len.c
163libmpbase_la_SOURCES += mptext-string.c
164EXTRA_DIST += t/mptext
165
166## Basic types used in the representation of multiprecision integers.
167nodist_archinclude_HEADERS += mptypes.h
168BUILT_SOURCES += mptypes.h
169CLEANFILES += mptypes.h
170noinst_PROGRAMS += mptypes
171mptypes.h: mptypes$e
172 $(AM_V_GEN)./mptypes >mptypes.h.new && mv mptypes.h.new mptypes.h
173
174## Low-level multiprecision arithmetic.
175pkginclude_HEADERS += mpx.h bitops.h mpw.h
176libmpbase_la_SOURCES += mpx.c
177TESTS += mpx.$t
178libmpbase_la_SOURCES += karatsuba.h mpx-kmul.c mpx-ksqr.c
179TESTS += mpx-kmul.$t mpx-ksqr.$t
180noinst_PROGRAMS += bittest
181TESTS += bittest
182EXTRA_DIST += t/mpx
183
184## A quick-and-dirty parser, used for parsing descriptions of groups, fields,
185## etc.
186pkginclude_HEADERS += qdparse.h
187libmath_la_SOURCES += qdparse.c
188
189## Pollard's `rho' algorithm for determining discrete logarithms.
190pkginclude_HEADERS += rho.h
191libmath_la_SOURCES += rho.c
192TESTS += rho.$t
193
194###--------------------------------------------------------------------------
195### Prime number checking, searching, and related jobs.
196
197## Generating Lim--Lee groups, i.e., unit groups of finite fields without
198## small subgroups (except for the obvious ones).
199pkginclude_HEADERS += limlee.h
200libmath_la_SOURCES += limlee.c
201
202## A table of small prime numbers.
203nodist_pkginclude_HEADERS += primetab.h
204nodist_libmath_la_SOURCES += primetab.c
205CLEANFILES += primetab.h primetab.c
206BUILT_SOURCES += primetab.h primetab.c
207noinst_PROGRAMS += genprimes
208genprimes_LDADD = $(mLib_LIBS)
209primetab.h: primetab.c
210primetab.c: genprimes$e
211 $(AM_V_GEN)./genprimes -hprimetab.h -cprimetab.c \
212 -sCATACOMB_PRIMETAB_H \
213 -n256 -t"unsigned short" -iprimetab
214
215## Filtering candidate prime numbers by checking for small factors
216## efficiently.
217pkginclude_HEADERS += pfilt.h
218libmath_la_SOURCES += pfilt.c
219
220## Generating prime numbers (and other kinds of numbers which need searching
221## for).
222pkginclude_HEADERS += pgen.h
223libmath_la_SOURCES += pgen.c
224libmath_la_SOURCES += pgen-gcd.c
225libmath_la_SOURCES += pgen-simul.c
226libmath_la_SOURCES += pgen-stdev.c
227TESTS += pgen.$t
228EXTRA_DIST += t/pgen
229
230## Finding primitive elements in finite fields.
231pkginclude_HEADERS += prim.h
232libmath_la_SOURCES += prim.c
233
234## Iterating over all prime numbers from a given starting point.
235pkginclude_HEADERS += primeiter.h
236libmath_la_SOURCES += primeiter.c
237TESTS += primeiter.$t
238primeiter.lo: wheel.h
239
240## The Miller--Rabin primality test.
241pkginclude_HEADERS += rabin.h
242libmath_la_SOURCES += rabin.c
243
244## Finding `strong' primes, using Gordon's algorithm. Once upon a time,
245## products of these kinds of numbers were harder to factor.
246pkginclude_HEADERS += strongprime.h
247libmath_la_SOURCES += strongprime.c
248
249## A `wheel', used by the prime iteration machinery.
250nodist_pkginclude_HEADERS += wheel.h
251nodist_libmath_la_SOURCES += wheel.c
252CLEANFILES += wheel.h wheel.c
253noinst_PROGRAMS += genwheel
254genwheel_LDADD = $(mLib_LIBS)
255wheel.h: wheel.c
256wheel.c: genwheel$e
257 $(AM_V_GEN)./genwheel -hwheel.h -cwheel.c \
258 -sCATACOMB_WHEEL_H \
259 -n5 -t"unsigned char" -iwheel
260
261###--------------------------------------------------------------------------
262### Binary polynomial arithmetic.
263
264## User-visible binary polynomial arithmetic.
265pkginclude_HEADERS += gf.h
266libmath_la_SOURCES += gf-arith.c
267TESTS += gf-arith.$t
268libmath_la_SOURCES += gf-exp.c gf-exp.h
269libmath_la_SOURCES += gf-gcd.c
270TESTS += gf-gcd.$t
271EXTRA_DIST += t/gf
272
273## Low-level binary polynomial arithmetic.
274pkginclude_HEADERS += gfx.h
275libmath_la_SOURCES += gfx.c
276TESTS += gfx.$t
277libmath_la_SOURCES += gfx-kmul.c
278TESTS += gfx-kmul.$t
279libmath_la_SOURCES += gfx-sqr.c
280gfx-sqr.lo: gfx-sqr-tab.h
281TESTS += gfx-sqr.$t
282CLEANFILES += gfx-sqr-tab.h
283noinst_PROGRAMS += gfx-sqr-mktab
284gfx-sqr-tab.h: gfx-sqr-mktab$e
285 $(AM_V_GEN)./gfx-sqr-mktab >gfx-sqr-tab.h.in && \
286 mv gfx-sqr-tab.h.in gfx-sqr-tab.h
287EXTRA_DIST += t/gfx
288
289## Conversions between normal and polynomial basis representations for binary
290## fields.
291pkginclude_HEADERS += gfn.h
292libmath_la_SOURCES += gfn.c
293TESTS += gfn.$t
294EXTRA_DIST += t/gfn
295
296## Efficient reduction modulo sparse polynomials.
297pkginclude_HEADERS += gfreduce.h
298libmath_la_SOURCES += gfreduce.c gfreduce-exp.h
299TESTS += gfreduce.$t
300EXTRA_DIST += t/gfreduce
301
302###--------------------------------------------------------------------------
303### Abstractions for various kinds of algebraic objects.
304
305## Abstract cyclic groups.
306pkginclude_HEADERS += group.h group-guts.h
307libmath_la_SOURCES += group-dstr.c
308libmath_la_SOURCES += group-exp.c group-exp.h
309libmath_la_SOURCES += group-file.c
310libmath_la_SOURCES += group-parse.c
311libmath_la_SOURCES += group-stdops.c
312libmath_la_SOURCES += group-string.c
313libmath_la_SOURCES += g-bin.c
314libmath_la_SOURCES += g-prime.c
315libmath_la_SOURCES += g-ec.c
316EXTRA_DIST += group-test.c
317TESTS += group-test.$t
318EXTRA_DIST += t/group
319
320## Abstract finite fields.
321pkginclude_HEADERS += field.h field-guts.h
322libmath_la_SOURCES += field.c
323libmath_la_SOURCES += field-exp.c field-exp.h
324libmath_la_SOURCES += field-parse.c
325libmath_la_SOURCES += f-binpoly.c
326libmath_la_SOURCES += f-niceprime.c
327libmath_la_SOURCES += f-prime.c
328
329## Table of built-in binary fields.
330pkginclude_HEADERS += bintab.h
331libmath_la_SOURCES += bintab.c
332CLEANFILES += bintab.c
333EXTRA_DIST += bintab.in bin-gentab.awk
334bintab.c: bintab.in bin-gentab.awk mpdump$e
335 $(AM_V_GEN)awk -f $(srcdir)/bin-gentab.awk \
336 <$(srcdir)/bintab.in >bintab.c.new && \
337 mv bintab.c.new bintab.c
338
339## Table of built-in prime fields.
340pkginclude_HEADERS += ptab.h
341libmath_la_SOURCES += ptab.c
342CLEANFILES += ptab.c
343EXTRA_DIST += ptab.in p-gentab.awk
344ptab.c: ptab.in p-gentab.awk mpdump$e
345 $(AM_V_GEN)awk -f $(srcdir)/p-gentab.awk \
346 <$(srcdir)/ptab.in >ptab.c.new && \
347 mv ptab.c.new ptab.c
348
349## A utility for building multiprecision integer constants.
350noinst_PROGRAMS += mpdump
351mpdump_LDADD = libmpbase.la
352$(mpdump_OBJECTS): mptypes.h
353
354###--------------------------------------------------------------------------
355### Elliptic curve arithmetic.
356
357## Basic elliptic curve arithmetic.
358pkginclude_HEADERS += ec.h ec-guts.h
359libmath_la_SOURCES += ec.c
360libmath_la_SOURCES += ec-exp.c ec-exp.h
361libmath_la_SOURCES += ec-info.c
362TESTS += ec-info.$t
363libmath_la_SOURCES += ec-bin.c
364TESTS += ec-bin.$t
365libmath_la_SOURCES += ec-prime.c
366TESTS += ec-prime.$t
367EXTRA_DIST += t/ec
368
369## The standard `raw' encoding (`EC2OSP') of elliptic curve points.
370pkginclude_HEADERS += ec-raw.h
371libmath_la_SOURCES += ec-raw.c
372
373## Assistance for elliptic-curve keys.
374pkginclude_HEADERS += ec-keys.h
375libmath_la_SOURCES += ec-fetch.c
376
377## Test infrastructure for elliptic curves.
378pkginclude_HEADERS += ec-test.h
379libmath_la_SOURCES += ec-test.c
380TESTS += ec-test.$t
381
382## A table of built-in elliptic curves.
383pkginclude_HEADERS += ectab.h
384libmath_la_SOURCES += ectab.c
385CLEANFILES += ectab.c
386EXTRA_DIST += ectab.in ec-gentab.awk
387ectab.c: ectab.in ec-gentab.awk mpdump$e
388 $(AM_V_GEN)awk -f $(srcdir)/ec-gentab.awk \
389 <$(srcdir)/ectab.in >ectab.c.new && \
390 mv ectab.c.new ectab.c
391
392###----- That's all, folks --------------------------------------------------