Home | History | Annotate | Download | only in tpm_manager
      1 # Copyright (C) 2016 The Android Open Source Project
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #      http://www.apache.org/licenses/LICENSE-2.0
      8 #
      9 # Unless required by applicable law or agreed to in writing, software
     10 # distributed under the License is distributed on an "AS IS" BASIS,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 
     15 LOCAL_PATH := $(call my-dir)
     16 
     17 # Common variables
     18 # ========================================================
     19 defaultCppExtension := .cc
     20 defaultCFlags := \
     21   -Wall -Werror \
     22   -Wno-unused-parameter \
     23   -fvisibility=hidden \
     24   -DUSE_TPM2 \
     25   -DUSE_BINDER_IPC
     26 defaultIncludes := $(LOCAL_PATH)/..
     27 defaultSharedLibraries := \
     28   libbase \
     29   libbinder \
     30   libbinderwrapper \
     31   libbrillo \
     32   libbrillo-binder \
     33   libchrome \
     34   libchrome-crypto \
     35   libcrypto \
     36   libprotobuf-cpp-lite \
     37   libtrunks \
     38   libutils
     39 
     40 # libtpm_manager_generated
     41 # ========================================================
     42 include $(CLEAR_VARS)
     43 LOCAL_MODULE := libtpm_manager_generated
     44 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
     45 LOCAL_CPP_EXTENSION := $(defaultCppExtension)
     46 LOCAL_CFLAGS := $(defaultCFlags) -fvisibility=default
     47 LOCAL_CLANG := true
     48 proto_include := $(call local-generated-sources-dir)/proto/$(LOCAL_PATH)/..
     49 aidl_include := $(call local-generated-sources-dir)/aidl-generated/include
     50 LOCAL_C_INCLUDES := $(proto_include) $(aidl_include) $(defaultIncludes)
     51 LOCAL_EXPORT_C_INCLUDE_DIRS := $(proto_include) $(aidl_include)
     52 LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
     53 LOCAL_SRC_FILES := \
     54   common/tpm_manager.proto \
     55   aidl/android/tpm_manager/ITpmManagerClient.aidl \
     56   aidl/android/tpm_manager/ITpmNvram.aidl \
     57   aidl/android/tpm_manager/ITpmOwnership.aidl
     58 LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl
     59 include $(BUILD_STATIC_LIBRARY)
     60 
     61 # libtpm_manager_common
     62 # ========================================================
     63 include $(CLEAR_VARS)
     64 LOCAL_MODULE := libtpm_manager_common
     65 LOCAL_CPP_EXTENSION := $(defaultCppExtension)
     66 LOCAL_CFLAGS := $(defaultCFlags) -fvisibility=default
     67 LOCAL_CLANG := true
     68 LOCAL_C_INCLUDES := $(defaultIncludes)
     69 LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
     70 LOCAL_STATIC_LIBRARIES := libtpm_manager_generated
     71 LOCAL_SRC_FILES := \
     72   common/print_tpm_manager_proto.cc
     73 include $(BUILD_STATIC_LIBRARY)
     74 
     75 # libtpm_manager_server
     76 # ========================================================
     77 include $(CLEAR_VARS)
     78 LOCAL_MODULE := libtpm_manager_server
     79 LOCAL_CPP_EXTENSION := $(defaultCppExtension)
     80 LOCAL_CFLAGS := $(defaultCFlags)
     81 LOCAL_CLANG := true
     82 LOCAL_C_INCLUDES := $(defaultIncludes)
     83 LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
     84 LOCAL_STATIC_LIBRARIES := libtpm_manager_generated
     85 LOCAL_SRC_FILES := \
     86   server/binder_service.cc \
     87   server/local_data_store_impl.cc \
     88   server/openssl_crypto_util_impl.cc \
     89   server/tpm2_initializer_impl.cc \
     90   server/tpm2_nvram_impl.cc \
     91   server/tpm2_status_impl.cc \
     92   server/tpm_manager_service.cc
     93 include $(BUILD_STATIC_LIBRARY)
     94 
     95 # tpm_managerd
     96 # ========================================================
     97 include $(CLEAR_VARS)
     98 LOCAL_MODULE := tpm_managerd
     99 LOCAL_CPP_EXTENSION := $(defaultCppExtension)
    100 LOCAL_CFLAGS := $(defaultCFlags)
    101 LOCAL_CLANG := true
    102 LOCAL_INIT_RC := server/tpm_managerd.rc
    103 LOCAL_C_INCLUDES := $(defaultIncludes)
    104 LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
    105 LOCAL_STATIC_LIBRARIES := \
    106   libtpm_manager_server \
    107   libtpm_manager_common \
    108   libtpm_manager_generated
    109 LOCAL_SRC_FILES := \
    110   server/main.cc
    111 
    112 include $(BUILD_EXECUTABLE)
    113 
    114 # libtpm_manager
    115 # ========================================================
    116 include $(CLEAR_VARS)
    117 LOCAL_MODULE := libtpm_manager
    118 LOCAL_CPP_EXTENSION := $(defaultCppExtension)
    119 LOCAL_CFLAGS := $(defaultCFlags)
    120 LOCAL_CLANG := true
    121 LOCAL_C_INCLUDES := $(defaultIncludes)
    122 LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries)
    123 LOCAL_WHOLE_STATIC_LIBRARIES := \
    124   libtpm_manager_common \
    125   libtpm_manager_generated
    126 LOCAL_SRC_FILES := \
    127   client/tpm_nvram_binder_proxy.cc \
    128   client/tpm_ownership_binder_proxy.cc
    129 include $(BUILD_SHARED_LIBRARY)
    130 
    131 # tpm_manager_client
    132 # ========================================================
    133 include $(CLEAR_VARS)
    134 LOCAL_MODULE := tpm_manager_client
    135 LOCAL_CPP_EXTENSION := $(defaultCppExtension)
    136 LOCAL_CFLAGS := $(defaultCFlags)
    137 LOCAL_CLANG := true
    138 LOCAL_C_INCLUDES := $(defaultIncludes)
    139 LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries) libtpm_manager
    140 LOCAL_SRC_FILES := \
    141   client/main.cc
    142 include $(BUILD_EXECUTABLE)
    143 
    144 # Target unit tests
    145 # ========================================================
    146 include $(CLEAR_VARS)
    147 LOCAL_MODULE := tpm_manager_test
    148 LOCAL_MODULE_TAGS := eng
    149 LOCAL_CPP_EXTENSION := $(defaultCppExtension)
    150 LOCAL_CFLAGS := $(defaultCFlags) -Wno-sign-compare
    151 LOCAL_CLANG := true
    152 LOCAL_C_INCLUDES := $(defaultIncludes)
    153 LOCAL_SHARED_LIBRARIES := $(defaultSharedLibraries) libtpm_manager
    154 LOCAL_SRC_FILES := \
    155   common/mock_tpm_nvram_interface.cc \
    156   common/mock_tpm_ownership_interface.cc \
    157   server/binder_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/tpm2_initializer_test.cc \
    164   server/tpm2_nvram_test.cc \
    165   server/tpm2_status_test.cc \
    166   server/tpm_manager_service_test.cc
    167 LOCAL_STATIC_LIBRARIES := \
    168   libBionicGtestMain \
    169   libgmock \
    170   libtpm_manager_common \
    171   libtpm_manager_generated \
    172   libtpm_manager_server \
    173   libtrunks_test
    174 include $(BUILD_NATIVE_TEST)
    175