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	trusty/user/base/interface/hwbcc \
32	trusty/user/base/lib/trusty-std \
33	$(call FIND_CRATE,log) \
34	trusty/user/base/lib/tipc/rust \
35	trusty/user/base/lib/system_state/rust \
36	trusty/user/base/lib/hwbcc/common \
37
38MODULE_BINDGEN_ALLOW_TYPES := \
39	hwbcc.* \
40
41MODULE_BINDGEN_ALLOW_VARS := \
42	HWBCC.* \
43	DICE.* \
44	ED25519.* \
45
46MODULE_BINDGEN_ALLOW_FUNCTIONS := \
47	validate.* \
48
49MODULE_BINDGEN_FLAGS := \
50	--use-array-pointers-in-arguments \
51
52MODULE_BINDGEN_SRC_HEADER := $(LOCAL_DIR)/bindings.h
53
54# Enable tests specific to the generic emulator build,
55# which depend on the device-specific BCC key
56ifeq (generic-arm64, $(PLATFORM))
57MODULE_RUSTFLAGS += --cfg 'feature="generic-arm-unittest"'
58endif
59
60MODULE_RUST_TESTS := true
61
62# For test service
63MANIFEST := $(LOCAL_DIR)/manifest.json
64
65include make/library.mk
66