forked from tpm2-software/tpm2-tss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
756 lines (676 loc) · 26.7 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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c) 2015 - 2018 Intel Corporation
# Copyright (c) 2018 Fraunhofer SIT sponsored by Infineon Technologies AG
# All rights reserved.
-include $(top_srcdir)/git.mk
### Initialize global variables used throughout the file ###
INCLUDE_DIRS = -I$(srcdir)/src -I$(srcdir)/include/tss2
ACLOCAL_AMFLAGS = -I m4 --install
AM_CFLAGS = $(INCLUDE_DIRS) $(EXTRA_CFLAGS) $(CODE_COVERAGE_CFLAGS) \
$(SANITIZER_CFLAGS)
AM_LDFLAGS = $(EXTRA_LDFLAGS) $(CODE_COVERAGE_LIBS) $(SANITIZER_LDFLAGS)
# Initialize empty variables to be extended throughout
lib_LTLIBRARIES =
noinst_LTLIBRARIES =
EXTRA_DIST =
DISTCLEANFILES =
CLEANFILES =
MOSTLYCLEANFILES =
noinst_PROGRAMS =
MAINTAINERCLEANFILES = \
$(DIST_ARCHIVES) \
AUTHORS
TSS_GITIGNOREFILES = \
$(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
$(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \
$(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL) \
src_vars.mk \
Makefile-fuzz-generated.am \
aminclude_static.am \
m4/ax_ac_append_to_file.m4 \
m4/ax_ac_print_to_file.m4 \
m4/ax_add_am_macro_static.m4 \
m4/ax_add_fortify_source.m4 \
m4/ax_am_macros_static.m4 \
m4/ax_check_compile_flag.m4 \
m4/ax_check_enable_debug.m4 \
m4/ax_check_gnu_make.m4 \
m4/ax_check_link_flag.m4 \
m4/ax_check_preproc_flag.m4 \
m4/ax_code_coverage.m4 \
m4/ax_file_escapes.m4 \
m4/ax_is_release.m4 \
m4/ax_normalize_path.m4 \
m4/ax_prog_doxygen.m4 \
m4/ax_valgrind_check.m4 \
m4/pkg.m4
GITIGNOREFILES = ""
### Add ax_* rules ###
# ax_code_coverage
if AUTOCONF_CODE_COVERAGE_2019_01_06
include $(top_srcdir)/aminclude_static.am
clean-local: code-coverage-clean
distclean-local: code-coverage-dist-clean
else
@CODE_COVERAGE_RULES@
endif
GITIGNOREFILES += $(TSS_GITIGNOREFILES)
CODE_COVERAGE_DIRECTORY = $(top_builddir)/src $(top_builddir)/test
# ax_valgrind_check
@VALGRIND_CHECK_RULES@
# ax_doxygen
@DX_RULES@
MOSTLYCLEANFILES += $(DX_CLEANFILES)
if DOXYMAN
DOXYMAN3 = \
doxygen-doc/man/ESYS_CONTEXT.3 \
doxygen-doc/man/ESYS_TR.3 \
doxygen-doc/man/ESYS_TR_defines.3 \
doxygen-doc/man/Esys_ActivateCredential.3 \
doxygen-doc/man/Esys_Certify.3 \
doxygen-doc/man/Esys_CertifyCreation.3 \
doxygen-doc/man/Esys_ChangeEPS.3 \
doxygen-doc/man/Esys_ChangePPS.3 \
doxygen-doc/man/Esys_Clear.3 \
doxygen-doc/man/Esys_ClearControl.3 \
doxygen-doc/man/Esys_ClockRateAdjust.3 \
doxygen-doc/man/Esys_ClockSet.3 \
doxygen-doc/man/Esys_Commit.3 \
doxygen-doc/man/Esys_ContextLoad.3 \
doxygen-doc/man/Esys_ContextSave.3 \
doxygen-doc/man/Esys_Create.3 \
doxygen-doc/man/Esys_CreatePrimary.3 \
doxygen-doc/man/Esys_DictionaryAttackLockReset.3 \
doxygen-doc/man/Esys_DictionaryAttackParameters.3 \
doxygen-doc/man/Esys_Duplicate.3 \
doxygen-doc/man/Esys_ECC_Parameters.3 \
doxygen-doc/man/Esys_ECDH_KeyGen.3 \
doxygen-doc/man/Esys_ECDH_ZGen.3 \
doxygen-doc/man/Esys_EC_Ephemeral.3 \
doxygen-doc/man/Esys_EncryptDecrypt.3 \
doxygen-doc/man/Esys_EventSequenceComplete.3 \
doxygen-doc/man/Esys_EvictControl.3 \
doxygen-doc/man/Esys_FlushContext.3 \
doxygen-doc/man/Esys_GetCapability.3 \
doxygen-doc/man/Esys_GetCommandAuditDigest.3 \
doxygen-doc/man/Esys_GetRandom.3 \
doxygen-doc/man/Esys_GetSessionAuditDigest.3 \
doxygen-doc/man/Esys_GetTestResult.3 \
doxygen-doc/man/Esys_GetTime.3 \
doxygen-doc/man/Esys_Hash.3 \
doxygen-doc/man/Esys_HashSequenceStart.3 \
doxygen-doc/man/Esys_HierarchyChangeAuth.3 \
doxygen-doc/man/Esys_HierarchyControl.3 \
doxygen-doc/man/Esys_HMAC.3 \
doxygen-doc/man/Esys_HMAC_Start.3 \
doxygen-doc/man/Esys_Import.3 \
doxygen-doc/man/Esys_IncrementalSelfTest.3 \
doxygen-doc/man/Esys_Load.3 \
doxygen-doc/man/Esys_LoadExternal.3 \
doxygen-doc/man/Esys_MakeCredential.3 \
doxygen-doc/man/Esys_NV_Certify.3 \
doxygen-doc/man/Esys_NV_ChangeAuth.3 \
doxygen-doc/man/Esys_NV_DefineSpace.3 \
doxygen-doc/man/Esys_NV_Extend.3 \
doxygen-doc/man/Esys_NV_GlobalWriteLock.3 \
doxygen-doc/man/Esys_NV_Increment.3 \
doxygen-doc/man/Esys_NV_Read.3 \
doxygen-doc/man/Esys_NV_ReadLock.3 \
doxygen-doc/man/Esys_NV_ReadPublic.3 \
doxygen-doc/man/Esys_NV_SetBits.3 \
doxygen-doc/man/Esys_NV_UndefineSpace.3 \
doxygen-doc/man/Esys_NV_UndefineSpaceSpecial.3 \
doxygen-doc/man/Esys_NV_Write.3 \
doxygen-doc/man/Esys_NV_WriteLock.3 \
doxygen-doc/man/Esys_ObjectChangeAuth.3 \
doxygen-doc/man/Esys_PCR_Allocate.3 \
doxygen-doc/man/Esys_PCR_Event.3 \
doxygen-doc/man/Esys_PCR_Extend.3 \
doxygen-doc/man/Esys_PCR_Read.3 \
doxygen-doc/man/Esys_PCR_Reset.3 \
doxygen-doc/man/Esys_PCR_SetAuthPolicy.3 \
doxygen-doc/man/Esys_PCR_SetAuthValue.3 \
doxygen-doc/man/Esys_PolicyAuthorize.3 \
doxygen-doc/man/Esys_PolicyAuthValue.3 \
doxygen-doc/man/Esys_PolicyCommandCode.3 \
doxygen-doc/man/Esys_PolicyCounterTimer.3 \
doxygen-doc/man/Esys_PolicyCpHash.3 \
doxygen-doc/man/Esys_PolicyDuplicationSelect.3 \
doxygen-doc/man/Esys_PolicyGetDigest.3 \
doxygen-doc/man/Esys_PolicyLocality.3 \
doxygen-doc/man/Esys_PolicyNameHash.3 \
doxygen-doc/man/Esys_PolicyNV.3 \
doxygen-doc/man/Esys_PolicyNvWritten.3 \
doxygen-doc/man/Esys_PolicyOR.3 \
doxygen-doc/man/Esys_PolicyPassword.3 \
doxygen-doc/man/Esys_PolicyPCR.3 \
doxygen-doc/man/Esys_PolicyPhysicalPresence.3 \
doxygen-doc/man/Esys_PolicyRestart.3 \
doxygen-doc/man/Esys_PolicySecret.3 \
doxygen-doc/man/Esys_PolicySigned.3 \
doxygen-doc/man/Esys_PolicyTicket.3 \
doxygen-doc/man/Esys_PP_Commands.3 \
doxygen-doc/man/Esys_Quote.3 \
doxygen-doc/man/Esys_ReadClock.3 \
doxygen-doc/man/Esys_ReadPublic.3 \
doxygen-doc/man/Esys_Rewrap.3 \
doxygen-doc/man/Esys_RSA_Decrypt.3 \
doxygen-doc/man/Esys_RSA_Encrypt.3 \
doxygen-doc/man/Esys_SelfTest.3 \
doxygen-doc/man/Esys_SequenceComplete.3 \
doxygen-doc/man/Esys_SequenceUpdate.3 \
doxygen-doc/man/Esys_SetAlgorithmSet.3 \
doxygen-doc/man/Esys_SetCommandCodeAuditStatus.3 \
doxygen-doc/man/Esys_SetPrimaryPolicy.3 \
doxygen-doc/man/Esys_Shutdown.3 \
doxygen-doc/man/Esys_Sign.3 \
doxygen-doc/man/Esys_StartAuthSession.3 \
doxygen-doc/man/Esys_Startup.3 \
doxygen-doc/man/Esys_StirRandom.3 \
doxygen-doc/man/Esys_TestParms.3 \
doxygen-doc/man/Esys_Unseal.3 \
doxygen-doc/man/Esys_Vendor_TCG_Test.3 \
doxygen-doc/man/Esys_VerifySignature.3 \
doxygen-doc/man/Esys_ZGen_2Phase.3
$(DOXYMAN3): doxygen-doc
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
# Add fuzz definitions
include Makefile-fuzz.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 \
MAINTAINERS \
README.md \
RELEASE.md
# Windows code / core build files
EXTRA_DIST += \
include/tss2/tss2_tcti_tbs.h \
lib/tss2-tcti-tbs.def \
src/tss2-tcti/tcti-tbs.c \
src/tss2-tcti/tcti-tbs.h \
src/tss2-tcti/tss2-tcti-tbs.vcxproj \
src/tss2-tcti/tss2-tcti-tbs.vcxproj.filters \
tpm2-tss.sln
# 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
# pkg-config setup. pc-file declarations happen in the corresponding modules
pkgconfig_DATA =
DISTCLEANFILES += $(pkgconfig_DATA)
# 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_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)
pkgconfig_DATA += lib/tss2-mu.pc
EXTRA_DIST += lib/tss2-mu.map lib/tss2-mu.def src/tss2-mu/tss2-mu.vcxproj
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 loader library
libtss2_tctildr = src/tss2-tcti/libtss2-tctildr.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tctildr.h
lib_LTLIBRARIES += $(libtss2_tctildr)
pkgconfig_DATA += lib/tss2-tctildr.pc
EXTRA_DIST += lib/tss2-tctildr.map
src_tss2_tcti_libtss2_tctildr_la_CFLAGS = $(AM_CFLAGS)
if HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tctildr_la_LDFLAGS = \
-Wl,--version-script=$(srcdir)/lib/tss2-tctildr.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tctildr_la_LIBADD = $(libutil)
src_tss2_tcti_libtss2_tctildr_la_SOURCES = \
src/tss2-tcti/tctildr.c src/tss2-tcti/tctildr.h \
src/tss2-tcti/tctildr-interface.h
if NO_DL
src_tss2_tcti_libtss2_tctildr_la_LIBADD += $(libtss2_tcti_device) $(libtss2_tcti_mssim)
src_tss2_tcti_libtss2_tctildr_la_SOURCES += src/tss2-tcti/tctildr-nodl.c src/tss2-tcti/tctildr-nodl.h
else
src_tss2_tcti_libtss2_tctildr_la_LIBADD += $(LIBADD_DL)
src_tss2_tcti_libtss2_tctildr_la_SOURCES += src/tss2-tcti/tctildr-dl.c src/tss2-tcti/tctildr-dl.h
endif
# 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)
pkgconfig_DATA += lib/tss2-tcti-device.pc
EXTRA_DIST += lib/tss2-tcti-device.map
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-device.c
endif # ENABLE_TCTI_DEVICE
# tcti library for swtpm
if ENABLE_TCTI_SWTPM
libtss2_tcti_swtpm = src/tss2-tcti/libtss2-tcti-swtpm.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_swtpm.h
lib_LTLIBRARIES += $(libtss2_tcti_swtpm)
pkgconfig_DATA += lib/tss2-tcti-swtpm.pc
EXTRA_DIST += lib/tss2-tcti-swtpm.map lib/tss2-tcti-swtpm.def src/tss2-tcti/tss2-tcti-swtpm.vcxproj
if HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_swtpm_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-swtpm.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_swtpm_la_LIBADD = $(libtss2_mu) $(libutil)
src_tss2_tcti_libtss2_tcti_swtpm_la_SOURCES = \
src/tss2-tcti/tcti-common.c \
src/tss2-tcti/tcti-swtpm.c \
src/tss2-tcti/tcti-swtpm.h
endif # ENABLE_TCTI_SWTPM
# 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)
pkgconfig_DATA += lib/tss2-tcti-mssim.pc
EXTRA_DIST += lib/tss2-tcti-mssim.map \
lib/tss2-tcti-mssim.def \
src/tss2-tcti/tss2-tcti-mssim.vcxproj \
src/tss2-tcti/tss2-tcti-mssim.vcxproj.filters
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) $(libutil)
src_tss2_tcti_libtss2_tcti_mssim_la_SOURCES = \
src/tss2-tcti/tcti-common.c \
src/tss2-tcti/tcti-mssim.c
endif # ENABLE_TCTI_MSSIM
# tcti pcap library
if ENABLE_TCTI_PCAP
libtss2_tcti_pcap = src/tss2-tcti/libtss2-tcti-pcap.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_pcap.h
lib_LTLIBRARIES += $(libtss2_tcti_pcap)
pkgconfig_DATA += lib/tss2-tcti-pcap.pc
EXTRA_DIST += lib/tss2-tcti-pcap.map # joho TODO enable tcti-pcap for Win (.def, visual studio files
if HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_pcap_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-pcap.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_pcap_la_LIBADD = $(libtss2_tctildr) $(libtss2_mu) $(libutil)
src_tss2_tcti_libtss2_tcti_pcap_la_SOURCES = \
src/tss2-tcti/tcti-common.c \
src/tss2-tcti/tcti-pcap-builder.c \
src/tss2-tcti/tcti-pcap.c
endif # ENABLE_TCTI_PCAP
# tcti library for sub-process commands
if ENABLE_TCTI_CMD
libtss2_tcti_cmd = src/tss2-tcti/libtss2-tcti-cmd.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_cmd.h
lib_LTLIBRARIES += $(libtss2_tcti_cmd)
pkgconfig_DATA += lib/tss2-tcti-cmd.pc
EXTRA_DIST += lib/tss2-tcti-cmd.map \
lib/tss2-tcti-cmd.def
if HAVE_LD_VERSION_SCRIPT
if !UNIT
src_tss2_tcti_libtss2_tcti_cmd_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-cmd.map
endif # UNIT
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_cmd_la_LIBADD = $(libutil) $(libtss2_mu)
src_tss2_tcti_libtss2_tcti_cmd_la_SOURCES = \
src/tss2-tcti/tcti-common.c \
src/tss2-tcti/tcti-cmd.c \
src/tss2-tcti/tcti-cmd.h
endif # ENABLE_TCTI_CMD
### TCG TSS SYS spec library ###
libtss2_sys = src/tss2-sys/libtss2-sys.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_sys.h
lib_LTLIBRARIES += $(libtss2_sys)
pkgconfig_DATA += lib/tss2-sys.pc
src_tss2_sys_libtss2_sys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-sys
src_tss2_sys_libtss2_sys_la_LDFLAGS = $(AM_LDFLAGS) $(LIBSOCKET_LDFLAGS)
if HAVE_LD_VERSION_SCRIPT
src_tss2_sys_libtss2_sys_la_LDFLAGS += -Wl,--version-script=$(srcdir)/lib/tss2-sys.map
endif # HAVE_LD_VERSION_SCRIPT
# Bump sys soname due to commit 1414f73902cd0c64e447522c64c8e439fa2074b7
# breaking the backwards compatibility of Tss2_Sys_ReadClock call.
src_tss2_sys_libtss2_sys_la_LDFLAGS += -version-info 1:0:0
src_tss2_sys_libtss2_sys_la_LIBADD = $(libtss2_mu) $(libutil)
src_tss2_sys_libtss2_sys_la_SOURCES = $(TSS2_SYS_SRC)
EXTRA_DIST += lib/tss2-sys.map lib/tss2-sys.def src/tss2-sys/tss2-sys.vcxproj
### TCG TSS ESYS spec library ###
if ESYS
libtss2_esys = src/tss2-esys/libtss2-esys.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_esys.h
lib_LTLIBRARIES += $(libtss2_esys)
pkgconfig_DATA += lib/tss2-esys.pc
if ESYS_OSSL
TSS2_ESYS_SRC_CRYPTO = src/tss2-esys/esys_crypto_ossl.h src/tss2-esys/esys_crypto_ossl.c
endif
if ESYS_MBED
TSS2_ESYS_SRC_CRYPTO = src/tss2-esys/esys_crypto_mbed.h src/tss2-esys/esys_crypto_mbed.c
endif
src_tss2_esys_libtss2_esys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-esys \
$(TSS2_ESYS_CFLAGS_CRYPTO)
src_tss2_esys_libtss2_esys_la_LIBADD = $(libtss2_sys) $(libtss2_mu) $(libutil)
src_tss2_esys_libtss2_esys_la_LDFLAGS = $(AM_LDFLAGS) $(LIBSOCKET_LDFLAGS) \
$(TSS2_ESYS_LDFLAGS_CRYPTO)
if HAVE_LD_VERSION_SCRIPT
src_tss2_esys_libtss2_esys_la_LDFLAGS += -Wl,--version-script=$(srcdir)/lib/tss2-esys.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_esys_libtss2_esys_la_SOURCES = $(TSS2_ESYS_SRC) $(TSS2_ESYS_SRC_CRYPTO) \
src/tss2-tcti/tctildr.c src/tss2-tcti/tctildr.h \
src/tss2-tcti/tctildr-interface.h
if NO_DL
src_tss2_esys_libtss2_esys_la_LIBADD += $(libtss2_tcti_device) $(libtss2_tcti_mssim) $(libtss2_tcti_cmd)
src_tss2_esys_libtss2_esys_la_SOURCES += src/tss2-tcti/tctildr-nodl.c src/tss2-tcti/tctildr-nodl.h
else
src_tss2_esys_libtss2_esys_la_LIBADD += $(LIBADD_DL)
src_tss2_esys_libtss2_esys_la_SOURCES += src/tss2-tcti/tctildr-dl.c src/tss2-tcti/tctildr-dl.h
endif
EXTRA_DIST += lib/tss2-esys.map \
lib/tss2-esys.def \
src/tss2-esys/tss2-esys.vcxproj \
src/tss2-esys/tss2-esys.vcxproj.filters
endif #ESYS
### TCG TSS error decoding spec library ###
libtss2_rc = src/tss2-rc/libtss2-rc.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_rc.h
lib_LTLIBRARIES += $(libtss2_rc)
pkgconfig_DATA += lib/tss2-rc.pc
EXTRA_DIST += lib/tss2-rc.map lib/tss2-rc.def
if HAVE_LD_VERSION_SCRIPT
src_tss2_rc_libtss2_rc_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-rc.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_rc_libtss2_rc_la_SOURCES = $(TSS2_RC_SRC)
### TCG TSS FAPI spec library ###
if FAPI
fapiconfdir = @sysconfdir@/tpm2-tss
fapiconf_DATA = fapi-config.json
EXTRA_DIST += dist/fapi-config.json.in
CLEANFILES += fapi-config.json \
man/man5/fapi-config.5 \
man/man5/fapi-profile.5
EXTRA_DIST += man/fapi-config.5.in \
man/fapi-profile.5.in \
man/man-postlude-fapi.troff \
doc/fapi-config.md \
doc/fapi-profile.md
# We have to do this ourselves, in order to get absolute paths
fapi-config.json: dist/fapi-config.json.in
$(AM_V_GEN) $(SED) \
-e 's|[@]prefix@|$(prefix)|g' \
-e 's|[@]datarootdir@|$(datarootdir)|g' \
-e 's|[@]datadir@|$(datadir)|g' \
-e 's|[@]sysconfdir@|$(sysconfdir)|g' \
-e 's|[@]sharedstatedir@|$(sharedstatedir)|g' \
-e 's|[@]localstatedir@|$(localstatedir)|g' \
-e 's|[@]runstatedir@|$(runstatedir)|g' \
-e 's|[@]userstatedir@|$(userstatedir)|g' \
< "$<" > "$@"
sysusers_DATA = dist/sysusers.d/tpm2-tss.conf
tmpfiles_DATA = tpm2-tss-fapi.conf
EXTRA_DIST += dist/sysusers.d/tpm2-tss.conf dist/tmpfiles.d/tpm2-tss-fapi.conf.in
CLEANFILES += tpm2-tss-fapi.conf
# We have to do this ourselves, in order to get absolute paths
tpm2-tss-fapi.conf: dist/tmpfiles.d/tpm2-tss-fapi.conf.in
$(AM_V_GEN) $(SED) \
-e 's|[@]localstatedir@|$(localstatedir)|g' \
-e 's|[@]runstatedir@|$(runstatedir)|g' \
< "$<" > "$@"
EXTRA_DIST += dist/fapi-profiles/P_RSA2048SHA256.json \
dist/fapi-profiles/P_ECCP256SHA256.json
fapiprofilesdir = @sysconfdir@/tpm2-tss/fapi-profiles
fapiprofiles_DATA = dist/fapi-profiles/P_RSA2048SHA256.json \
dist/fapi-profiles/P_ECCP256SHA256.json
libtss2_fapi = src/tss2-fapi/libtss2-fapi.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_fapi.h
lib_LTLIBRARIES += $(libtss2_fapi)
pkgconfig_DATA += lib/tss2-fapi.pc
EXTRA_DIST += \
lib/tss2-fapi.map \
lib/tss2-fapi.def \
test/data/fapi/P_RSA_EK_persistent.json \
test/data/fapi/P_RSA.json \
test/data/fapi/P_RSA2.json \
test/data/fapi/P_RSA_nameAlg_sha1.json \
test/data/fapi/P_ECC_sh_eh_policy.json \
test/data/fapi/P_ECC_error.json \
test/data/fapi/P_RSA_sh_policy.json \
test/data/fapi/P_RSA256.json \
test/data/fapi/P_ECC.json \
test/data/fapi/policy/pol_pcr16_0.json \
test/data/fapi/policy/pol_pcr16_0_rsa_authorized.json \
test/data/fapi/policy/pol_pcr16_0_ecc_authorized.json \
test/data/fapi/policy/pol_pcr16_0_fail.json \
test/data/fapi/policy/pol_pcr16_0_or.json \
test/data/fapi/policy/pol_pcr8_0.json \
test/data/fapi/policy/pol_nv.json \
test/data/fapi/policy/pol_nv_counter.json \
test/data/fapi/policy/pol_nv_written.json \
test/data/fapi/policy/pol_signed.json \
test/data/fapi/policy/pol_signed_ecc.json \
test/data/fapi/policy/pol_authorize.json \
test/data/fapi/policy/pol_authorize_rsa_pem.json \
test/data/fapi/policy/pol_authorize_ecc_pem.json \
test/data/fapi/policy/pol_authorize_outer.json \
test/data/fapi/policy/pol_authorize_nv.json \
test/data/fapi/policy/pol_secret.json \
test/data/fapi/policy/pol_password.json \
test/data/fapi/policy/pol_auth_value.json \
test/data/fapi/policy/pol_command_code.json \
test/data/fapi/policy/pol_locality.json \
test/data/fapi/policy/pol_physical_presence.json \
test/data/fapi/policy/pol_duplicate.json \
test/data/fapi/policy/pol_nv_change_auth.json \
test/data/fapi/policy/pol_countertimer.json \
test/data/fapi/policy/pol_name_hash.json \
test/data/fapi/policy/pol_pcr16_read.json \
test/data/fapi/policy/pol_action.json \
test/data/fapi/policy/pol_cphash.json \
test/data/fapi/policy/pol_or_read_write_secret.json
src_tss2_fapi_libtss2_fapi_la_LIBADD = $(libtss2_sys) $(libtss2_mu) $(libtss2_esys) \
$(libutil) $(libtss2_tctildr)
src_tss2_fapi_libtss2_fapi_la_SOURCES = $(TSS2_FAPI_SRC)
src_tss2_fapi_libtss2_fapi_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-fapi $(LIBCRYPTO_CFLAGS) $(JSONC_CFLAGS) $(CURL_CFLAGS)
src_tss2_fapi_libtss2_fapi_la_LDFLAGS = $(AM_LDFLAGS) $(LIBCRYPTO_LIBS) $(JSONC_LIBS) $(CURL_LIBS)
if HAVE_LD_VERSION_SCRIPT
src_tss2_fapi_libtss2_fapi_la_LDFLAGS += -Wl,--version-script=$(srcdir)/lib/tss2-fapi.map
endif # HAVE_LD_VERSION_SCRIPT
# Bump soname due to commit e0636dd6fbec4f286cc908117ecef4d820a50f79 breaking
# the API and ABI of Fapi_CB_{Auth,Sign,Branch,PolicyAction}
src_tss2_fapi_libtss2_fapi_la_LDFLAGS += -version-info 1:0:0
if DOXYMAN
DOXYMAN3 += \
doxygen-doc/man/Fapi_AuthorizePolicy.3 \
doxygen-doc/man/Fapi_ChangeAuth.3 \
doxygen-doc/man/Fapi_CreateKey.3 \
doxygen-doc/man/Fapi_CreateNv.3 \
doxygen-doc/man/Fapi_CreateSeal.3 \
doxygen-doc/man/Fapi_Decrypt.3 \
doxygen-doc/man/Fapi_Delete.3 \
doxygen-doc/man/Fapi_Encrypt.3 \
doxygen-doc/man/Fapi_ExportKey.3 \
doxygen-doc/man/Fapi_ExportPolicy.3 \
doxygen-doc/man/Fapi_Finalize.3 \
doxygen-doc/man/Fapi_Free.3 \
doxygen-doc/man/Fapi_GetAppData.3 \
doxygen-doc/man/Fapi_GetCertificate.3 \
doxygen-doc/man/Fapi_GetDescription.3 \
doxygen-doc/man/Fapi_GetInfo.3 \
doxygen-doc/man/Fapi_GetPlatformCertificates.3 \
doxygen-doc/man/Fapi_GetPollHandles.3 \
doxygen-doc/man/Fapi_GetRandom.3 \
doxygen-doc/man/Fapi_GetTcti.3 \
doxygen-doc/man/Fapi_GetTpmBlobs.3 \
doxygen-doc/man/Fapi_Import.3 \
doxygen-doc/man/Fapi_Initialize.3 \
doxygen-doc/man/Fapi_List.3 \
doxygen-doc/man/Fapi_NvExtend.3 \
doxygen-doc/man/Fapi_NvIncrement.3 \
doxygen-doc/man/Fapi_NvRead.3 \
doxygen-doc/man/Fapi_NvSetBits.3 \
doxygen-doc/man/Fapi_NvWrite.3 \
doxygen-doc/man/Fapi_PcrExtend.3 \
doxygen-doc/man/Fapi_PcrRead.3 \
doxygen-doc/man/Fapi_Provision.3 \
doxygen-doc/man/Fapi_Quote.3 \
doxygen-doc/man/Fapi_SetAppData.3 \
doxygen-doc/man/Fapi_SetAuthCB.3 \
doxygen-doc/man/Fapi_SetBranchCB.3 \
doxygen-doc/man/Fapi_SetCertificate.3 \
doxygen-doc/man/Fapi_SetDescription.3 \
doxygen-doc/man/Fapi_SetSignCB.3 \
doxygen-doc/man/Fapi_Sign.3 \
doxygen-doc/man/FapiTestgroup.3 \
doxygen-doc/man/Fapi_Unseal.3 \
doxygen-doc/man/Fapi_VerifyQuote.3 \
doxygen-doc/man/Fapi_VerifySignature.3 \
doxygen-doc/man/Fapi_WriteAuthorizeNv.3
endif #DOXYMAN
endif #FAPI
### Helper Functions ###
define make_parent_dir
if [ ! -d $(dir $1) ]; then mkdir -p $(dir $1); fi
endef
define make_tss_user_and_group
(id -g tss 2>/dev/null || groupadd -r tss) && \
(id -u tss 2>/dev/null || useradd -r -g tss tss)
endef
define make_tss_dir
($(call make_parent_dir,$1))
endef
define set_tss_permissions
(chown -R tss:tss "$1") && \
(chmod -R 2775 "$1") && \
(setfacl -m default:group:tss:rwx "$1")
endef
define make_fapi_dirs
($(call make_tss_dir,$(DESTDIR)$(runstatedir)/tpm2-tss/eventlog/) || true) && \
($(call make_tss_dir,$(DESTDIR)$(localstatedir)/lib/tpm2-tss/system/keystore/))
endef
define set_fapi_permissions
($(call set_tss_permissions,$(DESTDIR)$(runstatedir)/tpm2-tss))
($(call set_tss_permissions,$(DESTDIR)$(localstatedir)/lib/tpm2-tss))
endef
define check_dir
if [ ! -d "$1" ]; then echo "WARNING Directory $1 could not be created"; fi
endef
define check_fapi_dirs
($(call check_dir,$(DESTDIR)$(runstatedir)/tpm2-tss/eventlog/))
($(call check_dir,$(DESTDIR)$(localstatedir)/lib/tpm2-tss/system/keystore/))
endef
### Man Pages
man3_MANS = \
man/man3/Tss2_Tcti_Cmd_Init.3 \
man/man3/Tss2_Tcti_Device_Init.3 \
man/man3/Tss2_Tcti_Mssim_Init.3 \
man/man3/Tss2_TctiLdr_Finalize.3 \
man/man3/Tss2_TctiLdr_FreeInfo.3 \
man/man3/Tss2_TctiLdr_GetInfo.3 \
man/man3/Tss2_TctiLdr_Initialize.3 \
$(DOXYMAN3)
man7_MANS = \
man/man7/tss2-tcti-device.7 \
man/man7/tss2-tcti-swtpm.7 \
man/man7/tss2-tcti-mssim.7 \
man/man7/tss2-tcti-cmd.7 \
man/man7/tss2-tctildr.7
if FAPI
man5_MANS = \
man/man5/fapi-config.5 \
man/man5/fapi-profile.5
endif #FAPI
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)
if FAPI
man/man5/%.5 : man/%.5.in $(srcdir)/man/man-postlude-fapi.troff
$(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude-fapi.troff)
install-man-fapi: install-man3 install-man5 install-man7
$(LN_S) -f Tss2_TctiLdr_Initialize.3 $(DESTDIR)$(man3dir)/Tss2_TctiLdr_Initialize_Ex.3
else
install-man: install-man3 install-man7
$(LN_S) -f Tss2_TctiLdr_Initialize.3 $(DESTDIR)$(man3dir)/Tss2_TctiLdr_Initialize_Ex.3
endif #FAPI
EXTRA_DIST += dist/tpm-udev.rules
install-dirs:
if HOSTOS_LINUX
if SYSD_SYSUSERS
@echo "systemd-sysusers $(DESTDIR)$(sysconfdir)/sysusers.d/tpm2-tss.conf"
@systemd-sysusers $(DESTDIR)$(sysconfdir)/sysusers.d/tpm2-tss.conf || echo "WARNING Failed to create the tss user and group"
else
@echo "call make_tss_user_and_group"
@$(call make_tss_user_and_group) || echo "WARNING Failed to create the tss user and group"
endif
if SYSD_TMPFILES
@echo "systemd-tmpfiles --create $(DESTDIR)$(sysconfdir)/tmpfiles.d/tpm2-tss-fapi.conf"
@systemd-tmpfiles --create $(DESTDIR)$(sysconfdir)/tmpfiles.d/tpm2-tss-fapi.conf|| echo "WARNING Failed to create the FAPI directories with the correct permissions"
else
@echo "(call make_fapi_dirs) && (call set_fapi_permissions)"
@-$(call make_fapi_dirs) && $(call set_fapi_permissions) || echo "WARNING Failed to create the FAPI directories with the correct permissions"
endif
@echo "call check_fapi_dirs"
@$(call check_fapi_dirs)
endif
install-data-hook: install-dirs
-if [ ! -z "$(udevrulesprefix)" ]; then \
mv $(DESTDIR)$(udevrulesdir)/tpm-udev.rules $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules; \
fi
uninstall-local:
-rm $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules
cd $(DESTDIR)$(man3dir) && \
[ -L Tss2_TctiLdr_Initialize_Ex.3 ] && \
rm -f Tss2_TctiLdr_Initialize_Ex.3 || true
EXTRA_DIST += \
doc/doxygen.dox \
doc/coding_standard_c.md \
doc/logging.md \
doc/fuzzing.md \
doc/TSS_block_diagram.png \
man/man-postlude.troff \
man/Tss2_Tcti_Cmd_Init.3.in \
man/Tss2_Tcti_Device_Init.3.in \
man/Tss2_Tcti_Mssim_Init.3.in \
man/Tss2_TctiLdr_Finalize.3.in \
man/Tss2_TctiLdr_FreeInfo.3.in \
man/Tss2_TctiLdr_GetInfo.3.in \
man/Tss2_TctiLdr_Initialize.3.in \
man/tss2-tcti-pcap.7.in \
man/tss2-tcti-device.7.in \
man/man7/tss2-tcti-swtpm.7 \
man/tss2-tcti-mssim.7.in \
man/tss2-tcti-cmd.7.in \
man/tss2-tctildr.7.in
CLEANFILES += \
$(man3_MANS) \
$(man7_MANS)
# 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_tmp" && \
$(SED) 's/[@]VERSION[@]/$(PACKAGE_VERSION)/g' "$1_tmp" > $1 && \
rm "$1_tmp"
endef