Will Arthur | ca8e7f3 | 2015-08-03 15:35:19 -0400 | [diff] [blame] | 1 | #;**********************************************************************; |
| 2 | # |
| 3 | # Copyright (c) 2015, Intel Corporation |
| 4 | # All rights reserved. |
| 5 | # |
| 6 | # Redistribution and use in source and binary forms, with or without |
| 7 | # modification, are permitted provided that the following conditions are met: |
| 8 | # |
| 9 | # 1. Redistributions of source code must retain the above copyright notice, |
| 10 | # this list of conditions and the following disclaimer. |
| 11 | # |
| 12 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
| 13 | # this list of conditions and the following disclaimer in the documentation |
| 14 | # and/or other materials provided with the distribution. |
| 15 | # |
| 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 |
| 26 | # THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | #;**********************************************************************; |
| 28 | |
Philip Tricca | e690e08 | 2015-09-07 18:17:35 -0700 | [diff] [blame] | 29 | include src_vars.mk |
| 30 | |
Philip Tricca | a509a68 | 2015-09-14 15:34:52 -0700 | [diff] [blame] | 31 | ACLOCAL_AMFLAGS = -I m4 |
Philip Tricca | daeb5bb | 2016-05-26 19:27:45 -0700 | [diff] [blame] | 32 | AM_CFLAGS = -I$(srcdir)/include |
| 33 | AM_CXXFLAGS = $(AM_CFLAGS) |
Philip Tricca | a509a68 | 2015-09-14 15:34:52 -0700 | [diff] [blame] | 34 | |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 35 | # stuff to build, what that stuff is, and where/if to install said stuff |
| 36 | sbin_PROGRAMS = $(resourcemgr) |
| 37 | noinst_PROGRAMS = $(tpmclient) $(tpmtest) |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 38 | lib_LTLIBRARIES = $(libsapi) $(libtcti_device) $(libtcti_socket) |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 39 | |
Philip Tricca | b194be9 | 2016-03-15 13:27:09 -0700 | [diff] [blame] | 40 | # unit tests |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 41 | if UNIT |
Philip Tricca | 4c1b4a0 | 2016-06-21 05:44:51 -0700 | [diff] [blame] | 42 | check_PROGRAMS = \ |
| 43 | test/tcti_device \ |
Philip Tricca | 6f634c4 | 2016-07-23 12:32:15 -0700 | [diff] [blame] | 44 | test/getcommands-malloc-mock_unit \ |
Philip Tricca | 364c0ce | 2016-07-23 16:48:37 -0700 | [diff] [blame] | 45 | test/CommonPreparePrologue_unit \ |
Philip Tricca | 7d83983 | 2016-08-14 09:54:31 -0700 | [diff] [blame] | 46 | test/GetNumHandles_unit \ |
Philip Tricca | f1811f0 | 2016-08-28 11:02:31 -0700 | [diff] [blame^] | 47 | test/CopyCommandHeader_unit \ |
| 48 | test/marshal-UINT16_unit |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 49 | endif #UNIT |
| 50 | |
Philip Tricca | b194be9 | 2016-03-15 13:27:09 -0700 | [diff] [blame] | 51 | TESTS = $(check_PROGRAMS) |
Philip Tricca | 7ae0154 | 2016-05-05 18:45:03 -0700 | [diff] [blame] | 52 | CLEANFILES = $(nodist_pkgconfig_DATA) |
Philip Tricca | 7d3515f | 2015-09-07 10:06:56 -0700 | [diff] [blame] | 53 | |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 54 | # headers and where to install them |
Philip Tricca | d69337a | 2016-05-26 16:16:01 -0700 | [diff] [blame] | 55 | libsapidir = $(includedir)/sapi |
| 56 | libsapi_HEADERS = $(srcdir)/include/sapi/*.h |
Philip Tricca | c3dedc2 | 2016-01-15 13:47:22 -0800 | [diff] [blame] | 57 | libtctidir = $(includedir)/tcti |
| 58 | libtcti_HEADERS = $(srcdir)/include/tcti/*.h |
Philip Tricca | 7ae0154 | 2016-05-05 18:45:03 -0700 | [diff] [blame] | 59 | # pkg-config files |
| 60 | pkgconfigdir = $(libdir)/pkgconfig |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 61 | nodist_pkgconfig_DATA = lib/sapi.pc lib/tcti-device.pc lib/tcti-socket.pc |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 62 | |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 63 | if UNIT |
Philip Tricca | 1f3a1fd | 2016-08-14 11:48:45 -0700 | [diff] [blame] | 64 | test_tcti_device_CFLAGS = $(CMOCKA_CFLAGS) -I$(srcdir)/include -I$(srcdir)/sysapi/include |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 65 | test_tcti_device_LDADD = $(libsapi) $(libtcti_device) $(CMOCKA_LIBS) |
Philip Tricca | b194be9 | 2016-03-15 13:27:09 -0700 | [diff] [blame] | 66 | test_tcti_device_SOURCES = test/tcti_device.c test/tcti_device_test.c |
| 67 | |
Philip Tricca | 1f3a1fd | 2016-08-14 11:48:45 -0700 | [diff] [blame] | 68 | test_getcommands_malloc_mock_unit_CFLAGS = $(CMOCKA_CFLAGS) -I$(srcdir)/include \ |
Philip Tricca | 4c1b4a0 | 2016-06-21 05:44:51 -0700 | [diff] [blame] | 69 | -I$(srcdir)/sysapi/include/ |
| 70 | test_getcommands_malloc_mock_unit_LDADD = $(CMOCKA_LIBS) |
| 71 | test_getcommands_malloc_mock_unit_LDFLAGS = -Wl,--wrap=malloc \ |
| 72 | -Wl,--wrap=Tss2_Sys_GetCapability |
| 73 | test_getcommands_malloc_mock_unit_SOURCES = \ |
| 74 | test/getcommands-malloc-mock_unit.c resourcemgr/getcommands.c |
| 75 | |
Philip Tricca | 1f3a1fd | 2016-08-14 11:48:45 -0700 | [diff] [blame] | 76 | test_CommonPreparePrologue_unit_CFLAGS = $(CMOCKA_CFLAGS) -I$(srcdir)/include \ |
Philip Tricca | 6f634c4 | 2016-07-23 12:32:15 -0700 | [diff] [blame] | 77 | -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/ |
| 78 | test_CommonPreparePrologue_unit_LDFLAGS = -Wl,--unresolved-symbols=ignore-all |
| 79 | test_CommonPreparePrologue_unit_LDADD = $(CMOCKA_LIBS) |
| 80 | test_CommonPreparePrologue_unit_SOURCES = \ |
Philip Tricca | 90363cd | 2016-07-23 15:22:37 -0700 | [diff] [blame] | 81 | test/CommonPreparePrologue_unit.c sysapi/sysapi_util/CommandUtil.c \ |
| 82 | sysapi/sysapi/ContextManagement.c |
Philip Tricca | 6f634c4 | 2016-07-23 12:32:15 -0700 | [diff] [blame] | 83 | |
Philip Tricca | 364c0ce | 2016-07-23 16:48:37 -0700 | [diff] [blame] | 84 | test_GetNumHandles_unit_CFLAGS = $(CMOCKA_CFLAGS) \ |
| 85 | -I$(srcdir)/include -I$(srcdir)/sysapi/include |
| 86 | test_GetNumHandles_unit_LDADD = $(CMOCKA_LIBS) |
| 87 | test_GetNumHandles_unit_SOURCES = \ |
| 88 | test/GetNumHandles_unit.c sysapi/sysapi_util/GetNumHandles.c |
Philip Tricca | 1f3a1fd | 2016-08-14 11:48:45 -0700 | [diff] [blame] | 89 | |
| 90 | test_CopyCommandHeader_unit_CFLAGS = $(CMOCKA_CFLAGS) -I$(srcdir)/include \ |
Philip Tricca | 81223f4 | 2016-07-28 19:50:08 -0700 | [diff] [blame] | 91 | -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/ |
| 92 | test_CopyCommandHeader_unit_LDFLAGS = -Wl,--unresolved-symbols=ignore-all |
| 93 | test_CopyCommandHeader_unit_LDADD = $(CMOCKA_LIBS) |
| 94 | test_CopyCommandHeader_unit_SOURCES = \ |
| 95 | test/CopyCommandHeader_unit.c sysapi/sysapi_util/CommandUtil.c \ |
| 96 | sysapi/sysapi/ContextManagement.c sysapi/sysapi_util/changeEndian.c |
Philip Tricca | f1811f0 | 2016-08-28 11:02:31 -0700 | [diff] [blame^] | 97 | |
| 98 | test_marshal_UINT16_unit_CFLAGS = $(CMOCKA_CFLAGS) \ |
| 99 | -I$(srcdir)/include -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/ |
| 100 | test_marshal_UINT16_unit_LDADD = $(CMOCKA_LIBS) |
| 101 | test_marshal_UINT16_unit_SOURCES = \ |
| 102 | sysapi/sysapi_util/changeEndian.c \ |
| 103 | sysapi/sysapi_util/checkoverflow.c \ |
| 104 | sysapi/sysapi_util/marshal_uint16.c \ |
| 105 | test/marshal-UINT16_unit.c |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 106 | endif # UNIT |
Philip Tricca | 364c0ce | 2016-07-23 16:48:37 -0700 | [diff] [blame] | 107 | |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 108 | # how to build stuff |
Philip Tricca | fe6b8ae | 2016-04-22 14:17:10 -0700 | [diff] [blame] | 109 | resourcemgr_resourcemgr_CFLAGS = $(RESOURCEMGR_INC) $(PTHREAD_CFLAGS) $(AM_CFLAGS) |
| 110 | resourcemgr_resourcemgr_CXXFLAGS = $(RESOURCEMGR_INC) $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 111 | resourcemgr_resourcemgr_LDADD = $(libsapi) $(libtcti_device) $(libtcti_socket) |
Philip Tricca | 0069247 | 2015-09-16 13:09:54 -0700 | [diff] [blame] | 112 | resourcemgr_resourcemgr_LDFLAGS = $(PTHREAD_LDFLAGS) |
Philip Tricca | 66f143a | 2016-04-17 00:09:06 -0700 | [diff] [blame] | 113 | resourcemgr_resourcemgr_SOURCES = $(RESOURCEMGR_C) $(COMMON_SRC) |
Philip Tricca | 10d1aa2 | 2015-09-07 10:55:58 -0700 | [diff] [blame] | 114 | |
Philip Tricca | d69337a | 2016-05-26 16:16:01 -0700 | [diff] [blame] | 115 | sysapi_libsapi_la_CFLAGS = -I$(srcdir)/sysapi/include $(AM_CFLAGS) |
| 116 | sysapi_libsapi_la_LDFLAGS = $(LIBRARY_LDFLAGS) |
| 117 | sysapi_libsapi_la_SOURCES = $(SYSAPI_C) $(SYSAPIUTIL_C) |
Philip Tricca | 7d3515f | 2015-09-07 10:06:56 -0700 | [diff] [blame] | 118 | |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 119 | tcti_libtcti_device_la_CFLAGS = $(TCTIDEVICE_INC) $(AM_CFLAGS) |
| 120 | tcti_libtcti_device_la_LDFLAGS = $(LIBRARY_LDFLAGS) \ |
Philip Tricca | 92fb8a7 | 2016-03-31 15:33:57 -0700 | [diff] [blame] | 121 | -Wl,--version-script=$(srcdir)/tcti/tcti_device.map |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 122 | tcti_libtcti_device_la_SOURCES = $(TCTIDEVICE_C) \ |
Philip Tricca | 3d48635 | 2016-04-18 11:26:25 -0700 | [diff] [blame] | 123 | sysapi/sysapi_util/changeEndian.c $(TCTICOMMON_C) common/debug.c |
Philip Tricca | 97e869f | 2015-11-03 20:19:44 -0500 | [diff] [blame] | 124 | |
Philip Tricca | b0927df | 2016-06-21 06:28:44 -0700 | [diff] [blame] | 125 | tcti_libtcti_socket_la_CFLAGS = $(TCTISOCKET_INC) $(AM_CFLAGS) |
| 126 | tcti_libtcti_socket_la_CXXFLAGS = $(TCTISOCKET_INC) $(AM_CXXFLAGS) |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 127 | tcti_libtcti_socket_la_LDFLAGS = $(LIBRARY_LDFLAGS) \ |
Philip Tricca | 92fb8a7 | 2016-03-31 15:33:57 -0700 | [diff] [blame] | 128 | -Wl,--version-script=$(srcdir)/tcti/tcti_socket.map |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 129 | tcti_libtcti_socket_la_SOURCES = $(TCTISOCKET_C) \ |
Philip Tricca | 98b285a | 2016-03-11 20:50:04 -0800 | [diff] [blame] | 130 | sysapi/sysapi_util/changeEndian.c $(TCTISOCKET_CXX) $(TCTICOMMON_C) \ |
Philip Tricca | 4f2bdd7 | 2016-04-22 15:03:27 -0400 | [diff] [blame] | 131 | common/sockets.cpp common/debug.c |
Philip Tricca | a51ca97 | 2015-11-04 00:13:42 -0500 | [diff] [blame] | 132 | |
Philip Tricca | b0927df | 2016-06-21 06:28:44 -0700 | [diff] [blame] | 133 | test_tpmclient_tpmclient_CFLAGS = $(TPMCLIENT_INC) $(AM_CFLAGS) |
| 134 | test_tpmclient_tpmclient_CXXFLAGS = $(TPMCLIENT_INC) $(TCTICOMMON_INC) $(TCTIDEVICE_INC) $(AM_CXXFLAGS) |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 135 | test_tpmclient_tpmclient_LDADD = $(libsapi) $(libtcti_socket) $(libtcti_device) |
Philip Tricca | a51ca97 | 2015-11-04 00:13:42 -0500 | [diff] [blame] | 136 | test_tpmclient_tpmclient_SOURCES = $(TPMCLIENT_CXX) $(COMMON_C) $(SAMPLE_C) |
Philip Tricca | 38de202 | 2015-09-07 11:46:28 -0700 | [diff] [blame] | 137 | |
Philip Tricca | b0927df | 2016-06-21 06:28:44 -0700 | [diff] [blame] | 138 | test_tpmtest_tpmtest_CFLAGS = $(TPMTEST_INC) $(AM_CFLAGS) |
| 139 | test_tpmtest_tpmtest_CXXFLAGS = $(TPMTEST_INC) $(AM_CXXFLAGS) |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 140 | test_tpmtest_tpmtest_LDADD = $(libsapi) $(libtcti_socket) $(libtcti_device) |
Philip Tricca | a51ca97 | 2015-11-04 00:13:42 -0500 | [diff] [blame] | 141 | test_tpmtest_tpmtest_SOURCES = $(TPMTEST_CXX) $(COMMON_C) $(SAMPLE_C) |
Gang Wei | e960069 | 2015-09-10 14:07:14 +0800 | [diff] [blame] | 142 | |
Philip Tricca | 7ae0154 | 2016-05-05 18:45:03 -0700 | [diff] [blame] | 143 | %.pc : %.pc.in |
Philip Tricca | fdce98d | 2016-05-23 15:47:16 -0700 | [diff] [blame] | 144 | if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi |
Philip Tricca | 7ae0154 | 2016-05-05 18:45:03 -0700 | [diff] [blame] | 145 | sed -e "s,[@]VERSION[@],$(PACKAGE_VERSION),g; \ |
| 146 | s,[@]includedir[@],$(includedir),g;" $^ > $@ |
| 147 | |
Philip Tricca | b1a6406 | 2016-04-05 15:26:47 -0700 | [diff] [blame] | 148 | LIBRARY_LDFLAGS = -fPIC -Wl,--no-undefined |
Philip Tricca | 125bb32 | 2016-03-31 16:11:51 -0700 | [diff] [blame] | 149 | |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 150 | # simple variables |
Philip Tricca | c3dedc2 | 2016-01-15 13:47:22 -0800 | [diff] [blame] | 151 | RESOURCEMGR_INC = -I$(srcdir)/include -I$(srcdir)/common \ |
Philip Tricca | 785e88d | 2016-02-13 12:02:44 -0800 | [diff] [blame] | 152 | -I$(srcdir)/sysapi/include -I$(srcdir)/resourcemgr \ |
| 153 | -I$(srcdir)/test/tpmclient |
Philip Tricca | 4c1b4a0 | 2016-06-21 05:44:51 -0700 | [diff] [blame] | 154 | RESOURCEMGR_C = resourcemgr/resourcemgr.c resourcemgr/criticalsection_linux.c \ |
| 155 | resourcemgr/getcommands.c |
Philip Tricca | 10d1aa2 | 2015-09-07 10:55:58 -0700 | [diff] [blame] | 156 | |
Philip Tricca | 785e88d | 2016-02-13 12:02:44 -0800 | [diff] [blame] | 157 | TCTICOMMON_INC = -I$(srcdir)/include -I$(srcdir)/common \ |
| 158 | -I$(srcdir)/sysapi/include |
| 159 | TCTICOMMON_C = tcti/commonchecks.c |
Will-nuc | 8d4f967 | 2015-11-25 16:48:20 -0500 | [diff] [blame] | 160 | |
Philip Tricca | 785e88d | 2016-02-13 12:02:44 -0800 | [diff] [blame] | 161 | TCTIDEVICE_INC = $(TCTICOMMON_INC) |
| 162 | TCTIDEVICE_C = tcti/tcti_device.c |
Will-nuc | f2ea1f1 | 2015-11-25 16:29:57 -0500 | [diff] [blame] | 163 | |
Philip Tricca | 785e88d | 2016-02-13 12:02:44 -0800 | [diff] [blame] | 164 | TCTISOCKET_INC = $(TCTICOMMON_INC) |
| 165 | TCTISOCKET_C = tcti/platformcommand.c |
| 166 | TCTISOCKET_CXX = tcti/tcti_socket.cpp |
Philip Tricca | 97e869f | 2015-11-03 20:19:44 -0500 | [diff] [blame] | 167 | |
Philip Tricca | c3dedc2 | 2016-01-15 13:47:22 -0800 | [diff] [blame] | 168 | TPMCLIENT_INC = -I$(srcdir)/include -I$(srcdir)/sysapi/include \ |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 169 | -I$(srcdir)/test/tpmclient -I$(srcdir)/common \ |
Philip Tricca | e2c1679 | 2016-01-05 12:07:22 -0800 | [diff] [blame] | 170 | -I$(srcdir)/test/common/sample -I$(srcdir)/resourcemgr |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 171 | TPMCLIENT_CXX = test/tpmclient/tpmclient.cpp |
Philip Tricca | e690e08 | 2015-09-07 18:17:35 -0700 | [diff] [blame] | 172 | |
Philip Tricca | c3dedc2 | 2016-01-15 13:47:22 -0800 | [diff] [blame] | 173 | TPMTEST_INC = -I$(srcdir)/include -I$(srcdir)/sysapi/include \ |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 174 | -I$(srcdir)/test/tpmclient -I$(srcdir)/common \ |
Gang Wei | e960069 | 2015-09-10 14:07:14 +0800 | [diff] [blame] | 175 | -I$(srcdir)/test/common/sample -I$(srcdir)/resourcemgr |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 176 | TPMTEST_CXX = test/tpmtest/tpmtest.cpp |
| 177 | |
Philip Tricca | d69337a | 2016-05-26 16:16:01 -0700 | [diff] [blame] | 178 | libsapi = sysapi/libsapi.la |
Philip Tricca | 826f590 | 2016-05-26 16:44:31 -0700 | [diff] [blame] | 179 | libtcti_device = tcti/libtcti-device.la |
| 180 | libtcti_socket = tcti/libtcti-socket.la |
Philip Tricca | 2bd4adb | 2015-09-25 00:14:16 -0700 | [diff] [blame] | 181 | resourcemgr = resourcemgr/resourcemgr |
| 182 | tpmclient = test/tpmclient/tpmclient |
| 183 | tpmtest = test/tpmtest/tpmtest |