-
Notifications
You must be signed in to change notification settings - Fork 72
/
Makefile.am
319 lines (246 loc) · 8.62 KB
/
Makefile.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = subdir-objects
lib_LTLIBRARIES = libkcapi.la
COMMON_CPPFLAGS = -Wextra -Wall -pedantic -fwrapv --param ssp-buffer-size=4 -O2 -std=gnu99 -Wconversion
if ENABLE_WERROR
COMMON_CPPFLAGS += -Werror
endif
COMMON_LDFLAGS = -Wl,-z,relro,-z,now
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status libtool
noinst_PROGRAMS = lib/doc/bin/docproc
EXTRA_lib_doc_bin_docproc_DEPENDENCIES = libtool
EXTRA_libkcapi_la_DEPENDENCIES = libtool
libkcapi_la_SOURCES = lib/cryptouser.h \
lib/internal.h \
lib/kcapi.h \
lib/kcapi-kernel-if.c \
lib/kcapi-utils.c
man_MANS =
DOC_TARGETS =
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = libkcapi.pc
if DISABLE_LIB_SYM
libkcapi_la_SOURCES +=
else
libkcapi_la_SOURCES += lib/kcapi-sym.c
endif
if DISABLE_LIB_MD
libkcapi_la_SOURCES +=
else
libkcapi_la_SOURCES += lib/kcapi-md.c
if DISABLE_LIB_KDF
libkcapi_la_SOURCES +=
else
libkcapi_la_SOURCES += lib/kcapi-kdf.c
endif
endif
if DISABLE_LIB_AEAD
libkcapi_la_SOURCES +=
else
libkcapi_la_SOURCES += lib/kcapi-aead.c
endif
if DISABLE_LIB_RNG
libkcapi_la_SOURCES +=
else
libkcapi_la_SOURCES += lib/kcapi-rng.c
endif
if ENABLE_LIB_ASYM
libkcapi_la_SOURCES += lib/kcapi-asym.c
else
libkcapi_la_SOURCES +=
endif
if ENABLE_LIB_KPP
libkcapi_la_SOURCES += lib/kcapi-kpp.c
else
libkcapi_la_SOURCES +=
endif
libkcapi_la_CPPFLAGS = $(COMMON_CPPFLAGS)
libkcapi_la_LDFLAGS = $(COMMON_LDFLAGS) -Wl,--version-script,$(top_srcdir)/lib/version.lds -version-number `echo $(VERSION) | sed 's/\./:/g'`
SCAN_FILES = $(libkcapi_la_SOURCES)
include_HEADERS = lib/kcapi.h
bin_PROGRAMS =
if ENABLE_KCAPI_TEST
bin_PROGRAMS += bin/kcapi
bin_kcapi_CPPFLAGS = $(COMMON_CPPFLAGS) -Wno-overlength-strings -g -I$(top_srcdir)/lib/
bin_kcapi_LDFLAGS = $(COMMON_LDFLAGS)
bin_kcapi_LDADD = libkcapi.la
bin_kcapi_SOURCES = test/kcapi-main.c
EXTRA_bin_kcapi_DEPENDENCIES = libtool
SCAN_FILES += $(bin_kcapi_SOURCES)
bin_PROGRAMS += bin/kcapi-enc-test-large
bin_kcapi_enc_test_large_CPPFLAGS = $(COMMON_CPPFLAGS) -Wno-overlength-strings -g -I$(top_srcdir)/lib/
bin_kcapi_enc_test_large_LDFLAGS = $(COMMON_LDFLAGS)
bin_kcapi_enc_test_large_LDADD = libkcapi.la
bin_kcapi_enc_test_large_SOURCES = test/kcapi-enc-test-large.c
EXTRA_bin_kcapi_enc_test_large_DEPENDENCIES = libtool
SCAN_FILES += $(bin_kcapi_enc_test_large_SOURCES)
bin_PROGRAMS += bin/kcapi-convenience
bin_kcapi_convenience_CPPFLAGS = $(COMMON_CPPFLAGS) -Wno-overlength-strings -g -I$(top_srcdir)/lib/
bin_kcapi_convenience_LDFLAGS = $(COMMON_LDFLAGS)
bin_kcapi_convenience_LDADD = libkcapi.la
bin_kcapi_convenience_SOURCES = test/kcapi-convenience.c
EXTRA_bin_kcapi_convenience_DEPENDENCIES = libtool
SCAN_FILES += $(bin_kcapi_convenience_SOURCES)
pkglibexec_PROGRAMS = bin/kcapi bin/kcapi-enc-test-large bin/kcapi-convenience
pkglibexec_SCRIPTS = test/libtest.sh \
test/test.sh \
test/kcapi-enc-test.sh \
test/kcapi-enc-test-large.sh \
test/kcapi-dgst-test.sh \
test/kcapi-convenience.sh \
test/kcapi-fuzz-test.sh \
test/hasher-test.sh \
test/compile-test.sh \
test/virttest.sh \
test/test-invocation.sh
endif
if ENABLE_KCAPI_SPEED
bin_PROGRAMS += bin/kcapi-speed
bin_kcapi_speed_CPPFLAGS = $(COMMON_CPPFLAGS) -Wno-variadic-macros -I$(top_srcdir)/lib/
bin_kcapi_speed_LDFLAGS = $(COMMON_LDFLAGS)
bin_kcapi_speed_LDADD = libkcapi.la
bin_kcapi_speed_SOURCES = speed-test/cryptoperf.h \
speed-test/cryptoperf-aead.c \
speed-test/cryptoperf-base.c \
speed-test/cryptoperf-hash.c \
speed-test/cryptoperf-main.c \
speed-test/cryptoperf-rng.c \
speed-test/cryptoperf-skcipher.c
EXTRA_bin_kcapi_speed_DEPENDENCIES = libtool
SCAN_FILES += $(bin_kcapi_speed_SOURCES)
endif
if ENABLE_KCAPI_HASHER
bin_PROGRAMS += bin/kcapi-hasher
bin_kcapi_hasher_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/lib/
bin_kcapi_hasher_LDFLAGS = $(COMMON_LDFLAGS) -ldl
bin_kcapi_hasher_LDADD = libkcapi.la
bin_kcapi_hasher_SOURCES = apps/kcapi-hasher.c apps/app-internal.c
EXTRA_bin_kcapi_hasher_DEPENDENCIES = libtool
SCAN_FILES += $(bin_kcapi_hasher_SOURCES)
man_MANS += apps/kcapi-hasher.1
hasher_links = sha1sum sha224sum sha256sum sha384sum sha512sum md5sum \
sm3sum fipscheck fipshmac sha3sum sha1hmac sha224hmac \
sha256hmac sha384hmac sha512hmac sm3hmac
CHECKSUM_CMD = $(OPENSSL) sha512 -r -hmac FIPS-FTW-RHT2009
CHECK_DIR_LIB = $(if $(CHECK_DIR),$(CHECK_DIR)/hmaccalc,$(libdir))
CHECK_DIR_BIN = $(if $(CHECK_DIR),$(CHECK_DIR)/hmaccalc,$(bindir))
install-exec-hook:
$(MKDIR_P) -p $(DESTDIR)/$(pkglibexecdir)
$(foreach link, $(hasher_links), $(LN) -sf $(bindir)/kcapi-hasher $(DESTDIR)/$(pkglibexecdir)/$(link);)
if HAVE_OPENSSL
$(MKDIR_P) $(DESTDIR)$(CHECK_DIR_BIN)
cd $(DESTDIR)$(bindir) && $(CHECKSUM_CMD) kcapi-hasher > $(DESTDIR)$(CHECK_DIR_BIN)/$(CHECK_PREFIX)kcapi-hasher.$(CHECK_SUFFIX)
$(foreach lib, $(wildcard $(DESTDIR)$(libdir)/libkcapi.so*), \
$(CHECKSUM_CMD) $(lib) > $(DESTDIR)$(CHECK_DIR_LIB)/$(CHECK_PREFIX)$(notdir $(lib)).$(CHECK_SUFFIX);)
endif
endif
if ENABLE_KCAPI_RNGAPP
bin_PROGRAMS += bin/kcapi-rng
bin_kcapi_rng_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/lib/
bin_kcapi_rng_LDFLAGS = $(COMMON_LDFLAGS)
bin_kcapi_rng_LDADD = libkcapi.la
bin_kcapi_rng_SOURCES = apps/kcapi-rng.c apps/app-internal.c
EXTRA_bin_kcapi_rng_DEPENDENCIES = libtool
SCAN_FILES += $(bin_kcapi_rng_SOURCES)
man_MANS += apps/kcapi-rng.1
endif
if ENABLE_KCAPI_ENCAPP
bin_PROGRAMS += bin/kcapi-enc
bin_kcapi_enc_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/lib/
bin_kcapi_enc_LDFLAGS = $(COMMON_LDFLAGS)
bin_kcapi_enc_LDADD = libkcapi.la
bin_kcapi_enc_SOURCES = apps/kcapi-enc.c apps/app-internal.c
EXTRA_bin_kcapi_enc_DEPENDENCIES = libtool
SCAN_FILES += $(bin_kcapi_enc_SOURCES)
man_MANS += apps/kcapi-enc.1
endif
if ENABLE_KCAPI_DGSTAPP
bin_PROGRAMS += bin/kcapi-dgst
bin_kcapi_dgst_CPPFLAGS = $(COMMON_CPPFLAGS) -I$(top_srcdir)/lib/
bin_kcapi_dgst_LDFLAGS = $(COMMON_LDFLAGS)
bin_kcapi_dgst_LDADD = libkcapi.la
bin_kcapi_dgst_SOURCES = apps/kcapi-dgst.c apps/app-internal.c
EXTRA_bin_kcapi_dgst_DEPENDENCIES = libtool
SCAN_FILES += $(bin_kcapi_dgst_SOURCES)
man_MANS += apps/kcapi-dgst.1
endif
if HAVE_CLANG
analyze_srcs = $(filter %.c, $(sort $(SCAN_FILES)))
analyze_plists = $(analyze_srcs:%.c=%.plist)
MOSTLYCLEANFILES = $(analyze_plists)
$(analyze_plists): %.plist: %.c
@echo " CCSA " $@
@$(CLANG) --analyze $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) -I$(top_srcdir)/lib/ $< -o $@
scan: $(analyze_plists)
.PHONY: scan
endif
if HAVE_CPPCHECK
cppcheck:
$(CPPCHECK) -U CHECK_DIR --error-exitcode=42 --enable=performance,warning,portability $(sort $(SCAN_FILES))
endif
if HAVE_MKTEMP
DOCPROC_TEMP := $(shell $(MKTEMP))
else
DOCPROC_TEMP := $(abs_top_builddir)/docproc.temp
endif
$(lib_doc_bin_docproc_OBJECTS) : CC = $(CC_FOR_BUILD)
$(lib_doc_bin_docproc_OBJECTS) : CFLAGS = $(CFLAGS_FOR_BUILD)
$(lib_doc_bin_docproc_OBJECTS) : CPPFLAGS = $(COMMON_CPPFLAGS) $(CPPFLAGS_FOR_BUILD)
lib/doc/bin/docproc${EXEEXT}: $(lib_doc_bin_docproc_OBJECTS)
$(CC_FOR_BUILD) $(COMMON_CPPFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
%.xml: %.tmpl lib/doc/bin/docproc$(EXEEXT)
$(SED) "s/@@LIBVERSION@@/$(VERSION)/" < $< > $(DOCPROC_TEMP)
LIBVERSION=$(VERSION) SRCTREE=$(top_srcdir)/lib/ $(abs_top_builddir)/lib/doc/bin/docproc$(EXEEXT) doc $(DOCPROC_TEMP) > $@
-rm $(DOCPROC_TEMP)
if HAVE_DB2PDF
DOC_TARGETS += pdf
pdf: pdf-stamp
pdf-stamp: lib/doc/libkcapi.xml
$(MKDIR_P) doc/pdf
HOME=$(abs_top_builddir)/doc/pdf $(DB2PDF) -o doc/pdf $<
$(MV) doc/pdf/*.pdf doc
-rm -r doc/pdf
$(TOUCH) $@
endif
if HAVE_DB2PS
DOC_TARGETS += ps
ps: ps-stamp
ps-stamp: lib/doc/libkcapi.xml
$(MKDIR_P) doc/ps
HOME=$(abs_top_builddir)/doc/ps $(DB2PS) -o doc/ps $<
$(MV) doc/ps/*.ps doc
-rm -r doc/ps
$(TOUCH) $@
endif
if HAVE_XMLTO
DOC_TARGETS += html
html: html-stamp
html-stamp: lib/doc/libkcapi.xml
$(MKDIR_P) lib/doc/html
$(XMLTO) html -m $(top_srcdir)/lib/doc/stylesheet.xsl --skip-validation -o lib/doc/html/ $< 2>/dev/null
$(TOUCH) $@
DOC_TARGETS += man
man: man-stamp
man-stamp: lib/doc/libkcapi.xml
$(MKDIR_P) lib/doc/man
$(XMLTO) man -m $(top_srcdir)/lib/doc/stylesheet.xsl --skip-validation -o lib/doc/man/ $< 2>/dev/null
$(TOUCH) $@
devel_manpages = lib/doc/man/*.3
man_MANS += $(devel_manpages)
$(devel_manpages): man
endif
doc: $(sort $(DOC_TARGETS))
clean-local:
-rm -f $(DOCPROC_TEMP)
-rm -f *-stamp
-rm -f lib/doc/*.xml
-rm -f lib/doc/*.pdf
-rm -f lib/doc/*.ps
-rm -rf lib/doc/man/
-rm -rf lib/doc/html/
-rm -rf doc/
-rm -rf bin/
distclean-local:
-rm -f lib/doc/Makefile*
-rm -rf autom4te.cache/