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