1# Copyright (C) 2021 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 16LOCAL_DIR := $(GET_LOCAL_DIR) 17LIBCPPBOR_DIR := $(if $(wildcard system/libcppbor),system/libcppbor,external/libcppbor) 18 19MODULE := $(LOCAL_DIR) 20 21MODULE_SRCS := $(LOCAL_DIR)/src/lib.rs 22 23MODULE_CRATE_NAME := hwbcc 24 25MODULE_SDK_LIB_NAME := hwbcc-rust 26 27MODULE_LIBRARY_DEPS += \ 28 external/boringssl \ 29 $(LIBCPPBOR_DIR) \ 30 external/open-dice \ 31 packages/modules/Virtualization/libs/dice/open_dice \ 32 trusty/user/base/interface/hwbcc \ 33 trusty/user/base/lib/trusty-std \ 34 $(call FIND_CRATE,coset) \ 35 $(call FIND_CRATE,log) \ 36 $(call FIND_CRATE,zerocopy) \ 37 $(call FIND_CRATE,num-derive) \ 38 $(call FIND_CRATE,num-traits) \ 39 trusty/user/base/lib/tipc/rust \ 40 trusty/user/base/lib/system_state/rust \ 41 trusty/user/base/lib/hwbcc/common \ 42 43MODULE_BINDGEN_ALLOW_TYPES := \ 44 hwbcc.* \ 45 46 47 48MODULE_BINDGEN_ALLOW_VARS := \ 49 HWBCC.* \ 50 DICE.* \ 51 ED25519.* \ 52 53MODULE_BINDGEN_ALLOW_FUNCTIONS := \ 54 validate.* \ 55 56MODULE_BINDGEN_FLAGS := \ 57 --use-array-pointers-in-arguments \ 58 --with-derive-custom-struct=hwbcc.*=zerocopy::IntoBytes,zerocopy::FromBytes \ 59 60MODULE_BINDGEN_SRC_HEADER := $(LOCAL_DIR)/bindings.h 61 62# Enable tests specific to the generic emulator build, 63# which depend on the device-specific BCC key 64ifeq (generic-arm64, $(PLATFORM)) 65MODULE_RUSTFLAGS += --cfg 'feature="generic-arm-unittest"' 66endif 67 68MODULE_RUST_TESTS := true 69 70# For test service 71MANIFEST := $(LOCAL_DIR)/manifest.json 72 73include make/library.mk 74