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