blob: 9e6110eced869b7307d5cfe57ef03325f915d7ea [file] [log] [blame]
Will Arthurca8e7f32015-08-03 15:35:19 -04001#;**********************************************************************;
Philip Tricca49635f42018-03-10 19:19:58 -08002# Copyright (c) 2015 - 2018 Intel Corporation
Andreas Fuchs0dc7c292018-02-28 20:01:13 +01003# Copyright (c) 2018 Fraunhofer SIT sponsored by Infineon Technologies AG
Will Arthurca8e7f32015-08-03 15:35:19 -04004# All rights reserved.
5#
Andreas Fuchs0dc7c292018-02-28 20:01:13 +01006# Redistribution and use in source and binary forms, with or without
Will Arthurca8e7f32015-08-03 15:35:19 -04007# modification, are permitted provided that the following conditions are met:
Andreas Fuchs0dc7c292018-02-28 20:01:13 +01008#
9# 1. Redistributions of source code must retain the above copyright notice,
Will Arthurca8e7f32015-08-03 15:35:19 -040010# this list of conditions and the following disclaimer.
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010011#
12# 2. Redistributions in binary form must reproduce the above copyright notice,
13# this list of conditions and the following disclaimer in the documentation
Will Arthurca8e7f32015-08-03 15:35:19 -040014# and/or other materials provided with the distribution.
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010015#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
Will Arthurca8e7f32015-08-03 15:35:19 -040026# THE POSSIBILITY OF SUCH DAMAGE.
27#;**********************************************************************;
Andreas Fuchs2968c712018-02-01 18:22:47 +010028
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010029### Initialize global variables used throughout the file ###
Philip Triccad5a6ff42018-03-13 18:19:42 -070030INCLUDE_DIRS = -I$(srcdir)/src -I$(srcdir)/include/tss2
Philip Triccaa509a682015-09-14 15:34:52 -070031ACLOCAL_AMFLAGS = -I m4
Andreas Fuchs61cb7fb2017-11-22 10:23:01 +010032AM_CFLAGS = $(INCLUDE_DIRS) $(EXTRA_CFLAGS) $(CODE_COVERAGE_CFLAGS)
33AM_LDFLAGS = $(EXTRA_LDFLAGS) $(CODE_COVERAGE_LIBS)
Philip Triccaa509a682015-09-14 15:34:52 -070034
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010035# Initialize empty variables to be extended throughout
36lib_LTLIBRARIES =
37noinst_LTLIBRARIES =
38EXTRA_DIST =
39CLEANFILES =
40MOSTLYCLEANFILES =
Andreas Fuchsa0eda362018-03-28 11:56:42 +020041noinst_PROGRAMS =
Philip Tricca4334dee2016-08-09 19:56:28 -070042
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010043### Add ax_* rules ###
44# ax_code_coverage
45@CODE_COVERAGE_RULES@
Juergen Reppff821bd2017-12-11 15:21:42 +010046
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010047# ax_doxygen
48@DX_RULES@
49MOSTLYCLEANFILES += $(DX_CLEANFILES)
Philip Tricca99d41422017-06-18 15:11:50 -070050
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010051### Include make files ###
52# Add source code files from bootstrap
53include src_vars.mk
Andreas Fuchs24fb1302017-11-22 10:21:18 +010054
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010055# Add test definitions
56include Makefile-test.am
hp43ac71d2016-12-02 11:16:45 -080057
dantpmd0899fe2018-04-06 14:26:05 -070058### Distribution files ###
Javier Martinez Canillas0075f882018-04-13 12:49:37 +020059# Add udev rule
Javier Martinez Canillas0075f882018-04-13 12:49:37 +020060udevrules_DATA = dist/tpm-udev.rules
Javier Martinez Canillas0075f882018-04-13 12:49:37 +020061
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010062# Adding user and developer information
63EXTRA_DIST += \
Philip Triccac0841fc2017-12-08 12:10:20 -080064 CHANGELOG.md \
65 CONTRIBUTING.md \
66 INSTALL.md \
67 LICENSE \
68 README.md \
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010069 RELEASE.md
Philip Tricca2bd4adb2015-09-25 00:14:16 -070070
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010071# Generate the AUTHORS file from git log
72AUTHORS :
73 $(AM_V_GEN)git log --format='%aN <%aE>' | grep -v 'users.noreply.github.com' | sort | \
74 uniq -c | sort -nr | sed 's/^\s*//' | cut -d" " -f2- > $@
75EXTRA_DIST += AUTHORS
76CLEANFILES += AUTHORS
Philip Triccab194be92016-03-15 13:27:09 -070077
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010078# pkg-config setup. pc-file declarations happen in the corresponding modules
79pkgconfigdir = $(libdir)/pkgconfig
80nodist_pkgconfig_DATA =
81CLEANFILES += $(nodist_pkgconfig_DATA)
Philip Triccae0a93d12017-06-29 08:42:34 -070082
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010083%.pc : %.pc.in
84 $(AM_V_GEN)$(call make_parent_dir,$@) && \
85 sed -e "s,[@]VERSION[@],$(PACKAGE_VERSION),g; \
86 s,[@]libdir[@],$(libdir),g; \
87 s,[@]includedir[@],$(includedir),g;" $^ > $@
Philip Tricca6f634c42016-07-23 12:32:15 -070088
Philip Tricca8ffd3c42018-03-09 16:27:24 -080089# Base TSS2 headers
90tss2dir = $(includedir)/tss2
91tss2_HEADERS = \
92 $(srcdir)/include/tss2/tss2_common.h \
93 $(srcdir)/include/tss2/tss2_tcti.h \
Philip Tricca910f17c2018-03-15 12:38:37 -070094 $(srcdir)/include/tss2/tss2_tpm2_types.h
Philip Tricca8ffd3c42018-03-09 16:27:24 -080095
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010096### Internal utility library
97libutil = libutil.la
98noinst_LTLIBRARIES += $(libutil)
Philip Triccaa003ae62018-02-19 10:32:46 -080099libutil_la_CFLAGS = $(AM_CFLAGS)
Philip Tricca57360da2018-03-15 17:22:10 -0700100libutil_la_SOURCES = $(UTIL_SRC)
Philip Triccaa003ae62018-02-19 10:32:46 -0800101
dantpmd0899fe2018-04-06 14:26:05 -0700102### TCG TSS Marshaling/Unmarshaling spec library ###
Philip Triccaee730622018-03-10 16:40:41 -0800103libtss2_mu = src/tss2-mu/libtss2-mu.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800104tss2_HEADERS += $(srcdir)/include/tss2/tss2_mu.h
Philip Triccaee730622018-03-10 16:40:41 -0800105lib_LTLIBRARIES += $(libtss2_mu)
106nodist_pkgconfig_DATA += lib/tss2-mu.pc
107EXTRA_DIST += lib/tss2-mu.map lib/tss2-mu.pc.in
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100108
David R. Bild1e49b4c2017-11-28 18:09:42 -0600109if HAVE_LD_VERSION_SCRIPT
Philip Triccaee730622018-03-10 16:40:41 -0800110src_tss2_mu_libtss2_mu_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-mu.map
David R. Bild1e49b4c2017-11-28 18:09:42 -0600111endif # HAVE_LD_VERSION_SCRIPT
Philip Triccaee730622018-03-10 16:40:41 -0800112src_tss2_mu_libtss2_mu_la_LIBADD = $(libutil)
113src_tss2_mu_libtss2_mu_la_SOURCES = $(TSS2_MU_SRC)
Philip Tricca73609722017-02-10 10:50:06 -0800114
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100115### TCG TSS TCTI spec libraries ###
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100116# tcti device library
Philip Triccab8584ac2018-03-10 17:02:30 -0800117libtss2_tcti_device = src/tss2-tcti/libtss2-tcti-device.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800118tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_device.h
Philip Triccab8584ac2018-03-10 17:02:30 -0800119lib_LTLIBRARIES += $(libtss2_tcti_device)
120nodist_pkgconfig_DATA += lib/tss2-tcti-device.pc
121EXTRA_DIST += lib/tss2-tcti-device.map lib/tss2-tcti-device.pc.in
Juergen Reppff821bd2017-12-11 15:21:42 +0100122
Philip Triccab8584ac2018-03-10 17:02:30 -0800123src_tss2_tcti_libtss2_tcti_device_la_CFLAGS = $(AM_CFLAGS)
David R. Bild1e49b4c2017-11-28 18:09:42 -0600124if HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800125src_tss2_tcti_libtss2_tcti_device_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-device.map
David R. Bild1e49b4c2017-11-28 18:09:42 -0600126endif # HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800127src_tss2_tcti_libtss2_tcti_device_la_LIBADD = $(libtss2_mu) $(libutil)
Philip Tricca850bb592018-04-03 09:29:22 -0700128src_tss2_tcti_libtss2_tcti_device_la_SOURCES = \
129 src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
130 src/tss2-tcti/tcti-device.c src/tss2-tcti/tcti-device.h
Philip Tricca97e869f2015-11-03 20:19:44 -0500131
dantpmd0899fe2018-04-06 14:26:05 -0700132# tcti library for Microsoft TPM2 simulator
Philip Triccab8584ac2018-03-10 17:02:30 -0800133libtss2_tcti_mssim = src/tss2-tcti/libtss2-tcti-mssim.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800134tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_mssim.h
Philip Triccab8584ac2018-03-10 17:02:30 -0800135lib_LTLIBRARIES += $(libtss2_tcti_mssim)
136nodist_pkgconfig_DATA += lib/tss2-tcti-mssim.pc
137EXTRA_DIST += lib/tss2-tcti-mssim.map lib/tss2-tcti-mssim.pc.in
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100138
Philip Triccab8584ac2018-03-10 17:02:30 -0800139src_tss2_tcti_libtss2_tcti_mssim_la_CFLAGS = $(AM_CFLAGS) $(URIPARSER_CFLAGS)
David R. Bild1e49b4c2017-11-28 18:09:42 -0600140if HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800141src_tss2_tcti_libtss2_tcti_mssim_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-mssim.map
David R. Bild1e49b4c2017-11-28 18:09:42 -0600142endif # HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800143src_tss2_tcti_libtss2_tcti_mssim_la_LIBADD = $(libtss2_mu) $(URIPARSER_LIBS) $(libutil)
Philip Tricca850bb592018-04-03 09:29:22 -0700144src_tss2_tcti_libtss2_tcti_mssim_la_SOURCES = \
145 src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
146 src/tss2-tcti/tcti-mssim.c src/tss2-tcti/tcti-mssim.h
Philip Triccaa51ca972015-11-04 00:13:42 -0500147
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100148### TCG TSS SAPI spec library ###
Philip Tricca5f0ab552018-03-10 18:18:29 -0800149libtss2_sys = src/tss2-sys/libtss2-sys.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800150tss2_HEADERS += $(srcdir)/include/tss2/tss2_sys.h
Philip Tricca5f0ab552018-03-10 18:18:29 -0800151lib_LTLIBRARIES += $(libtss2_sys)
152nodist_pkgconfig_DATA += lib/tss2-sys.pc
153EXTRA_DIST += lib/tss2-sys.pc.in
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800154
Philip Triccad5a6ff42018-03-13 18:19:42 -0700155src_tss2_sys_libtss2_sys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-sys
Andreas Fuchs28164ad2018-03-16 13:33:26 +0100156src_tss2_sys_libtss2_sys_la_LIBADD = $(libtss2_mu) $(libutil)
Philip Tricca5f0ab552018-03-10 18:18:29 -0800157src_tss2_sys_libtss2_sys_la_SOURCES = $(TSS2_SYS_SRC)
hp43ac71d2016-12-02 11:16:45 -0800158
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100159### TCG TSS ESAPI spec library ###
Juergen Reppff821bd2017-12-11 15:21:42 +0100160if ESAPI
Philip Tricca49635f42018-03-10 19:19:58 -0800161libtss2_esys = src/tss2-esys/libtss2-esys.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800162tss2_HEADERS += $(srcdir)/include/tss2/tss2_esys.h
Philip Tricca49635f42018-03-10 19:19:58 -0800163lib_LTLIBRARIES += $(libtss2_esys)
164nodist_pkgconfig_DATA += lib/tss2-esys.pc
165EXTRA_DIST += lib/tss2-esys.pc.in
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800166
Andreas Fuchs037c8782018-03-21 18:52:38 +0100167src_tss2_esys_libtss2_esys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-esys
Philip Tricca49635f42018-03-10 19:19:58 -0800168src_tss2_esys_libtss2_esys_la_LIBADD = $(libtss2_sys) $(libtss2_mu) \
Philip Tricca5f0ab552018-03-10 18:18:29 -0800169 $(libtss2_tcti_device) $(libtss2_tcti_mssim) $(libutil)
Andreas Fuchs037c8782018-03-21 18:52:38 +0100170src_tss2_esys_libtss2_esys_la_LDFLAGS = $(AM_LDFLAGS) -ldl -lgcrypt
Philip Tricca49635f42018-03-10 19:19:58 -0800171src_tss2_esys_libtss2_esys_la_SOURCES = $(TSS2_ESYS_SRC)
Philip Tricca0f0516e2018-03-05 09:59:12 -0800172
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100173endif #ESAPI
Juergen Reppecd44eb2018-02-23 13:41:16 +0100174
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100175### Man Pages
Philip Triccaaddad782018-03-09 11:42:05 -0800176man3_MANS = man/man3/Tss2_Tcti_Device_Init.3 man/man3/Tss2_Tcti_Mssim_Init.3
Philip Triccab8584ac2018-03-10 17:02:30 -0800177man7_MANS = man/man7/tss2-tcti-device.7 man/man7/tss2-tcti-mssim.7
Philip Tricca7ae01542016-05-05 18:45:03 -0700178
Philip Triccafe671682017-06-04 19:14:31 -0700179man/man3/%.3 : man/%.3.in $(srcdir)/man/man-postlude.troff
Andreas Fuchs3c965e72017-11-24 16:16:20 +0100180 $(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
Philip Triccafe671682017-06-04 19:14:31 -0700181
Philip Tricca632c4312017-06-05 11:58:08 -0700182man/man7/%.7 : man/%.7.in $(srcdir)/man/man-postlude.troff
Andreas Fuchs3c965e72017-11-24 16:16:20 +0100183 $(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
Philip Tricca632c4312017-06-05 11:58:08 -0700184
Javier Martinez Canillas0075f882018-04-13 12:49:37 +0200185EXTRA_DIST += dist/tpm-udev.rules
186
187if WITH_UDEVRULESPREFIX
188install-data-hook:
189 mv $(DESTDIR)$(udevrulesdir)/tpm-udev.rules $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules
190
191uninstall-local:
192 -rm $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules
193endif
194
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100195EXTRA_DIST += \
196 man/man-postlude.troff \
Philip Tricca5a235282018-02-27 14:59:49 -0800197 man/Tss2_Tcti_Device_Init.3.in \
Philip Triccaaddad782018-03-09 11:42:05 -0800198 man/Tss2_Tcti_Mssim_Init.3.in \
Philip Triccab8584ac2018-03-10 17:02:30 -0800199 man/tss2-tcti-device.7.in \
200 man/tss2-tcti-mssim.7.in
Philip Tricca632c4312017-06-05 11:58:08 -0700201
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100202CLEANFILES += \
203 $(man3_MANS) \
204 $(man7_MANS)
205
206### Helper Functions ###
Philip Tricca632c4312017-06-05 11:58:08 -0700207define make_parent_dir
208 if [ ! -d $(dir $1) ]; then mkdir -p $(dir $1); fi
209endef
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100210
Philip Triccafe671682017-06-04 19:14:31 -0700211# function to transform man .in files to man pages
212# $1: target
213# $2: .in file
214# $3: man postlude file
215define make_man
Andreas Fuchs3c965e72017-11-24 16:16:20 +0100216 $(call make_parent_dir,$1) && \
217 cat $2 $3 > $1 && \
Philip Triccafe671682017-06-04 19:14:31 -0700218 sed -i -e "s,[@]VERSION[@],$(PACKAGE_VERSION),g;" $1
219endef