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