1 # Copyright (C) 2015 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 trunksCppExtension := .cc 20 trunksCFlags := -Wall -Werror -Wno-unused-parameter -DUSE_BINDER_IPC 21 trunksIncludes := $(LOCAL_PATH)/.. external/gtest/include 22 trunksSharedLibraries := \ 23 libbinder \ 24 libbinderwrapper \ 25 libbrillo \ 26 libbrillo-binder \ 27 libchrome \ 28 libchrome-crypto \ 29 libcrypto \ 30 libprotobuf-cpp-lite \ 31 libutils \ 32 33 # libtrunks_generated 34 # ======================================================== 35 include $(CLEAR_VARS) 36 LOCAL_MODULE := libtrunks_generated 37 LOCAL_MODULE_CLASS := STATIC_LIBRARIES 38 LOCAL_CPP_EXTENSION := $(trunksCppExtension) 39 LOCAL_CFLAGS := $(trunksCFlags) 40 LOCAL_CLANG := true 41 proto_include := $(call local-generated-sources-dir)/proto/$(LOCAL_PATH)/.. 42 aidl_include := $(call local-generated-sources-dir)/aidl-generated/include 43 LOCAL_C_INCLUDES := $(proto_include) $(aidl_include) $(trunksIncludes) 44 LOCAL_EXPORT_C_INCLUDE_DIRS := $(proto_include) $(aidl_include) 45 LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries) 46 LOCAL_SRC_FILES := \ 47 interface.proto \ 48 aidl/android/trunks/ITrunks.aidl \ 49 aidl/android/trunks/ITrunksClient.aidl \ 50 51 LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl 52 include $(BUILD_STATIC_LIBRARY) 53 54 # libtrunks_common 55 # ======================================================== 56 include $(CLEAR_VARS) 57 LOCAL_MODULE := libtrunks_common 58 LOCAL_CPP_EXTENSION := $(trunksCppExtension) 59 LOCAL_CFLAGS := $(trunksCFlags) 60 LOCAL_CLANG := true 61 LOCAL_C_INCLUDES := $(trunksIncludes) 62 LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries) 63 LOCAL_STATIC_LIBRARIES := libtrunks_generated 64 LOCAL_SRC_FILES := \ 65 background_command_transceiver.cc \ 66 blob_parser.cc \ 67 error_codes.cc \ 68 hmac_authorization_delegate.cc \ 69 hmac_session_impl.cc \ 70 password_authorization_delegate.cc \ 71 policy_session_impl.cc \ 72 scoped_key_handle.cc \ 73 session_manager_impl.cc \ 74 tpm_generated.cc \ 75 tpm_state_impl.cc \ 76 tpm_utility_impl.cc \ 77 trunks_factory_impl.cc \ 78 79 include $(BUILD_STATIC_LIBRARY) 80 81 # trunksd 82 # ======================================================== 83 include $(CLEAR_VARS) 84 LOCAL_MODULE := trunksd 85 LOCAL_CPP_EXTENSION := $(trunksCppExtension) 86 LOCAL_CFLAGS := $(trunksCFlags) 87 ifeq ($(BRILLOEMULATOR),true) 88 LOCAL_CFLAGS += -DUSE_SIMULATOR 89 endif 90 LOCAL_CLANG := true 91 ifeq ($(BRILLOEMULATOR),true) 92 LOCAL_INIT_RC := trunksd-simulator.rc 93 else 94 LOCAL_INIT_RC := trunksd.rc 95 endif 96 LOCAL_C_INCLUDES := $(trunksIncludes) 97 LOCAL_SHARED_LIBRARIES := \ 98 $(trunksSharedLibraries) \ 99 libbrillo-minijail \ 100 libminijail \ 101 102 ifeq ($(BRILLOEMULATOR),true) 103 LOCAL_SHARED_LIBRARIES += libtpm2 104 endif 105 LOCAL_STATIC_LIBRARIES := \ 106 libtrunks_generated \ 107 libtrunks_common \ 108 109 LOCAL_REQUIRED_MODULES := \ 110 com.android.Trunks.conf \ 111 trunksd-seccomp.policy \ 112 113 LOCAL_SRC_FILES := \ 114 resource_manager.cc \ 115 tpm_handle.cc \ 116 tpm_simulator_handle.cc \ 117 trunks_binder_service.cc \ 118 trunksd.cc \ 119 120 include $(BUILD_EXECUTABLE) 121 122 # trunksd-seccomp.policy 123 # ======================================================== 124 include $(CLEAR_VARS) 125 LOCAL_MODULE := trunksd-seccomp.policy 126 LOCAL_MODULE_CLASS := ETC 127 LOCAL_MODULE_PATH := $(TARGET_OUT)/usr/share/policy/ 128 LOCAL_SRC_FILES := trunksd-seccomp-$(TARGET_ARCH).policy 129 include $(BUILD_PREBUILT) 130 131 # libtrunks 132 # ======================================================== 133 include $(CLEAR_VARS) 134 LOCAL_MODULE := libtrunks 135 LOCAL_CPP_EXTENSION := $(trunksCppExtension) 136 LOCAL_CFLAGS := $(trunksCFlags) 137 LOCAL_CLANG := true 138 LOCAL_C_INCLUDES := $(trunksIncludes) 139 LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries) 140 LOCAL_STATIC_LIBRARIES := \ 141 libtrunks_common \ 142 libtrunks_generated \ 143 144 LOCAL_SRC_FILES := \ 145 trunks_binder_proxy.cc \ 146 147 include $(BUILD_SHARED_LIBRARY) 148 149 # trunks_client 150 # ======================================================== 151 include $(CLEAR_VARS) 152 LOCAL_MODULE := trunks_client 153 LOCAL_CPP_EXTENSION := $(trunksCppExtension) 154 LOCAL_CFLAGS := $(trunksCFlags) 155 LOCAL_CLANG := true 156 LOCAL_C_INCLUDES := $(trunksIncludes) 157 LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries) libtrunks 158 LOCAL_STATIC_LIBRARIES := libtrunks_common 159 LOCAL_SRC_FILES := \ 160 trunks_client.cc \ 161 trunks_client_test.cc \ 162 163 include $(BUILD_EXECUTABLE) 164 165 # Target unit tests 166 # ======================================================== 167 include $(CLEAR_VARS) 168 LOCAL_MODULE := trunks_test 169 LOCAL_MODULE_TAGS := eng 170 LOCAL_CPP_EXTENSION := $(trunksCppExtension) 171 LOCAL_CFLAGS := $(trunksCFlags) 172 LOCAL_CLANG := true 173 LOCAL_C_INCLUDES := $(trunksIncludes) 174 LOCAL_SHARED_LIBRARIES := $(trunksSharedLibraries) 175 LOCAL_SRC_FILES := \ 176 background_command_transceiver_test.cc \ 177 hmac_authorization_delegate_test.cc \ 178 hmac_session_test.cc \ 179 mock_authorization_delegate.cc \ 180 mock_blob_parser.cc \ 181 mock_command_transceiver.cc \ 182 mock_hmac_session.cc \ 183 mock_policy_session.cc \ 184 mock_session_manager.cc \ 185 mock_tpm.cc \ 186 mock_tpm_state.cc \ 187 mock_tpm_utility.cc \ 188 password_authorization_delegate_test.cc \ 189 policy_session_test.cc \ 190 resource_manager.cc \ 191 resource_manager_test.cc \ 192 scoped_key_handle_test.cc \ 193 session_manager_test.cc \ 194 tpm_generated_test.cc \ 195 tpm_state_test.cc \ 196 tpm_utility_test.cc \ 197 trunks_factory_for_test.cc \ 198 199 LOCAL_STATIC_LIBRARIES := \ 200 libgmock \ 201 libgtest \ 202 libBionicGtestMain \ 203 libtrunks_common \ 204 libtrunks_generated \ 205 206 include $(BUILD_NATIVE_TEST) 207