blob: 7c2fb897c208208adfcfb37b73c84b8fedcd3392 [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
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010058### Distributiuon files ###
59# 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
Andreas Fuchs0dc7c292018-02-28 20:01:13 +010099### TCG TSS Marshaling/Unmarshalling 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 Tricca88ced722018-03-14 15:24:20 -0700125src_tss2_tcti_libtss2_tcti_device_la_SOURCES = src/tss2-tcti/tcti-device.c \
126 src/tss2-tcti/tcti.c src/tss2-tcti/tcti.h
Philip Tricca97e869f2015-11-03 20:19:44 -0500127
Philip Triccaaddad782018-03-09 11:42:05 -0800128# tcti library for microsoft simulator
Philip Triccab8584ac2018-03-10 17:02:30 -0800129libtss2_tcti_mssim = src/tss2-tcti/libtss2-tcti-mssim.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800130tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_mssim.h
Philip Triccab8584ac2018-03-10 17:02:30 -0800131lib_LTLIBRARIES += $(libtss2_tcti_mssim)
132nodist_pkgconfig_DATA += lib/tss2-tcti-mssim.pc
133EXTRA_DIST += lib/tss2-tcti-mssim.map lib/tss2-tcti-mssim.pc.in
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100134
Philip Triccab8584ac2018-03-10 17:02:30 -0800135src_tss2_tcti_libtss2_tcti_mssim_la_CFLAGS = $(AM_CFLAGS) $(URIPARSER_CFLAGS)
David R. Bild1e49b4c2017-11-28 18:09:42 -0600136if HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800137src_tss2_tcti_libtss2_tcti_mssim_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-mssim.map
David R. Bild1e49b4c2017-11-28 18:09:42 -0600138endif # HAVE_LD_VERSION_SCRIPT
Philip Triccab8584ac2018-03-10 17:02:30 -0800139src_tss2_tcti_libtss2_tcti_mssim_la_LIBADD = $(libtss2_mu) $(URIPARSER_LIBS) $(libutil)
140src_tss2_tcti_libtss2_tcti_mssim_la_SOURCES = src/tss2-tcti/tcti-mssim.c \
Philip Tricca88ced722018-03-14 15:24:20 -0700141 src/tss2-tcti/tcti.c src/tss2-tcti/tcti.h
Philip Triccaa51ca972015-11-04 00:13:42 -0500142
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100143### TCG TSS SAPI spec library ###
Philip Tricca5f0ab552018-03-10 18:18:29 -0800144libtss2_sys = src/tss2-sys/libtss2-sys.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800145tss2_HEADERS += $(srcdir)/include/tss2/tss2_sys.h
Philip Tricca5f0ab552018-03-10 18:18:29 -0800146lib_LTLIBRARIES += $(libtss2_sys)
147nodist_pkgconfig_DATA += lib/tss2-sys.pc
148EXTRA_DIST += lib/tss2-sys.pc.in
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800149
Philip Triccad5a6ff42018-03-13 18:19:42 -0700150src_tss2_sys_libtss2_sys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-sys
Andreas Fuchs28164ad2018-03-16 13:33:26 +0100151src_tss2_sys_libtss2_sys_la_LIBADD = $(libtss2_mu) $(libutil)
Philip Tricca5f0ab552018-03-10 18:18:29 -0800152src_tss2_sys_libtss2_sys_la_SOURCES = $(TSS2_SYS_SRC)
hp43ac71d2016-12-02 11:16:45 -0800153
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100154### TCG TSS ESAPI spec library ###
Juergen Reppff821bd2017-12-11 15:21:42 +0100155if ESAPI
Philip Tricca49635f42018-03-10 19:19:58 -0800156libtss2_esys = src/tss2-esys/libtss2-esys.la
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800157tss2_HEADERS += $(srcdir)/include/tss2/tss2_esys.h
Philip Tricca49635f42018-03-10 19:19:58 -0800158lib_LTLIBRARIES += $(libtss2_esys)
159nodist_pkgconfig_DATA += lib/tss2-esys.pc
160EXTRA_DIST += lib/tss2-esys.pc.in
Philip Tricca8ffd3c42018-03-09 16:27:24 -0800161
Andreas Fuchs037c8782018-03-21 18:52:38 +0100162src_tss2_esys_libtss2_esys_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/tss2-esys
Philip Tricca49635f42018-03-10 19:19:58 -0800163src_tss2_esys_libtss2_esys_la_LIBADD = $(libtss2_sys) $(libtss2_mu) \
Philip Tricca5f0ab552018-03-10 18:18:29 -0800164 $(libtss2_tcti_device) $(libtss2_tcti_mssim) $(libutil)
Andreas Fuchs037c8782018-03-21 18:52:38 +0100165src_tss2_esys_libtss2_esys_la_LDFLAGS = $(AM_LDFLAGS) -ldl -lgcrypt
Philip Tricca49635f42018-03-10 19:19:58 -0800166src_tss2_esys_libtss2_esys_la_SOURCES = $(TSS2_ESYS_SRC)
Philip Tricca0f0516e2018-03-05 09:59:12 -0800167
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100168endif #ESAPI
Juergen Reppecd44eb2018-02-23 13:41:16 +0100169
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100170### Man Pages
Philip Triccaaddad782018-03-09 11:42:05 -0800171man3_MANS = man/man3/Tss2_Tcti_Device_Init.3 man/man3/Tss2_Tcti_Mssim_Init.3
Philip Triccab8584ac2018-03-10 17:02:30 -0800172man7_MANS = man/man7/tss2-tcti-device.7 man/man7/tss2-tcti-mssim.7
Philip Tricca7ae01542016-05-05 18:45:03 -0700173
Philip Triccafe671682017-06-04 19:14:31 -0700174man/man3/%.3 : man/%.3.in $(srcdir)/man/man-postlude.troff
Andreas Fuchs3c965e72017-11-24 16:16:20 +0100175 $(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
Philip Triccafe671682017-06-04 19:14:31 -0700176
Philip Tricca632c4312017-06-05 11:58:08 -0700177man/man7/%.7 : man/%.7.in $(srcdir)/man/man-postlude.troff
Andreas Fuchs3c965e72017-11-24 16:16:20 +0100178 $(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
Philip Tricca632c4312017-06-05 11:58:08 -0700179
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100180EXTRA_DIST += \
181 man/man-postlude.troff \
Philip Tricca5a235282018-02-27 14:59:49 -0800182 man/Tss2_Tcti_Device_Init.3.in \
Philip Triccaaddad782018-03-09 11:42:05 -0800183 man/Tss2_Tcti_Mssim_Init.3.in \
Philip Triccab8584ac2018-03-10 17:02:30 -0800184 man/tss2-tcti-device.7.in \
185 man/tss2-tcti-mssim.7.in
Philip Tricca632c4312017-06-05 11:58:08 -0700186
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100187CLEANFILES += \
188 $(man3_MANS) \
189 $(man7_MANS)
190
191### Helper Functions ###
Philip Tricca632c4312017-06-05 11:58:08 -0700192define make_parent_dir
193 if [ ! -d $(dir $1) ]; then mkdir -p $(dir $1); fi
194endef
Andreas Fuchs0dc7c292018-02-28 20:01:13 +0100195
Philip Triccafe671682017-06-04 19:14:31 -0700196# function to transform man .in files to man pages
197# $1: target
198# $2: .in file
199# $3: man postlude file
200define make_man
Andreas Fuchs3c965e72017-11-24 16:16:20 +0100201 $(call make_parent_dir,$1) && \
202 cat $2 $3 > $1 && \
Philip Triccafe671682017-06-04 19:14:31 -0700203 sed -i -e "s,[@]VERSION[@],$(PACKAGE_VERSION),g;" $1
204endef