Home | History | Annotate | Download | only in tpm_manager
      1 #
      2 # Copyright (C) 2015 The Android Open Source Project
      3 #
      4 # Licensed under the Apache License, Version 2.0 (the "License");
      5 # you may not use this file except in compliance with the License.
      6 # You may obtain a copy of the License at
      7 #
      8 #      http://www.apache.org/licenses/LICENSE-2.0
      9 #
     10 # Unless required by applicable law or agreed to in writing, software
     11 # distributed under the License is distributed on an "AS IS" BASIS,
     12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     15 #
     16 
     17 {
     18   'target_defaults': {
     19     'includes': ['../../../../platform2/common-mk/common.gypi'],
     20     'variables': {
     21       'deps': [  # This is a list of pkg-config dependencies
     22         'libbrillo-<(libbase_ver)',
     23         'libchrome-<(libbase_ver)',
     24         'openssl',
     25         'protobuf-lite',
     26       ],
     27     },
     28     'include_dirs': [
     29       # We need this include dir because we include all the local code as
     30       # "tpm_manager/...".
     31       '<(platform2_root)/../aosp/system/tpm/',
     32     ],
     33     'defines': [ 'USE_TPM2=<(USE_tpm2)' ],
     34   },
     35   'targets': [
     36     # A library for just the protobufs.
     37     {
     38       'target_name': 'proto_library',
     39       'type': 'static_library',
     40       'variables': {
     41         'proto_in_dir': 'common',
     42         'proto_out_dir': 'include/tpm_manager/common',
     43       },
     44       'sources': [
     45         '<(proto_in_dir)/local_data.proto',
     46         '<(proto_in_dir)/tpm_manager_status.proto',
     47         '<(proto_in_dir)/tpm_nvram_interface.proto',
     48         '<(proto_in_dir)/tpm_ownership_interface.proto',
     49         'common/print_local_data_proto.cc',
     50         'common/print_tpm_manager_status_proto.cc',
     51         'common/print_tpm_nvram_interface_proto.cc',
     52         'common/print_tpm_ownership_interface_proto.cc',
     53       ],
     54       'includes': ['../../../../platform2/common-mk/protoc.gypi'],
     55     },
     56     # A shared library for clients.
     57     {
     58       'target_name': 'libtpm_manager',
     59       'type': 'shared_library',
     60       'sources': [
     61         'client/tpm_nvram_dbus_proxy.cc',
     62         'client/tpm_ownership_dbus_proxy.cc',
     63       ],
     64       'dependencies': [
     65         'proto_library',
     66       ],
     67     },
     68     # A client command line utility.
     69     {
     70       'target_name': 'tpm_manager_client',
     71       'type': 'executable',
     72       'sources': [
     73         'client/main.cc',
     74       ],
     75       'dependencies': [
     76         'libtpm_manager',
     77         'proto_library',
     78       ]
     79     },
     80     # A library for server code.
     81     {
     82       'target_name': 'server_library',
     83       'type': 'static_library',
     84       'sources': [
     85         'server/dbus_service.cc',
     86         'server/local_data_store_impl.cc',
     87         'server/openssl_crypto_util_impl.cc',
     88         'server/tpm_manager_service.cc',
     89       ],
     90       'conditions': [
     91         ['USE_tpm2 == 1', {
     92           'sources': [
     93             'server/tpm2_initializer_impl.cc',
     94             'server/tpm2_nvram_impl.cc',
     95             'server/tpm2_status_impl.cc',
     96           ],
     97           'all_dependent_settings': {
     98             'libraries': [
     99               '-ltrunks',
    100             ],
    101           },
    102         }],
    103         ['USE_tpm2 == 0', {
    104           'sources': [
    105             'server/tpm_connection.cc',
    106             'server/tpm_initializer_impl.cc',
    107             'server/tpm_nvram_impl.cc',
    108             'server/tpm_status_impl.cc',
    109           ],
    110           'all_dependent_settings': {
    111             'libraries': [
    112               '-ltspi',
    113             ],
    114           },
    115         }],
    116       ],
    117       'dependencies': [
    118         'proto_library',
    119       ],
    120     },
    121     # The tpm_manager daemon.
    122     {
    123       'target_name': 'tpm_managerd',
    124       'type': 'executable',
    125       'sources': [
    126         'server/main.cc',
    127       ],
    128       'variables': {
    129         'deps': [
    130           'libminijail',
    131         ],
    132       },
    133       'dependencies': [
    134         'proto_library',
    135         'server_library',
    136       ],
    137     },
    138   ],
    139   'conditions': [
    140     ['USE_test == 1', {
    141       'targets': [
    142         {
    143           'target_name': 'tpm_manager_testrunner',
    144           'type': 'executable',
    145           'includes': ['../../../../platform2/common-mk/common_test.gypi'],
    146           'variables': {
    147             'deps': [
    148               'libbrillo-test-<(libbase_ver)',
    149               'libchrome-test-<(libbase_ver)',
    150             ],
    151           },
    152           'sources': [
    153             'client/tpm_nvram_dbus_proxy_test.cc',
    154             'client/tpm_ownership_dbus_proxy_test.cc',
    155             'common/mock_tpm_nvram_interface.cc',
    156             'common/mock_tpm_ownership_interface.cc',
    157             'server/dbus_service_test.cc',
    158             'server/mock_local_data_store.cc',
    159             'server/mock_openssl_crypto_util.cc',
    160             'server/mock_tpm_initializer.cc',
    161             'server/mock_tpm_nvram.cc',
    162             'server/mock_tpm_status.cc',
    163             'server/tpm_manager_service_test.cc',
    164             'tpm_manager_testrunner.cc',
    165           ],
    166           'conditions': [
    167             ['USE_tpm2 == 1', {
    168               'sources': [
    169                 'server/tpm2_initializer_test.cc',
    170                 'server/tpm2_nvram_test.cc',
    171                 'server/tpm2_status_test.cc',
    172               ],
    173               'libraries': [
    174                 '-ltrunks_test',
    175               ],
    176             }],
    177           ],
    178           'dependencies': [
    179             'libtpm_manager',
    180             'proto_library',
    181             'server_library',
    182           ],
    183         },
    184       ],
    185     }],
    186   ],
    187 }
    188