Home | History | Annotate | Download | only in attestation
      1 #
      2 # Copyright (C) 2014 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     'variables': {
     20       'deps': [  # This is a list of pkg-config dependencies
     21         'libbrillo-<(libbase_ver)',
     22         'libchrome-<(libbase_ver)',
     23         'protobuf-lite',
     24       ],
     25     },
     26     'include_dirs': [
     27       # We need this include dir because we include all the local code as
     28       # "attestation/...".
     29       '<(platform2_root)/../aosp/system/tpm',
     30     ],
     31   },
     32   'targets': [
     33     # A library for just the protobufs.
     34     {
     35       'target_name': 'proto_library',
     36       'type': 'static_library',
     37       # Use -fPIC so this code can be linked into a shared library.
     38       'cflags!': ['-fPIE'],
     39       'cflags': [
     40         '-fPIC',
     41         '-fvisibility=default',
     42       ],
     43       'variables': {
     44         'proto_in_dir': 'common',
     45         'proto_out_dir': 'include/attestation/common',
     46       },
     47       'sources': [
     48         '<(proto_in_dir)/attestation_ca.proto',
     49         '<(proto_in_dir)/common.proto',
     50         '<(proto_in_dir)/database.proto',
     51         '<(proto_in_dir)/interface.proto',
     52         'common/print_common_proto.cc',
     53         'common/print_interface_proto.cc',
     54       ],
     55       'includes': ['../../../../platform2/common-mk/protoc.gypi'],
     56     },
     57     # A library for common code.
     58     {
     59       'target_name': 'common_library',
     60       'type': 'static_library',
     61       'sources': [
     62         'common/crypto_utility_impl.cc',
     63         'common/tpm_utility_v1.cc',
     64       ],
     65       'all_dependent_settings': {
     66         'variables': {
     67           'deps': [
     68             'openssl',
     69           ],
     70         },
     71         'libraries': [
     72           '-ltspi',
     73         ],
     74       },
     75       'dependencies': [
     76         'proto_library',
     77       ],
     78     },
     79     # A library for client code.
     80     {
     81       'target_name': 'client_library',
     82       'type': 'static_library',
     83       # Use -fPIC so this code can be linked into a shared library.
     84       'cflags!': ['-fPIE'],
     85       'cflags': [
     86         '-fPIC',
     87         '-fvisibility=default',
     88       ],
     89       'sources': [
     90         'client/dbus_proxy.cc',
     91       ],
     92       'dependencies': [
     93         'proto_library',
     94       ],
     95     },
     96     # A shared library for clients.
     97     {
     98       'target_name': 'libattestation',
     99       'type': 'shared_library',
    100       'cflags': ['-fvisibility=default'],
    101       'sources': [
    102       ],
    103       'dependencies': [
    104         'client_library',
    105         'proto_library',
    106       ],
    107     },
    108     # A client command line utility.
    109     {
    110       'target_name': 'attestation_client',
    111       'type': 'executable',
    112       'sources': [
    113         'client/main.cc',
    114       ],
    115       'dependencies': [
    116         'client_library',
    117         'common_library',
    118         'proto_library',
    119       ]
    120     },
    121     # A library for server code.
    122     {
    123       'target_name': 'server_library',
    124       'type': 'static_library',
    125       'sources': [
    126         'server/attestation_service.cc',
    127         'server/dbus_service.cc',
    128         'server/database_impl.cc',
    129         'server/pkcs11_key_store.cc',
    130       ],
    131       'all_dependent_settings': {
    132         'libraries': [
    133           '-lchaps',
    134         ],
    135       },
    136       'dependencies': [
    137         'proto_library',
    138       ],
    139     },
    140     # The attestation daemon.
    141     {
    142       'target_name': 'attestationd',
    143       'type': 'executable',
    144       'sources': [
    145         'server/main.cc',
    146       ],
    147       'variables': {
    148         'deps': [
    149           'libminijail',
    150         ],
    151       },
    152       'dependencies': [
    153         'common_library',
    154         'proto_library',
    155         'server_library',
    156       ],
    157     },
    158   ],
    159   'conditions': [
    160     ['USE_test == 1', {
    161       'targets': [
    162         {
    163           'target_name': 'attestation_testrunner',
    164           'type': 'executable',
    165           'includes': ['../../../../platform2/common-mk/common_test.gypi'],
    166           'variables': {
    167             'deps': [
    168               'libbrillo-test-<(libbase_ver)',
    169               'libchrome-test-<(libbase_ver)',
    170             ],
    171           },
    172           'sources': [
    173             'attestation_testrunner.cc',
    174             'client/dbus_proxy_test.cc',
    175             'common/crypto_utility_impl_test.cc',
    176             'common/mock_crypto_utility.cc',
    177             'common/mock_tpm_utility.cc',
    178             'server/attestation_service_test.cc',
    179             'server/database_impl_test.cc',
    180             'server/dbus_service_test.cc',
    181             'server/mock_database.cc',
    182             'server/mock_key_store.cc',
    183             'server/pkcs11_key_store_test.cc',
    184           ],
    185           'dependencies': [
    186             'common_library',
    187             'client_library',
    188             'proto_library',
    189             'server_library',
    190           ],
    191         },
    192       ],
    193     }],
    194   ],
    195 }
    196