Updates for new configuration system, and `mptypes' generator.
[u/mdw/catacomb] / Makefile.m4
1 ## -*-makefile-*-
2 ##
3 ## $Id: Makefile.m4,v 1.6 1999/11/11 17:47:34 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
29 ##----- Revision history ----------------------------------------------------
30 ##
31 ## $Log: Makefile.m4,v $
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.
37 ##
38 ## Revision 1.6 1999/11/11 17:47:34 mdw
39 ## Updates for new configuration system, and `mptypes' generator.
40 ##
41 ## Revision 1.5 1999/11/11 00:59:17 mdw
42 ## Minor reformatting.
43 ##
44 ## Revision 1.4 1999/10/24 10:20:36 mdw
45 ## Modify for standalone distribution. The library's getting far too large
46 ## to be sensibly embedded in other programs.
47 ##
48 ## Revision 1.3 1999/10/24 10:04:26 mdw
49 ## Install headers in the right directory.
50 ##
51 ## Revision 1.2 1999/10/23 12:55:35 mdw
52 ## The `CVS' directory can't be hardlinked. Don't worry about this
53 ## overmuch.
54 ##
55 ## Revision 1.1 1999/09/03 08:41:11 mdw
56 ## Initial import.
57 ##
58
59 AUTOMAKE_OPTIONS = foreign
60
61 archincludedir = $(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
68 define(`_', `define(`_item', $1)define(`_item_2', $2)emit`'')
69 define(`adorn', `pushdef(`emit', `$1`'_item`'$3')$2`'popdef(`emit')')
70 define(`join',
71 `pushdef(`emit', `adorn(``_(''_item`$2', `$3', ``)'')`'')$1`'popdef(`emit')')
72 define(`addsuffix', `adorn(`', `$1', `$2')')
73 define(`lit', `adorn(`', `$1', `')')
74 define(`nl', `
75 ')
76
77 define(`allwithsuffix',
78 `addsuffix(`$1', `$3') addsuffix(`$2', `$3') dnl
79 addsuffix(join(`$1', `-', `$2'), `$3')')
80
81 ## --- Autogenerated source files ---
82
83 define(`ciphers', `_(des) _(des3) _(blowfish) _(idea) _(rc5)')
84 define(`cipher_modes', `_(ecb) _(cbc) _(cfb) _(ofb)')
85
86 define(`hashes', `_(md5) _(md4) _(rmd160) _(sha)')
87 define(`hash_modes', `_(hmac)')
88
89 MODES = \
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
96 $(srcdir)/des_sp.h: des-mktab
97 ./des-mktab >$(srcdir)/des_sp.h
98
99 ptab.c ptab.h: genprimes
100 ./genprimes -h ptab.h -c ptab.c -m 256 -t "unsigned char" -i ptab
101
102 archinclude_HEADERS = mptypes.h
103
104 mptypes.h: mptypes
105 des_sp.h \
106 ./mptypes >mptypes.h
107
108 BUILT_SOURCES = \
109 getdate.c \
110 addsuffix(join(`ciphers', `-', `cipher_modes'), `.c') \
111 addsuffix(join(`ciphers', `-', `cipher_modes'), `.h') \
112 addsuffix(join(`hashes', `-', `hash_modes'), `.c') \
113 addsuffix(join(`hashes', `-', `hash_modes'), `.h')
114 lib_LIBRARIES = libcatacomb.a
115 libcatacomb_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
119 define(`emit', `$1.h ')
120 pkginclude_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') \
127 libcatacomb_a_SOURCES = \
128
129 define(`emit', `$1.c ')
130 libcatacomb_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') \
136 des-base.lo: des_sp.h
137 mpx.lo: mptypes.h
138
139 ## --- Utility programs ---
140 noinst_PROGRAMS = des-mktab mptypes
141 LDADD = libcatacomb.a
142 bin_SCRIPTS = catacomb-config
143 noinst_PROGRAMS = des-mktab genprimes mptypes
144 LDADD = libcatacomb.la
145
146 key_SOURCES = keyutil.c getdate.y getdate.h
147
148 genprimes_SOURCES = genprimes.c
149 genprimes_LDADD =
150
151 mptypes_SOURCES = mptypes.c
152 mptypes_LDADD =
153
154 ## --- Documentation ---
155
156 man_MANS = key.1 keyring.5
157
158 ## --- Other handy definitions ---
159
160 EXTRA_DIST = Makefile.m4 genmodes $(man_MANS)
161
162 dist-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/*~
167 TESTS = \
168 rc4.t \
169 addsuffix(join(`ciphers', `-', `cipher_modes'), `.t') \
170 addsuffix(join(`hashes', `-', `hash_modes'), `.t') \
171 addsuffix(`ciphers', `.t') addsuffix(`hashes', `.t')
172 ## --- Testing ---
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
179 adorn(`nl`'CTESTRIG(', `ciphers', `)')
180 adorn(`nl`'CTESTRIG(', `hashes', `)')
181 adorn(`nl`'CTESTRIG(', join(`ciphers', `-', `cipher_modes'), `)')
182 adorn(`nl`'CTESTRIG(', join(`hashes', `-', `hash_modes'), `)')
183 CTESTRIG(dsa-verify)
184 CLEANFILES = *.t mptypes.h
185 TESTS = testprogs
186
187 CLEANFILES = *.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 ---------------------------------------------------