1# Copyright (C) 2022 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) 17 18HOST_TEST := cbor_test 19 20GTEST_DIR := external/googletest/googletest 21GMOCK_DIR := external/googletest/googlemock 22PACKAGE_DIR := trusty/user/base/lib/apploader_package 23OPEN_DICE_DIR := external/open-dice 24LIBCPPBOR_DIR := $(if $(wildcard system/libcppbor),system/libcppbor,external/libcppbor) 25 26# libcppbor checks if __TRUSTY__ is defined to determine whether it's linked 27# into Android or Trusty; the library uses some Android-specific logging and 28# other APIs that host tools don't provide, so we define __TRUSTY__ here to 29# disable all the Android-specific code in libcppbor. 30HOST_FLAGS := -D__TRUSTY__ 31 32HOST_SRCS := \ 33 $(LOCAL_DIR)/cbor_test.cpp \ 34 $(GTEST_DIR)/src/gtest-all.cc \ 35 $(GTEST_DIR)/src/gtest_main.cc \ 36 $(OPEN_DICE_DIR)/src/cbor_reader.c \ 37 $(OPEN_DICE_DIR)/src/cbor_writer.c \ 38 $(LIBCPPBOR_DIR)/src/cppbor.cpp \ 39 $(LIBCPPBOR_DIR)/src/cppbor_parse.cpp \ 40 41HOST_INCLUDE_DIRS := \ 42 $(LOCAL_DIR)/../.. \ 43 $(PACKAGE_DIR)/include \ 44 $(OPEN_DICE_DIR)/include \ 45 $(LIBCPPBOR_DIR)/include/cppbor \ 46 $(GTEST_DIR)/include \ 47 $(GTEST_DIR) \ 48 $(GMOCK_DIR)/include \ 49 50# Build and statically link in boringssl so we don't have to worry about what 51# version the host environment provides. OpenSSL 3.0 deprecates several of the 52# low-level APIs used for trusty app signing and encryption. 53HOST_DEPS := \ 54 trusty/user/base/host/boringssl 55 56HOST_LIBS := \ 57 stdc++ \ 58 pthread \ 59 60include make/host_test.mk 61