1# Copyright (C) 2018 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
16KEYMASTER_ROOT := system/keymaster
17KEYMASTER_DIR := trusty/user/app/keymaster
18NANOPB_DIR := external/nanopb-c
19HOST_TEST := keymaster_test
20
21HOST_SRCS += \
22	$(KEYMASTER_DIR)/secure_storage_manager.cpp \
23	$(KEYMASTER_DIR)/second_imei_attestation.cpp \
24	$(KEYMASTER_DIR)/host_unittest/main.cpp \
25	$(KEYMASTER_ROOT)/android_keymaster/logger.cpp \
26	$(KEYMASTER_DIR)/keymaster_attributes.pb.c \
27	$(NANOPB_DIR)/pb_common.c \
28	$(NANOPB_DIR)/pb_encode.c \
29	$(NANOPB_DIR)/pb_decode.c \
30
31HOST_INCLUDE_DIRS := \
32	$(KEYMASTER_ROOT) \
33	$(KEYMASTER_DIR)/host_unittest \
34	$(KEYMASTER_DIR) \
35	$(KEYMASTER_ROOT)/include \
36	hardware/libhardware/include \
37	lib/lib/storage/include \
38	lib/interface/storage/include \
39	$(NANOPB_DIR) \
40
41HOST_FLAGS := -Wpointer-arith \
42	-Wno-deprecated-declarations -fno-exceptions \
43	-Wno-error=c++14-extensions \
44	-DSTORAGE_FAKE \
45	-DPB_FIELD_16BIT \
46	-DPB_NO_STATIC_ASSERT \
47	-DKEYMASTER_LEGACY_FORMAT \
48
49HOST_LIBS := \
50	stdc++ \
51
52# These rules are used to force .pb.h file to be generated before compiling
53# these files.
54$(KEYMASTER_DIR)/secure_storage_manager.cpp: $(NANOPB_GENERATED_HEADER)
55$(KEYMASTER_DIR)/host_unittest/main.cpp: $(NANOPB_GENERATED_HEADER)
56
57include trusty/user/app/storage/storage_mock/add_mock_storage.mk
58include make/host_test.mk
59