forked from tpm2-software/tpm2-tss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
355 lines (318 loc) · 12.1 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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#;**********************************************************************;
# Copyright (c) 2015 - 2018 Intel Corporation
# Copyright (c) 2018 Fraunhofer SIT sponsored by Infineon Technologies AG
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#;**********************************************************************;
### Initialize global variables used throughout the file ###
INCLUDE_DIRS = -I$(srcdir)/src -I$(srcdir)/include/tss2
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(INCLUDE_DIRS) $(EXTRA_CFLAGS) $(CODE_COVERAGE_CFLAGS)
AM_LDFLAGS = $(EXTRA_LDFLAGS) $(CODE_COVERAGE_LIBS)
# Initialize empty variables to be extended throughout
lib_LTLIBRARIES =
noinst_LTLIBRARIES =
EXTRA_DIST =
CLEANFILES =
MOSTLYCLEANFILES =
noinst_PROGRAMS =
### Add ax_* rules ###
# ax_code_coverage
@CODE_COVERAGE_RULES@
# ax_doxygen
@DX_RULES@
DX_CLEANFILES = doc/doxygen
MOSTLYCLEANFILES += $(DX_CLEANFILES)
if DOXYMAN
DOXYMAN3 = \
doc/man/ESYS_CONTEXT.3 \
doc/man/ESYS_TR.3 \
doc/man/ESYS_TR_defines.3 \
doc/man/Esys_ActivateCredential.3 \
doc/man/Esys_Certify.3 \
doc/man/Esys_CertifyCreation.3 \
doc/man/Esys_ChangeEPS.3 \
doc/man/Esys_ChangePPS.3 \
doc/man/Esys_Clear.3 \
doc/man/Esys_ClearControl.3 \
doc/man/Esys_ClockRateAdjust.3 \
doc/man/Esys_ClockSet.3 \
doc/man/Esys_Commit.3 \
doc/man/Esys_ContextLoad.3 \
doc/man/Esys_ContextSave.3 \
doc/man/Esys_Create.3 \
doc/man/Esys_CreatePrimary.3 \
doc/man/Esys_DictionaryAttackLockReset.3 \
doc/man/Esys_DictionaryAttackParameters.3 \
doc/man/Esys_Duplicate.3 \
doc/man/Esys_ECC_Parameters.3 \
doc/man/Esys_ECDH_KeyGen.3 \
doc/man/Esys_ECDH_ZGen.3 \
doc/man/Esys_EC_Ephemeral.3 \
doc/man/Esys_EncryptDecrypt.3 \
doc/man/Esys_EventSequenceComplete.3 \
doc/man/Esys_EvictControl.3 \
doc/man/Esys_FlushContext.3 \
doc/man/Esys_GetCapability.3 \
doc/man/Esys_GetCommandAuditDigest.3 \
doc/man/Esys_GetRandom.3 \
doc/man/Esys_GetSessionAuditDigest.3 \
doc/man/Esys_GetTestResult.3 \
doc/man/Esys_GetTime.3 \
doc/man/Esys_Hash.3 \
doc/man/Esys_HashSequenceStart.3 \
doc/man/Esys_HierarchyChangeAuth.3 \
doc/man/Esys_HierarchyControl.3 \
doc/man/Esys_HMAC.3 \
doc/man/Esys_HMAC_Start.3 \
doc/man/Esys_Import.3 \
doc/man/Esys_IncrementalSelfTest.3 \
doc/man/Esys_Load.3 \
doc/man/Esys_LoadExternal.3 \
doc/man/Esys_MakeCredential.3 \
doc/man/Esys_NV_Certify.3 \
doc/man/Esys_NV_ChangeAuth.3 \
doc/man/Esys_NV_DefineSpace.3 \
doc/man/Esys_NV_Extend.3 \
doc/man/Esys_NV_GlobalWriteLock.3 \
doc/man/Esys_NV_Increment.3 \
doc/man/Esys_NV_Read.3 \
doc/man/Esys_NV_ReadLock.3 \
doc/man/Esys_NV_ReadPublic.3 \
doc/man/Esys_NV_SetBits.3 \
doc/man/Esys_NV_UndefineSpace.3 \
doc/man/Esys_NV_UndefineSpaceSpecial.3 \
doc/man/Esys_NV_Write.3 \
doc/man/Esys_NV_WriteLock.3 \
doc/man/Esys_ObjectChangeAuth.3 \
doc/man/Esys_PCR_Allocate.3 \
doc/man/Esys_PCR_Event.3 \
doc/man/Esys_PCR_Extend.3 \
doc/man/Esys_PCR_Read.3 \
doc/man/Esys_PCR_Reset.3 \
doc/man/Esys_PCR_SetAuthPolicy.3 \
doc/man/Esys_PCR_SetAuthValue.3 \
doc/man/Esys_PolicyAuthorize.3 \
doc/man/Esys_PolicyAuthValue.3 \
doc/man/Esys_PolicyCommandCode.3 \
doc/man/Esys_PolicyCounterTimer.3 \
doc/man/Esys_PolicyCpHash.3 \
doc/man/Esys_PolicyDuplicationSelect.3 \
doc/man/Esys_PolicyGetDigest.3 \
doc/man/Esys_PolicyLocality.3 \
doc/man/Esys_PolicyNameHash.3 \
doc/man/Esys_PolicyNV.3 \
doc/man/Esys_PolicyNvWritten.3 \
doc/man/Esys_PolicyOR.3 \
doc/man/Esys_PolicyPassword.3 \
doc/man/Esys_PolicyPCR.3 \
doc/man/Esys_PolicyPhysicalPresence.3 \
doc/man/Esys_PolicyRestart.3 \
doc/man/Esys_PolicySecret.3 \
doc/man/Esys_PolicySigned.3 \
doc/man/Esys_PolicyTicket.3 \
doc/man/Esys_PP_Commands.3 \
doc/man/Esys_Quote.3 \
doc/man/Esys_ReadClock.3 \
doc/man/Esys_ReadPublic.3 \
doc/man/Esys_Rewrap.3 \
doc/man/Esys_RSA_Decrypt.3 \
doc/man/Esys_RSA_Encrypt.3 \
doc/man/Esys_SelfTest.3 \
doc/man/Esys_SequenceComplete.3 \
doc/man/Esys_SequenceUpdate.3 \
doc/man/Esys_SetAlgorithmSet.3 \
doc/man/Esys_SetCommandCodeAuditStatus.3 \
doc/man/Esys_SetPrimaryPolicy.3 \
doc/man/Esys_Shutdown.3 \
doc/man/Esys_Sign.3 \
doc/man/Esys_StartAuthSession.3 \
doc/man/Esys_Startup.3 \
doc/man/Esys_StirRandom.3 \
doc/man/Esys_TestParms.3 \
doc/man/Esys_Unseal.3 \
doc/man/Esys_Vendor_TCG_Test.3 \
doc/man/Esys_VerifySignature.3 \
doc/man/Esys_ZGen_2Phase.3
$(DOXYMAN3): doxygen-doc
EXTRA_DIST += $(DOXYMAN3)
CLEANFILES += $(DOXYMAN3)
CLEANFILES += doc/man/* doc/rtf/* doc/html/*
else #DOXYMAN
DOXYMAN3 =
endif #DOXYMAN
### Include make files ###
# Add source code files from bootstrap
include src_vars.mk
# Add test definitions
include Makefile-test.am
### Distribution files ###
# Add udev rule
udevrules_DATA = dist/tpm-udev.rules
# Adding user and developer information
EXTRA_DIST += \
CHANGELOG.md \
CONTRIBUTING.md \
INSTALL.md \
LICENSE \
README.md \
RELEASE.md
# Generate the AUTHORS file from git log
AUTHORS :
$(AM_V_GEN)git log --format='%aN <%aE>' | grep -v 'users.noreply.github.com' | sort | \
uniq -c | sort -nr | sed 's/^\s*//' | cut -d" " -f2- > $@
EXTRA_DIST += AUTHORS
CLEANFILES += AUTHORS
# pkg-config setup. pc-file declarations happen in the corresponding modules
pkgconfigdir = $(libdir)/pkgconfig
nodist_pkgconfig_DATA =
CLEANFILES += $(nodist_pkgconfig_DATA)
%.pc : %.pc.in
$(AM_V_GEN)$(call make_parent_dir,$@) && \
sed -e "s,[@]VERSION[@],$(PACKAGE_VERSION),g; \
s,[@]libdir[@],$(libdir),g; \
s,[@]includedir[@],$(includedir),g;" $^ > $@
# Base TSS2 headers
tss2dir = $(includedir)/tss2
tss2_HEADERS = \
$(srcdir)/include/tss2/tss2_common.h \
$(srcdir)/include/tss2/tss2_tcti.h \
$(srcdir)/include/tss2/tss2_tpm2_types.h
### Internal utility library
libutil = libutil.la
noinst_LTLIBRARIES += $(libutil)
libutil_la_CFLAGS = $(AM_CFLAGS)
libutil_la_SOURCES = $(UTIL_SRC)
### TCG TSS Marshaling/Unmarshaling spec library ###
libtss2_mu = src/tss2-mu/libtss2-mu.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_mu.h
lib_LTLIBRARIES += $(libtss2_mu)
nodist_pkgconfig_DATA += lib/tss2-mu.pc
EXTRA_DIST += lib/tss2-mu.map lib/tss2-mu.pc.in
if HAVE_LD_VERSION_SCRIPT
src_tss2_mu_libtss2_mu_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-mu.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_mu_libtss2_mu_la_LIBADD = $(libutil)
src_tss2_mu_libtss2_mu_la_SOURCES = $(TSS2_MU_SRC)
### TCG TSS TCTI spec libraries ###
# tcti device library
if ENABLE_TCTI_DEVICE
libtss2_tcti_device = src/tss2-tcti/libtss2-tcti-device.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_device.h
lib_LTLIBRARIES += $(libtss2_tcti_device)
nodist_pkgconfig_DATA += lib/tss2-tcti-device.pc
EXTRA_DIST += lib/tss2-tcti-device.map lib/tss2-tcti-device.pc.in
src_tss2_tcti_libtss2_tcti_device_la_CFLAGS = $(AM_CFLAGS)
if HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_device_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-device.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_device_la_LIBADD = $(libtss2_mu) $(libutil)
src_tss2_tcti_libtss2_tcti_device_la_SOURCES = \
src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
src/tss2-tcti/tcti-device.c src/tss2-tcti/tcti-device.h
endif # ENABLE_TCTI_DEVICE
# tcti library for Microsoft TPM2 simulator
if ENABLE_TCTI_MSSIM
libtss2_tcti_mssim = src/tss2-tcti/libtss2-tcti-mssim.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_mssim.h
lib_LTLIBRARIES += $(libtss2_tcti_mssim)
nodist_pkgconfig_DATA += lib/tss2-tcti-mssim.pc
EXTRA_DIST += lib/tss2-tcti-mssim.map lib/tss2-tcti-mssim.pc.in
AM_CFLAGS += -DTCTI_MSSIM
src_tss2_tcti_libtss2_tcti_mssim_la_CFLAGS = $(AM_CFLAGS) $(URIPARSER_CFLAGS)
if HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_mssim_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-mssim.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_mssim_la_LIBADD = $(libtss2_mu) $(URIPARSER_LIBS) $(libutil)
src_tss2_tcti_libtss2_tcti_mssim_la_SOURCES = \
src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
src/tss2-tcti/tcti-mssim.c src/tss2-tcti/tcti-mssim.h
endif # ENABLE_TCTI_MSSIM
### TCG TSS SAPI spec library ###
libtss2_sys = src/tss2-sys/libtss2-sys.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_sys.h
lib_LTLIBRARIES += $(libtss2_sys)
nodist_pkgconfig_DATA += lib/tss2-sys.pc
EXTRA_DIST += lib/tss2-sys.pc.in
src_tss2_sys_libtss2_sys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-sys
src_tss2_sys_libtss2_sys_la_LIBADD = $(libtss2_mu) $(libutil)
src_tss2_sys_libtss2_sys_la_SOURCES = $(TSS2_SYS_SRC)
### TCG TSS ESAPI spec library ###
if ESAPI
libtss2_esys = src/tss2-esys/libtss2-esys.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_esys.h
lib_LTLIBRARIES += $(libtss2_esys)
nodist_pkgconfig_DATA += lib/tss2-esys.pc
EXTRA_DIST += lib/tss2-esys.pc.in
src_tss2_esys_libtss2_esys_la_LIBADD = $(libtss2_sys) $(libtss2_mu) \
$(libtss2_tcti_device) $(libtss2_tcti_mssim) $(libutil)
if ESYS_OSSL
TSS2_ESYS_SRC += src/tss2-esys/esys_crypto_ossl.h src/tss2-esys/esys_crypto_ossl.c
src_tss2_esys_libtss2_esys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-esys -DOSSL
src_tss2_esys_libtss2_esys_la_LDFLAGS = $(AM_LDFLAGS) -ldl -lssl -lcrypto
else
if ESYS_GCRYPT
TSS2_ESYS_SRC += src/tss2-esys/esys_crypto_gcrypt.h src/tss2-esys/esys_crypto_gcrypt.c
src_tss2_esys_libtss2_esys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-esys
src_tss2_esys_libtss2_esys_la_LDFLAGS = $(AM_LDFLAGS) -ldl -lgcrypt
endif
endif
src_tss2_esys_libtss2_esys_la_SOURCES = $(TSS2_ESYS_SRC)
endif #ESAPI
### Man Pages
man3_MANS = man/man3/Tss2_Tcti_Device_Init.3 man/man3/Tss2_Tcti_Mssim_Init.3 $(DOXYMAN3)
man7_MANS = man/man7/tss2-tcti-device.7 man/man7/tss2-tcti-mssim.7
man/man3/%.3 : man/%.3.in $(srcdir)/man/man-postlude.troff
$(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
man/man7/%.7 : man/%.7.in $(srcdir)/man/man-postlude.troff
$(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
EXTRA_DIST += dist/tpm-udev.rules
if WITH_UDEVRULESPREFIX
install-data-hook:
mv $(DESTDIR)$(udevrulesdir)/tpm-udev.rules $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules
uninstall-local:
-rm $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules
endif
EXTRA_DIST += \
man/man-postlude.troff \
man/Tss2_Tcti_Device_Init.3.in \
man/Tss2_Tcti_Mssim_Init.3.in \
man/tss2-tcti-device.7.in \
man/tss2-tcti-mssim.7.in
CLEANFILES += \
$(man3_MANS) \
$(man7_MANS)
### Helper Functions ###
define make_parent_dir
if [ ! -d $(dir $1) ]; then mkdir -p $(dir $1); fi
endef
# function to transform man .in files to man pages
# $1: target
# $2: .in file
# $3: man postlude file
define make_man
$(call make_parent_dir,$1) && \
cat $2 $3 > $1 && \
sed -i -e "s,[@]VERSION[@],$(PACKAGE_VERSION),g;" $1
endef