blob: edc4793d37ce586c4be732946fd00ccd864f5b8c [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 ###
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010059# Adding user and developer information
60EXTRA_DIST += \
Philip Triccac0841fc2017-12-08 12:10:20 -080061 CHANGELOG.md \
62 CONTRIBUTING.md \
63 INSTALL.md \
64 LICENSE \
65 README.md \
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010066 RELEASE.md
Philip Tricca2bd4adb2015-09-25 00:14:16 -070067
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010068# Generate the AUTHORS file from git log
69AUTHORS :
70 $(AM_V_GEN)git log --format='%aN <%aE>' | grep -v 'users.noreply.github.com' | sort | \
71 uniq -c | sort -nr | sed 's/^\s*//' | cut -d" " -f2- > $@
72EXTRA_DIST += AUTHORS
73CLEANFILES += AUTHORS
Philip Triccab194be92016-03-15 13:27:09 -070074
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010075# pkg-config setup. pc-file declarations happen in the corresponding modules
76pkgconfigdir = $(libdir)/pkgconfig
77nodist_pkgconfig_DATA =
78CLEANFILES += $(nodist_pkgconfig_DATA)
Philip Triccae0a93d12017-06-29 08:42:34 -070079
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010080%.pc : %.pc.in
81 $(AM_V_GEN)$(call make_parent_dir,$@) && \
82 sed -e "s,[@]VERSION[@],$(PACKAGE_VERSION),g; \
83 s,[@]libdir[@],$(libdir),g; \
84 s,[@]includedir[@],$(includedir),g;" $^ > $@
Philip Tricca6f634c42016-07-23 12:32:15 -070085
Philip Tricca8ffd3c42018-03-09 16:27:24 -080086# Base TSS2 headers
87tss2dir = $(includedir)/tss2
88tss2_HEADERS = \
89 $(srcdir)/include/tss2/tss2_common.h \
90 $(srcdir)/include/tss2/tss2_tcti.h \
Philip Tricca910f17c2018-03-15 12:38:37 -070091 $(srcdir)/include/tss2/tss2_tpm2_types.h
Philip Tricca8ffd3c42018-03-09 16:27:24 -080092
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010093### Internal utility library
94libutil = libutil.la
95noinst_LTLIBRARIES += $(libutil)
Philip Triccaa003ae62018-02-19 10:32:46 -080096libutil_la_CFLAGS = $(AM_CFLAGS)
Philip Tricca57360da2018-03-15 17:22:10 -070097libutil_la_SOURCES = $(UTIL_SRC)
Philip Triccaa003ae62018-02-19 10:32:46 -080098
dantpmd0899fe2018-04-06 14:26:05 -070099### TCG TSS Marshaling/Unmarshaling spec library ###
Philip Triccaee730622018-03-10 16:40:41 -0800100libtss2_mu = src/tss2-mu/libtss2-mu.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800101tss2_HEADERS += $(srcdir)/include/tss2/tss2_mu.h
Philip Triccaee730622018-03-10 16:40:41 -0800102lib_LTLIBRARIES += $(libtss2_mu)
103nodist_pkgconfig_DATA += lib/tss2-mu.pc
104EXTRA_DIST += lib/tss2-mu.map lib/tss2-mu.pc.in
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100105
David R. Bild1e49b4c2017-11-28 18:09:42 -0600106if HAVE_LD_VERSION_SCRIPT
Philip Triccaee730622018-03-10 16:40:41 -0800107src_tss2_mu_libtss2_mu_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-mu.map
David R. Bild1e49b4c2017-11-28 18:09:42 -0600108endif # HAVE_LD_VERSION_SCRIPT
Philip Triccaee730622018-03-10 16:40:41 -0800109src_tss2_mu_libtss2_mu_la_LIBADD = $(libutil)
110src_tss2_mu_libtss2_mu_la_SOURCES = $(TSS2_MU_SRC)
Philip Tricca73609722017-02-10 10:50:06 -0800111
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100112### TCG TSS TCTI spec libraries ###
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100113# tcti device library
Philip Triccab8584ac2018-03-10 17:02:30 -0800114libtss2_tcti_device = src/tss2-tcti/libtss2-tcti-device.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800115tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_device.h
Philip Triccab8584ac2018-03-10 17:02:30 -0800116lib_LTLIBRARIES += $(libtss2_tcti_device)
117nodist_pkgconfig_DATA += lib/tss2-tcti-device.pc
118EXTRA_DIST += lib/tss2-tcti-device.map lib/tss2-tcti-device.pc.in
Juergen Reppff821bd2017-12-11 15:21:42 +0100119
Philip Triccab8584ac2018-03-10 17:02:30 -0800120src_tss2_tcti_libtss2_tcti_device_la_CFLAGS = $(AM_CFLAGS)
David R. Bild1e49b4c2017-11-28 18:09:42 -0600121if HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800122src_tss2_tcti_libtss2_tcti_device_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-device.map
David R. Bild1e49b4c2017-11-28 18:09:42 -0600123endif # HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800124src_tss2_tcti_libtss2_tcti_device_la_LIBADD = $(libtss2_mu) $(libutil)
Philip Tricca850bb592018-04-03 09:29:22 -0700125src_tss2_tcti_libtss2_tcti_device_la_SOURCES = \
126 src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
127 src/tss2-tcti/tcti-device.c src/tss2-tcti/tcti-device.h
Philip Tricca97e869f2015-11-03 20:19:44 -0500128
dantpmd0899fe2018-04-06 14:26:05 -0700129# tcti library for Microsoft TPM2 simulator
Philip Triccab8584ac2018-03-10 17:02:30 -0800130libtss2_tcti_mssim = src/tss2-tcti/libtss2-tcti-mssim.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800131tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_mssim.h
Philip Triccab8584ac2018-03-10 17:02:30 -0800132lib_LTLIBRARIES += $(libtss2_tcti_mssim)
133nodist_pkgconfig_DATA += lib/tss2-tcti-mssim.pc
134EXTRA_DIST += lib/tss2-tcti-mssim.map lib/tss2-tcti-mssim.pc.in
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100135
Philip Triccab8584ac2018-03-10 17:02:30 -0800136src_tss2_tcti_libtss2_tcti_mssim_la_CFLAGS = $(AM_CFLAGS) $(URIPARSER_CFLAGS)
David R. Bild1e49b4c2017-11-28 18:09:42 -0600137if HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800138src_tss2_tcti_libtss2_tcti_mssim_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-mssim.map
David R. Bild1e49b4c2017-11-28 18:09:42 -0600139endif # HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800140src_tss2_tcti_libtss2_tcti_mssim_la_LIBADD = $(libtss2_mu) $(URIPARSER_LIBS) $(libutil)
Philip Tricca850bb592018-04-03 09:29:22 -0700141src_tss2_tcti_libtss2_tcti_mssim_la_SOURCES = \
142 src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
143 src/tss2-tcti/tcti-mssim.c src/tss2-tcti/tcti-mssim.h
Philip Triccaa51ca972015-11-04 00:13:42 -0500144
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100145### TCG TSS SAPI spec library ###
Philip Tricca5f0ab552018-03-10 18:18:29 -0800146libtss2_sys = src/tss2-sys/libtss2-sys.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800147tss2_HEADERS += $(srcdir)/include/tss2/tss2_sys.h
Philip Tricca5f0ab552018-03-10 18:18:29 -0800148lib_LTLIBRARIES += $(libtss2_sys)
149nodist_pkgconfig_DATA += lib/tss2-sys.pc
150EXTRA_DIST += lib/tss2-sys.pc.in
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800151
Philip Triccad5a6ff42018-03-13 18:19:42 -0700152src_tss2_sys_libtss2_sys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-sys
Andreas Fuchs28164ad2018-03-16 13:33:26 +0100153src_tss2_sys_libtss2_sys_la_LIBADD = $(libtss2_mu) $(libutil)
Philip Tricca5f0ab552018-03-10 18:18:29 -0800154src_tss2_sys_libtss2_sys_la_SOURCES = $(TSS2_SYS_SRC)
hp43ac71d2016-12-02 11:16:45 -0800155
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100156### TCG TSS ESAPI spec library ###
Juergen Reppff821bd2017-12-11 15:21:42 +0100157if ESAPI
Philip Tricca49635f42018-03-10 19:19:58 -0800158libtss2_esys = src/tss2-esys/libtss2-esys.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800159tss2_HEADERS += $(srcdir)/include/tss2/tss2_esys.h
Philip Tricca49635f42018-03-10 19:19:58 -0800160lib_LTLIBRARIES += $(libtss2_esys)
161nodist_pkgconfig_DATA += lib/tss2-esys.pc
162EXTRA_DIST += lib/tss2-esys.pc.in
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800163
Andreas Fuchs037c8782018-03-21 18:52:38 +0100164src_tss2_esys_libtss2_esys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-esys
Philip Tricca49635f42018-03-10 19:19:58 -0800165src_tss2_esys_libtss2_esys_la_LIBADD = $(libtss2_sys) $(libtss2_mu) \
Philip Tricca5f0ab552018-03-10 18:18:29 -0800166 $(libtss2_tcti_device) $(libtss2_tcti_mssim) $(libutil)
Andreas Fuchs037c8782018-03-21 18:52:38 +0100167src_tss2_esys_libtss2_esys_la_LDFLAGS = $(AM_LDFLAGS) -ldl -lgcrypt
Philip Tricca49635f42018-03-10 19:19:58 -0800168src_tss2_esys_libtss2_esys_la_SOURCES = $(TSS2_ESYS_SRC)
Philip Tricca0f0516e2018-03-05 09:59:12 -0800169
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100170endif #ESAPI
Juergen Reppecd44eb2018-02-23 13:41:16 +0100171
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100172### Man Pages
Philip Triccaaddad782018-03-09 11:42:05 -0800173man3_MANS = man/man3/Tss2_Tcti_Device_Init.3 man/man3/Tss2_Tcti_Mssim_Init.3
Philip Triccab8584ac2018-03-10 17:02:30 -0800174man7_MANS = man/man7/tss2-tcti-device.7 man/man7/tss2-tcti-mssim.7
Philip Tricca7ae01542016-05-05 18:45:03 -0700175
Philip Triccafe671682017-06-04 19:14:31 -0700176man/man3/%.3 : man/%.3.in $(srcdir)/man/man-postlude.troff
Andreas Fuchs3c965e72017-11-24 16:16:20 +0100177 $(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
Philip Triccafe671682017-06-04 19:14:31 -0700178
Philip Tricca632c4312017-06-05 11:58:08 -0700179man/man7/%.7 : man/%.7.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 Tricca632c4312017-06-05 11:58:08 -0700181
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100182EXTRA_DIST += \
183 man/man-postlude.troff \
Philip Tricca5a235282018-02-27 14:59:49 -0800184 man/Tss2_Tcti_Device_Init.3.in \
Philip Triccaaddad782018-03-09 11:42:05 -0800185 man/Tss2_Tcti_Mssim_Init.3.in \
Philip Triccab8584ac2018-03-10 17:02:30 -0800186 man/tss2-tcti-device.7.in \
187 man/tss2-tcti-mssim.7.in
Philip Tricca632c4312017-06-05 11:58:08 -0700188
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100189CLEANFILES += \
190 $(man3_MANS) \
191 $(man7_MANS)
192
193### Helper Functions ###
Philip Tricca632c4312017-06-05 11:58:08 -0700194define make_parent_dir
195 if [ ! -d $(dir $1) ]; then mkdir -p $(dir $1); fi
196endef
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100197
Philip Triccafe671682017-06-04 19:14:31 -0700198# function to transform man .in files to man pages
199# $1: target
200# $2: .in file
201# $3: man postlude file
202define make_man
Andreas Fuchs3c965e72017-11-24 16:16:20 +0100203 $(call make_parent_dir,$1) && \
204 cat $2 $3 > $1 && \
Philip Triccafe671682017-06-04 19:14:31 -0700205 sed -i -e "s,[@]VERSION[@],$(PACKAGE_VERSION),g;" $1
206endef