Minor changes for different `mptypes.h' format.
[u/mdw/catacomb] / Makefile.m4
CommitLineData
d03ab969 1## -*-makefile-*-
2##
a094cab7 3## $Id: Makefile.m4,v 1.6 1999/11/11 17:47:34 mdw Exp $
d03ab969 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
29##----- Revision history ----------------------------------------------------
30##
31## $Log: Makefile.m4,v $
a094cab7 32## Revision 1.6 1999/11/11 17:47:34 mdw
33## Updates for new configuration system, and `mptypes' generator.
34##
35## Revision 1.7 1999/11/11 19:01:02 mdw
36## Use `libtool' to generate a shared library.
8149619d 37##
38## Revision 1.6 1999/11/11 17:47:34 mdw
39## Updates for new configuration system, and `mptypes' generator.
748ed8dc 40##
8149619d 41## Revision 1.5 1999/11/11 00:59:17 mdw
748ed8dc 42## Minor reformatting.
3701c54f 43##
748ed8dc 44## Revision 1.4 1999/10/24 10:20:36 mdw
3701c54f 45## Modify for standalone distribution. The library's getting far too large
46## to be sensibly embedded in other programs.
d03ab969 47##
3701c54f 48## Revision 1.3 1999/10/24 10:04:26 mdw
9183ab7b 49## Install headers in the right directory.
50##
51## Revision 1.2 1999/10/23 12:55:35 mdw
d03ab969 52## The `CVS' directory can't be hardlinked. Don't worry about this
53## overmuch.
54##
a094cab7 55## Revision 1.1 1999/09/03 08:41:11 mdw
56## Initial import.
d03ab969 57##
58
59AUTOMAKE_OPTIONS = foreign
60
61archincludedir = $(libdir)/catacomb/include
62
63## --- List handling macros ---
64##
65## List handling is nice, usually. Unfortunately, I based this design on
66## TeX list macros rather than anything sensible...
67
68define(`_', `define(`_item', $1)define(`_item_2', $2)emit`'')
69define(`adorn', `pushdef(`emit', `$1`'_item`'$3')$2`'popdef(`emit')')
70define(`join',
71`pushdef(`emit', `adorn(``_(''_item`$2', `$3', ``)'')`'')$1`'popdef(`emit')')
72define(`addsuffix', `adorn(`', `$1', `$2')')
73define(`lit', `adorn(`', `$1', `')')
74define(`nl', `
75')
76
77define(`allwithsuffix',
78`addsuffix(`$1', `$3') addsuffix(`$2', `$3') dnl
79addsuffix(join(`$1', `-', `$2'), `$3')')
80
81## --- Autogenerated source files ---
82
83define(`ciphers', `_(des) _(des3) _(blowfish) _(idea) _(rc5)')
84define(`cipher_modes', `_(ecb) _(cbc) _(cfb) _(ofb)')
85
86define(`hashes', `_(md5) _(md4) _(rmd160) _(sha)')
87define(`hash_modes', `_(hmac)')
88
89MODES = \
90 adorn(`$(srcdir)/', join(`ciphers', `-', `cipher_modes'), `.c') \
91 adorn(`$(srcdir)/', join(`ciphers', `-', `cipher_modes'), `.h') \
92 adorn(`$(srcdir)/', join(`hashes', `-', `hash_modes'), `.c') \
93 adorn(`$(srcdir)/', join(`hashes', `-', `hash_modes'), `.h')
94
95$(MODES): $(srcdir)/genmodes
a094cab7 96$(srcdir)/des_sp.h: des-mktab
97 ./des-mktab >$(srcdir)/des_sp.h
98
99ptab.c ptab.h: genprimes
100 ./genprimes -h ptab.h -c ptab.c -m 256 -t "unsigned char" -i ptab
d03ab969 101
102archinclude_HEADERS = mptypes.h
103
104mptypes.h: mptypes
105 des_sp.h \
106 ./mptypes >mptypes.h
107
108BUILT_SOURCES = \
109 getdate.c \
110 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
111 addsuffix(join(`ciphers', `-', `cipher_modes'), `.h') \
d03ab969 112 addsuffix(join(`hashes', `-', `hash_modes'), `.c') \
113 addsuffix(join(`hashes', `-', `hash_modes'), `.h')
3701c54f 114lib_LIBRARIES = libcatacomb.a
d03ab969 115libcatacomb_la_LDFLAGS = -version-info 0:4:0
116## Middle number is the patchlevel. Final number is the minor version. The
117## difference between the first and last numbers is major version.
118
119define(`emit', `$1.h ')
120pkginclude_HEADERS = \
121 paranoia.h \
122 blkc.h hash.h \
123 mpx.h mpw.h mpscan.h mparena.h mp.h mptext.h mpmont.h \
124 ptab.h pgen.h rabin.h \
125 dsa.h dh.h \
126 allwithsuffix(`ciphers', `cipher_modes', `.h') \
127libcatacomb_a_SOURCES = \
128
129define(`emit', `$1.c ')
130libcatacomb_la_SOURCES = \
131 des-base.c des-base.h des_sp.h bf_ikey.h daftstory.h \
132 ptab.c pgen.c rabin.c \
133 dsa-sign.c dsa-verify.c dsa-gen.c \
134 dh-prime.c \
135 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
a094cab7 136des-base.lo: des_sp.h
137mpx.lo: mptypes.h
748ed8dc 138
d03ab969 139## --- Utility programs ---
140noinst_PROGRAMS = des-mktab mptypes
141LDADD = libcatacomb.a
142bin_SCRIPTS = catacomb-config
143noinst_PROGRAMS = des-mktab genprimes mptypes
144LDADD = libcatacomb.la
a094cab7 145
146key_SOURCES = keyutil.c getdate.y getdate.h
147
d03ab969 148genprimes_SOURCES = genprimes.c
149genprimes_LDADD =
150
151mptypes_SOURCES = mptypes.c
152mptypes_LDADD =
153
154## --- Documentation ---
155
156man_MANS = key.1 keyring.5
157
158## --- Other handy definitions ---
9183ab7b 159
d03ab969 160EXTRA_DIST = Makefile.m4 genmodes $(man_MANS)
161
162dist-hook:
163 @ln getdate.c $(distdir) || ln $(srcdir)/getdate.c $(distdir) || true
164 @mkdir $(distdir)/tests
165 @ln $(srcdir)/tests/* $(distdir)/tests || true
166 @rm -f $(distdir)/tests/*~
167TESTS = \
168 rc4.t \
169 addsuffix(join(`ciphers', `-', `cipher_modes'), `.t') \
170 addsuffix(join(`hashes', `-', `hash_modes'), `.t') \
171 addsuffix(`ciphers', `.t') addsuffix(`hashes', `.t')
a094cab7 172## --- Testing ---
d03ab969 173
174`$1.t: $1.c libcatacomb.a
175 $(COMPILE) -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $(srcdir)/$1.c libcatacomb.a $(LIBS) -o $1.t')
176 $1.t)dnl
177$1.t: $1.c libcatacomb.la
178
179adorn(`nl`'CTESTRIG(', `ciphers', `)')
180adorn(`nl`'CTESTRIG(', `hashes', `)')
a094cab7 181adorn(`nl`'CTESTRIG(', join(`ciphers', `-', `cipher_modes'), `)')
d03ab969 182adorn(`nl`'CTESTRIG(', join(`hashes', `-', `hash_modes'), `)')
183CTESTRIG(dsa-verify)
184CLEANFILES = *.t mptypes.h
185TESTS = testprogs
186
187CLEANFILES = *.t mptypes.h des_sp.h ptab.c ptab.h
188
189## --- Makefile building (haha!) ---
190
191$(srcdir)/Makefile.am: $(srcdir)/Makefile.m4
192 m4 $(srcdir)/Makefile.m4 >$(srcdir)/Makefile.am
193 $(MODES) $(srcdir)/des_sp.h \
194 $(srcdir)/getdate.c getdate.c
195 $(srcdir)/Makefile.am \
196 $(srcdir)/getdate.c getdate.c \
197 $(MODES)
198
199##----- That's all, folks ---------------------------------------------------