Expunge revision histories in files.
[u/mdw/catacomb] / Makefile.m4
... / ...
CommitLineData
1## -*-m4-*-
2##
3## $Id: Makefile.m4,v 1.80 2004/04/08 01:36:15 mdw Exp $
4##
5## Makefile for Catacomb
6##
7## (c) 1999 Straylight/Edgeware
8##
9
10##----- Licensing notice ----------------------------------------------------
11##
12## This file is part of Catacomb.
13##
14## Catacomb is free software; you can redistribute it and/or modify
15## it under the terms of the GNU Library General Public License as
16## published by the Free Software Foundation; either version 2 of the
17## License, or (at your option) any later version.
18##
19## Catacomb is distributed in the hope that it will be useful,
20## but WITHOUT ANY WARRANTY; without even the implied warranty of
21## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22## GNU Library General Public License for more details.
23##
24## You should have received a copy of the GNU Library General Public
25## License along with Catacomb; if not, write to the Free
26## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27## MA 02111-1307, USA.
28
29AUTOMAKE_OPTIONS = foreign
30
31SUBDIRS = tests
32
33archincludedir = $(libdir)/catacomb/include
34
35## --- List handling macros ---
36##
37## List handling is nice, usually. Unfortunately, I based this design on
38## TeX list macros rather than anything sensible...
39
40define(`_', `define(`_item', $1)define(`_item_2', $2)emit`'')
41define(`adorn', `pushdef(`emit', `$1`'_item`'$3')$2`'popdef(`emit')')
42define(`join',
43`pushdef(`emit', `adorn(``_(''_item`$2', `$3', ``)'')`'')$1`'popdef(`emit')')
44define(`addsuffix', `adorn(`', `$1', `$2')')
45define(`lit', `adorn(`', `$1', `')')
46define(`nl', `
47')
48
49define(`allwithsuffix',
50`addsuffix(`$1', `$3') addsuffix(`$2', `$3') dnl
51addsuffix(join(`$1', `-', `$2'), `$3')')
52
53## --- Autogenerated source files ---
54
55define(`ciphers', `dnl
56_(des) _(desx) _(des3) _(mars) dnl
57_(idea) _(safer) _(safersk) dnl
58_(blowfish) _(twofish) dnl
59_(tea) _(xtea) dnl
60_(rc2) _(rc5) dnl
61_(skipjack) dnl
62_(cast128) _(cast256) dnl
63_(square) _(rijndael) _(rijndael192) _(rijndael256) dnl
64_(serpent) _(noekeon)')
65define(`cipher_modes', `_(ecb) _(cbc) _(cfb) _(ofb) _(counter)')
66
67define(`hashes', `dnl
68_(md5) _(md4) _(md2) _(tiger) _(has160) dnl
69_(sha) _(sha224) _(sha256) _(sha384) _(sha512) dnl
70_(rmd128) _(rmd160) _(rmd256) _(rmd320)')
71define(`hash_modes', `_(mgf) _(hmac)')
72
73MODES = \
74 adorn(`$(srcdir)/', join(`ciphers', `-', `cipher_modes'), `.c') \
75 adorn(`$(srcdir)/', join(`ciphers', `-', `cipher_modes'), `.h') \
76 adorn(`$(srcdir)/', join(`hashes', `-', `hash_modes'), `.c') \
77 adorn(`$(srcdir)/', join(`hashes', `-', `hash_modes'), `.h')
78
79$(MODES): modes-stamp
80modes-stamp: genmodes
81 cd $(srcdir); ./genmodes "lit(`ciphers')" "lit(`cipher_modes')"
82 cd $(srcdir); ./genmodes "lit(`hashes')" "lit(`hash_modes')"
83 echo datestamp >modes-stamp
84
85define(`gen_tables', `dnl
86_(des) _(blowfish) _(twofish) dnl
87_(square) _(rijndael) dnl
88_(safer) _(mars) _(tiger) dnl
89_(gfshare) _(gfx-sqr)')
90
91autoheaders: addsuffix(`gen_tables', `-tab.h') primetab.h mptypes.h
92define(`emit', `
93_item`'-tab.h: _item`'-mktab
94 ./_item`'-mktab >_item`'-tab.h.new
95 mv _item`'-tab.h.new _item`'-tab.h')dnl
96gen_tables
97
98primetab.h: primetab.c
99primetab.c: genprimes
100 ./genprimes -h primetab.h -c primetab.c \
101 -s CATACOMB_PRIMETAB_H -n 256 \
102 -t "unsigned short" -i primetab
103archinclude_HEADERS = mptypes.h
104mptypes.h: mptypes
105 ./mptypes >mptypes.h.new
106 mv mptypes.h.new mptypes.h
107
108ectab.c: ectab.in ec-gentab.awk mpdump
109 $(srcdir)/ec-gentab.awk <$(srcdir)/ectab.in >ectab.c.new
110 mv ectab.c.new ectab.c
111
112ptab.c: ptab.in p-gentab.awk mpdump
113 $(srcdir)/p-gentab.awk <$(srcdir)/ptab.in >ptab.c.new
114 mv ptab.c.new ptab.c
115
116gciphertab.c: gengctab
117 $(srcdir)/gengctab gccipher gcipher >gciphertab.c.new \
118 "lit(join(`ciphers', `-', `cipher_modes')) \
119 lit(join(`hashes', `-', `_(mgf)')) \
120 rc4 seal"
121 mv gciphertab.c.new gciphertab.c
122
123gmactab.c: gengctab
124 $(srcdir)/gengctab gcmac gmac >gmactab.c.new \
125 "lit(join(`hashes', `-', `_(hmac)'))"
126 mv gmactab.c.new gmactab.c
127
128ghashtab.c: gengctab
129 $(srcdir)/gengctab gchash ghash >ghashtab.c.new \
130 "lit(`hashes') \
131 crc32=gcrc32"
132 mv ghashtab.c.new ghashtab.c
133
134BUILT_SOURCES = \
135 getdate.c modes-stamp gciphertab.c gmactab.c ghashtab.c \
136 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
137 addsuffix(join(`ciphers', `-', `cipher_modes'), `.h') \
138 addsuffix(join(`hashes', `-', `hash_modes'), `.c') \
139 addsuffix(join(`hashes', `-', `hash_modes'), `.h')
140
141## --- Building the main library ---
142
143lib_LTLIBRARIES = libcatacomb.la
144
145libcatacomb_la_LDFLAGS = -version-info 3:0:1
146## Middle number is the patchlevel. Final number is the minor version. The
147## difference between the first and last numbers is major version.
148
149pkginclude_HEADERS = \
150 arena.h paranoia.h buf.h qdparse.h \
151 blkc.h hash.h gcipher.h ghash.h gmac.h grand.h ghash-def.h \
152 lcrand.h fibrand.h rc4.h seal.h rand.h noise.h fipstest.h maurer.h \
153 key.h key-data.h passphrase.h pixie.h lmem.h \
154 mpx.h bitops.h mpw.h mpscan.h mparena.h mp.h mptext.h mpint.h \
155 exp.h mpbarrett.h mpmont.h mpreduce.h \
156 mpcrt.h mprand.h mpmul.h \
157 gfx.h gf.h gfreduce.h gfn.h \
158 primetab.h pfilt.h rabin.h \
159 pgen.h prim.h strongprime.h limlee.h keycheck.h \
160 bbs.h rsa.h dh.h dsarand.h dsa.h gdsa.h gkcdsa.h \
161 tlsprf.h sslprf.h \
162 gfshare.h share.h \
163 rho.h \
164 field.h ec.h ec-exp.h ec-test.h ectab.h ec-keys.h ec-raw.h \
165 ptab.h group.h \
166 allwithsuffix(`ciphers', `cipher_modes', `.h') \
167 allwithsuffix(`hashes', `hash_modes', `.h') \
168 addsuffix(`cipher_modes', `-def.h') \
169 addsuffix(`hash_modes', `-def.h') crc32.h
170
171define(`MP_SOURCES',
172 `mpx.c mpx-kmul.c mpx-ksqr.c mpscan.c mparena.c qdparse.c \
173 mp-misc.c mp-mem.c mp-const.c mp-io.c mp-arith.c mp-test.c \
174 mp-sqrt.c mp-gcd.c mp-jacobi.c mp-modsqrt.c \
175 mpint.c mptext.c mptext-file.c mptext-string.c mptext-dstr.c \
176 mptext-len.c \
177 exp.c mpcrt.c mpmul.c mprand.c \
178 mpbarrett.c mpbarrett-exp.c mpbarrett-mexp.c mpbarrett-exp.h \
179 mpmont.c mpmont-exp.c mpmont-mexp.c mpmont-exp.h \
180 mpreduce.c mpreduce-exp.h \
181 group-stdops.c group-exp.c group-exp.h g-prime.c group-parse.c \
182 group-string.c group-file.c group-dstr.c \
183 rho.c buf.c ptab.c \
184 GF_SOURCES PGEN_SOURCES EC_SOURCES')
185
186define(`GF_SOURCES',
187 `gfx.c gfx-kmul.c gfx-sqr.c gf-arith.c gf-gcd.c \
188 gfreduce.c gfreduce-exp.h gfn.c')
189
190define(`EC_SOURCES',
191 `field.c field-parse.c f-prime.c f-niceprime.c f-binpoly.c \
192 ec.c ec-exp.c ec-prime.c ec-bin.c ec-test.c ec-info.c ectab.c \
193 ec-fetch.c ec-raw.c g-ec.c')
194
195define(`PGEN_SOURCES',
196 `pfilt.c rabin.c \
197 pgen.c pgen-stdev.c pgen-safe.c pgen-gcd.c prim.c strongprime.c \
198 limlee.c \
199 keycheck.c keycheck-mp.c keycheck-report.c \
200 bbs-rand.c bbs-gen.c bbs-jump.c bbs-fetch.c \
201 rsa-priv.c rsa-pub.c rsa-gen.c rsa-recover.c rsa-fetch.c \
202 dh-gen.c dh-limlee.c dh-check.c dh-fetch.c dh-param.c \
203 dsarand.c dsa-sign.c dsa-verify.c dsa-gen.c dsa-check.c \
204 gdsa.c gkcdsa.c \
205 key-data.c key-flags.c key-text.c key-binary.c key-pass.c \
206 key-pack.c key-misc.c key-file.c key-attr.c key-io.c key-moan.c \
207 key-error.c key-fetch.c \
208 primetab.c share.c')
209
210libcatacomb_la_SOURCES = \
211 grand.c keysz.c \
212 lcrand.c fibrand.c rc4.c seal.c rand.c noise.c fipstest.c maurer.c \
213 arena.c \
214 passphrase.c pixie-client.c pixie-common.c lmem.c \
215 oaep.c pkcs1.c pss.c tlsprf.c sslprf.c \
216 gfshare.c \
217 MP_SOURCES karatsuba.h \
218 gciphertab.c ghashtab.c gmactab.c \
219 des-base.c des-base.h \
220 desx-tab.h \
221 rc2-tab.h \
222 skipjack-tab.h \
223 cast-s.c cast-sk.c cast-base.h cast-tab.h \
224 rijndael-base.c rijndael-base.h \
225 md2-tab.h \
226 serpent-sbox.h skipjack-tab.h tiger-base.h \
227 daftstory.h \
228 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
229 addsuffix(join(`hashes', `-', `hash_modes'), `.c') \
230 addsuffix(`ciphers', `.c') addsuffix(`hashes', `.c') crc32.c
231
232des-base.lo: des-tab.h
233blowfish.lo: blowfish-tab.h
234twofish.lo: twofish-tab.h
235square.lo: square-tab.h
236rijndael-base.lo: rijndael-tab.h
237safer.lo: safer-tab.h
238mars.lo: mars-tab.h
239tiger.lo: tiger-tab.h
240gfshare.lo: gfshare-tab.h
241gfx-sqr.lo: gfx-sqr-tab.h
242patsubst(MP_SOURCES, `\.c\>', `.lo') dsig.o keyutil.o rspit.o: \
243 mptypes.h primetab.h
244
245## --- Utility programs ---
246
247bin_PROGRAMS = dsig key pixie rspit factorial hashsum mkphrase
248bin_SCRIPTS = catacomb-config xpixie
249noinst_PROGRAMS = \
250 genprimes mptypes serpent-check bittest mpdump \
251 addsuffix(`gen_tables', `-mktab')
252LDADD = libcatacomb.la
253
254dsig_SOURCES = dsig.c getdate.y getdate.h
255key_SOURCES = keyutil.c getdate.y getdate.h
256hashsum_SOURCES = hashsum.c
257rspit_SOURCES = rspit.c
258factorial_SOURCES = factorial.c
259pixie_SOURCES = pixie.c pixie-common.c lmem.c arena.c
260pixie_LDADD =
261mkphrase_SOURCES = mkphrase.c
262bittest_SOURCES = bittest.c
263bittest_LDADD =
264
265define(`emit', `
266patsubst(_item, `[^a-zA-Z0-9]', `_')_mktab_SOURCES = _item`'-mktab.c
267patsubst(_item, `[^a-zA-Z0-9]', `_')_mktab_LDADD =')dnl
268gen_tables
269
270serpent_check_SOURCES = serpent-check.c
271serpent_check_LDADD =
272
273genprimes_SOURCES = genprimes.c
274genprimes_LDADD =
275
276mptypes_SOURCES = mptypes.c
277mptypes_LDADD =
278
279mpdump_SOURCES = \
280 mpdump.c \
281 mpx.c mpx-kmul.c mpx-ksqr.c mpscan.c mparena.c \
282 mp-misc.c mp-mem.c mp-const.c mp-arith.c mp-io.c \
283 mptext.c mptext-string.c
284mpdump_LDADD =
285
286## --- Install the pixie setuid-root if we can ---
287##
288## Bodge around a bug in Automake: it doesn't call `install-exec-hook' from
289## `install' if there are subdirectories.
290
291changequote(<, >)
292install: install-exec-hook
293install-exec-hook:
294 @pixie="$(DESTDIR)$(bindir)/`echo pixie|sed $(transform)`"; \
295 if chown root $$pixie && chmod 4755 $$pixie; then \
296 echo "chown root $$pixie"; \
297 echo "chmod 4755 $$pixie"; \
298 else \
299 echo "***"; \
300 echo "*** You should probably install $$pixie setuid-root."; \
301 echo "***"; \
302 fi
303changequote(`, ')
304
305## --- Documentation ---
306
307man_MANS = key.1 hashsum.1 keyring.5 pixie.1
308
309## --- Other handy definitions ---
310
311EXTRA_DIST = \
312 Makefile.m4 genmodes gengctab $(man_MANS) xpixie \
313 group-test.c rsa-test.c \
314 ectab.in ec-gentab.awk ptab.in p-gentab.awk \
315 README.cipher README.hash README.random README.mp \
316 debian/rules debian/copyright debian/control debian/changelog \
317 debian/catacomb-bin.postinst debian/catacomb-bin.config \
318 debian/catacomb-bin.prerm debian/catacomb-bin.templates
319
320dist-hook:
321 @for i in getdate.c gciphertab.c ghashtab.c gmactab.c; do \
322 ln $$i $(distdir) || ln $(srcdir)/$$i $(distdir) || true; \
323 done
324 @echo datestamp >$(distdir)/modes-stamp || true
325 @for i in calc tests; do \
326 mkdir $(distdir)/$$i; \
327 ln $(srcdir)/$$i/*[!~] $(distdir)/$$i; \
328 done || true
329# kr=$$HOME/.catacomb/dsig-keyring; \
330# if [ -r $$kr ]; then \
331# cd $(distdir); \
332# ../key -k $$kr extract -f -secret KEYRING; \
333# find . -type f -print0 | ../dsig -k $$kr sign -0 -oMANIFEST; \
334# fi
335
336## --- Testing ---
337
338define(`testprogs', `')
339
340define(`CTESTRIG',
341`define(`testprogs', testprogs \
342 $1.t)dnl
343$1.to: $1.c
344 $(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $(srcdir)/$1.c -o $1.to
345$1.t: $1.to libcatacomb.la
346 $(CC) $(CFLAGS) $(LDFLAGS) $1.to .libs/libcatacomb.a $(LIBS) -o $1.t')
347
348CTESTRIG(rc4)
349CTESTRIG(seal)
350adorn(`nl`'CTESTRIG(', `ciphers', `)')
351adorn(`nl`'CTESTRIG(', `hashes', `)')
352adorn(`nl`'CTESTRIG(', join(`ciphers', `-', `cipher_modes'), `)')
353adorn(`nl`'CTESTRIG(', join(`hashes', `-', `hash_modes'), `)')
354CTESTRIG(lcrand)
355CTESTRIG(tlsprf)
356CTESTRIG(sslprf)
357CTESTRIG(mpx)
358CTESTRIG(mpx-kmul)
359CTESTRIG(mpx-ksqr)
360CTESTRIG(mp-arith)
361CTESTRIG(mp-modsqrt)
362CTESTRIG(mp-gcd)
363CTESTRIG(mp-jacobi)
364CTESTRIG(mp-sqrt)
365CTESTRIG(mptext)
366CTESTRIG(mpint)
367CTESTRIG(mpbarrett)
368CTESTRIG(mpbarrett-exp)
369CTESTRIG(mpbarrett-mexp)
370CTESTRIG(mpmont)
371CTESTRIG(mpmont-exp)
372CTESTRIG(mpmont-mexp)
373CTESTRIG(mpreduce)
374CTESTRIG(mpcrt)
375CTESTRIG(mpmul)
376CTESTRIG(rsa-test)
377CTESTRIG(gfx)
378CTESTRIG(gfx-sqr)
379CTESTRIG(gfx-kmul)
380CTESTRIG(gf-arith)
381CTESTRIG(gf-gcd)
382CTESTRIG(gfreduce)
383CTESTRIG(gfn)
384CTESTRIG(ec-prime)
385CTESTRIG(ec-bin)
386CTESTRIG(ec-test)
387CTESTRIG(ec-info)
388CTESTRIG(dh-param)
389CTESTRIG(group-test)
390CTESTRIG(gdsa)
391CTESTRIG(gkcdsa)
392CTESTRIG(pgen)
393CTESTRIG(dsa-gen)
394CTESTRIG(dsa-sign)
395CTESTRIG(dsa-verify)
396CTESTRIG(bbs-rand)
397CTESTRIG(bbs-jump)
398CTESTRIG(gfshare)
399CTESTRIG(share)
400CTESTRIG(rho)
401
402TESTS = serpent-check bittest testprogs
403
404CLEANFILES = \
405 *.t *.to \
406 mptypes.h primetab.c primetab.h ectab.c \
407 addsuffix(`gen_tables', `-tab.h')
408
409## --- Makefile building (haha!) ---
410
411$(srcdir)/Makefile.am: $(srcdir)/Makefile.m4
412 m4 $(srcdir)/Makefile.m4 >$(srcdir)/Makefile.am.new
413 mv $(srcdir)/Makefile.am.new $(srcdir)/Makefile.am
414
415DISTCLEANFILES = libtool
416
417MAINTAINERCLEANFILES = \
418 $(srcdir)/Makefile.am \
419 $(srcdir)/getdate.c getdate.c \
420 $(MODES) modes-stamp $(srcdir)/modes-stamp
421
422##----- That's all, folks ---------------------------------------------------