1# Copyright (C) 2015 The Android Open Source Project.
2#
3# Permission to use, copy, modify, and/or distribute this software for any
4# purpose with or without fee is hereby granted, provided that the above
5# copyright notice and this permission notice appear in all copies.
6#
7# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
15# This file is not used in the Android build process! It's used only by Trusty.
16
17
18LOCAL_DIR := $(GET_LOCAL_DIR)
19LOCAL_PATH := $(GET_LOCAL_DIR)
20
21MODULE := $(LOCAL_DIR)
22
23TARGET_ARCH := $(ARCH)
24TARGET_2ND_ARCH := $(ARCH)
25
26# Reset local variables
27LOCAL_CFLAGS :=
28LOCAL_C_INCLUDES :=
29LOCAL_SRC_FILES_$(TARGET_ARCH) :=
30LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) :=
31LOCAL_CFLAGS_$(TARGET_ARCH) :=
32LOCAL_CFLAGS_$(TARGET_2ND_ARCH) :=
33LOCAL_ADDITIONAL_DEPENDENCIES :=
34
35# get target_c_flags, target_c_includes, target_src_files
36MODULE_SRCDEPS += $(LOCAL_DIR)/crypto-sources.mk
37include $(LOCAL_DIR)/crypto-sources.mk
38
39# Some files in BoringSSL use OS functions that aren't supported by Trusty. The
40# easiest way to deal with them is not to include them. As long as no path to
41# the functions defined in these files exists, the linker will be happy. If
42# such a path is created, it'll be a link-time error and something more complex
43# may need to be considered.
44LOCAL_SRC_FILES := $(filter-out android_compat_hacks.c,$(LOCAL_SRC_FILES))
45LOCAL_SRC_FILES := $(filter-out src/crypto/bio/connect.c,$(LOCAL_SRC_FILES))
46LOCAL_SRC_FILES := $(filter-out src/crypto/bio/fd.c,$(LOCAL_SRC_FILES))
47LOCAL_SRC_FILES := $(filter-out src/crypto/bio/file.c,$(LOCAL_SRC_FILES))
48LOCAL_SRC_FILES := $(filter-out src/crypto/bio/socket.c,$(LOCAL_SRC_FILES))
49LOCAL_SRC_FILES := $(filter-out src/crypto/bio/socket_helper.c,$(LOCAL_SRC_FILES))
50LOCAL_SRC_FILES := $(filter-out src/crypto/directory_posix.c,$(LOCAL_SRC_FILES))
51LOCAL_SRC_FILES := $(filter-out src/crypto/rand/urandom.c,$(LOCAL_SRC_FILES))
52LOCAL_SRC_FILES := $(filter-out src/crypto/time_support.c,$(LOCAL_SRC_FILES))
53LOCAL_SRC_FILES := $(filter-out src/crypto/x509/by_dir.c,$(LOCAL_SRC_FILES))
54LOCAL_SRC_FILES := $(filter-out src/crypto/x509v3/v3_utl.c,$(LOCAL_SRC_FILES))
55
56# BoringSSL detects Trusty based on this define and does things like switch to
57# no-op threading functions.
58MODULE_CFLAGS += -DTRUSTY
59
60MODULE_SRCS += $(addprefix $(LOCAL_DIR)/,$(LOCAL_SRC_FILES))
61MODULE_SRCS += $(addprefix $(LOCAL_DIR)/,$(LOCAL_SRC_FILES_$(ARCH)))
62LOCAL_C_INCLUDES := src/crypto src/include
63
64GLOBAL_INCLUDES += $(addprefix $(LOCAL_DIR)/,$(LOCAL_C_INCLUDES))
65
66MODULE_DEPS := \
67	lib/openssl-stubs \
68	lib/libc-trusty
69
70include make/module.mk
71