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     'conditions': [
     34       ['USE_tpm2 == 1', {
     35         'defines': [ 'USE_TPM2' ],
     36       }],
     37     ],
     38   },
     39   'targets': [
     40     # A library for just the protobufs.
     41     {
     42       'target_name': 'proto_library',
     43       'type': 'static_library',
     44       'variables': {
     45         'proto_in_dir': 'common',
     46         'proto_out_dir': 'include/tpm_manager/common',
     47       },
     48       'sources': [
     49         '<(proto_in_dir)/local_data.proto',
     50         '<(proto_in_dir)/tpm_nvram_interface.proto',
     51         '<(proto_in_dir)/tpm_ownership_interface.proto',
     52         'common/print_local_data_proto.cc',
     53         'common/print_tpm_nvram_interface_proto.cc',
     54         'common/print_tpm_ownership_interface_proto.cc',
     55       ],
     56       'includes': ['../../../../platform2/common-mk/protoc.gypi'],
     57     },
     58     # A shared library for clients.
     59     {
     60       'target_name': 'libtpm_manager',
     61       'type': 'shared_library',
     62       'sources': [
     63         'client/tpm_nvram_dbus_proxy.cc',
     64         'client/tpm_ownership_dbus_proxy.cc',
     65       ],
     66       'dependencies': [
     67         'proto_library',
     68       ],
     69     },
     70     # A client command line utility.
     71     {
     72       'target_name': 'tpm_manager_client',
     73       'type': 'executable',
     74       'sources': [
     75         'client/main.cc',
     76       ],
     77       'dependencies': [
     78         'libtpm_manager',
     79         'proto_library',
     80       ]
     81     },
     82     # A library for server code.
     83     {
     84       'target_name': 'server_library',
     85       'type': 'static_library',
     86       'sources': [
     87         'server/dbus_service.cc',
     88         'server/local_data_store_impl.cc',
     89         'server/openssl_crypto_util_impl.cc',
     90         'server/tpm_manager_service.cc',
     91       ],
     92       'conditions': [
     93         ['USE_tpm2 == 1', {
     94           'sources': [
     95             'server/tpm2_initializer_impl.cc',
     96             'server/tpm2_nvram_impl.cc',
     97             'server/tpm2_status_impl.cc',
     98           ],
     99           'all_dependent_settings': {
    100             'libraries': [
    101               '-ltrunks',
    102             ],
    103           },
    104         }],
    105         ['USE_tpm2 == 0', {
    106           'sources': [
    107             'server/tpm_connection.cc',
    108             'server/tpm_initializer_impl.cc',
    109             'server/tpm_nvram_impl.cc',
    110             'server/tpm_status_impl.cc',
    111           ],
    112           'all_dependent_settings': {
    113             'libraries': [
    114               '-ltspi',
    115             ],
    116           },
    117         }],
    118       ],
    119       'dependencies': [
    120         'proto_library',
    121       ],
    122     },
    123     # The tpm_manager daemon.
    124     {
    125       'target_name': 'tpm_managerd',
    126       'type': 'executable',
    127       'sources': [
    128         'server/main.cc',
    129       ],
    130       'variables': {
    131         'deps': [
    132           'libminijail',
    133         ],
    134       },
    135       'dependencies': [
    136         'proto_library',
    137         'server_library',
    138       ],
    139     },
    140   ],
    141   'conditions': [
    142     ['USE_test == 1', {
    143       'targets': [
    144         {
    145           'target_name': 'tpm_manager_testrunner',
    146           'type': 'executable',
    147           'includes': ['../../../../platform2/common-mk/common_test.gypi'],
    148           'variables': {
    149             'deps': [
    150               'libbrillo-test-<(libbase_ver)',
    151               'libchrome-test-<(libbase_ver)',
    152             ],
    153           },
    154           'sources': [
    155             'client/tpm_nvram_dbus_proxy_test.cc',
    156             'client/tpm_ownership_dbus_proxy_test.cc',
    157             'common/mock_tpm_nvram_interface.cc',
    158             'common/mock_tpm_ownership_interface.cc',
    159             'server/dbus_service_test.cc',
    160             'server/mock_local_data_store.cc',
    161             'server/mock_openssl_crypto_util.cc',
    162             'server/mock_tpm_initializer.cc',
    163             'server/mock_tpm_nvram.cc',
    164             'server/mock_tpm_status.cc',
    165             'server/tpm_manager_service_test.cc',
    166             'tpm_manager_testrunner.cc',
    167           ],
    168           'conditions': [
    169             ['USE_tpm2 == 1', {
    170               'sources': [
    171                 'server/tpm2_initializer_test.cc',
    172                 'server/tpm2_nvram_test.cc',
    173                 'server/tpm2_status_test.cc',
    174               ],
    175               'libraries': [
    176                 '-ltrunks_test',
    177               ],
    178             }],
    179           ],
    180           'dependencies': [
    181             'libtpm_manager',
    182             'proto_library',
    183             'server_library',
    184           ],
    185         },
    186       ],
    187     }],
    188   ],
    189 }
    190