Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 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 | |
| 18 | LOCAL_DIR := $(GET_LOCAL_DIR) |
| 19 | LOCAL_PATH := $(GET_LOCAL_DIR) |
| 20 | |
| 21 | MODULE := $(LOCAL_DIR) |
| 22 | |
Arve Hjønnevåg | 70640c6 | 2015-10-01 20:48:35 -0700 | [diff] [blame] | 23 | MODULE_STATIC_LIB := true |
| 24 | |
Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 25 | TARGET_ARCH := $(ARCH) |
| 26 | TARGET_2ND_ARCH := $(ARCH) |
| 27 | |
| 28 | # Reset local variables |
| 29 | LOCAL_CFLAGS := |
| 30 | LOCAL_C_INCLUDES := |
Arve Hjønnevåg | feab0bc | 2015-09-18 20:56:46 -0700 | [diff] [blame] | 31 | LOCAL_SRC_FILES := |
Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 32 | LOCAL_SRC_FILES_$(TARGET_ARCH) := |
| 33 | LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := |
| 34 | LOCAL_CFLAGS_$(TARGET_ARCH) := |
| 35 | LOCAL_CFLAGS_$(TARGET_2ND_ARCH) := |
| 36 | LOCAL_ADDITIONAL_DEPENDENCIES := |
| 37 | |
| 38 | # get target_c_flags, target_c_includes, target_src_files |
| 39 | MODULE_SRCDEPS += $(LOCAL_DIR)/crypto-sources.mk |
| 40 | include $(LOCAL_DIR)/crypto-sources.mk |
| 41 | |
| 42 | # Some files in BoringSSL use OS functions that aren't supported by Trusty. The |
| 43 | # easiest way to deal with them is not to include them. As long as no path to |
| 44 | # the functions defined in these files exists, the linker will be happy. If |
| 45 | # such a path is created, it'll be a link-time error and something more complex |
| 46 | # may need to be considered. |
Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 47 | LOCAL_SRC_FILES := $(filter-out src/crypto/bio/connect.c,$(LOCAL_SRC_FILES)) |
| 48 | LOCAL_SRC_FILES := $(filter-out src/crypto/bio/fd.c,$(LOCAL_SRC_FILES)) |
| 49 | LOCAL_SRC_FILES := $(filter-out src/crypto/bio/file.c,$(LOCAL_SRC_FILES)) |
| 50 | LOCAL_SRC_FILES := $(filter-out src/crypto/bio/socket.c,$(LOCAL_SRC_FILES)) |
| 51 | LOCAL_SRC_FILES := $(filter-out src/crypto/bio/socket_helper.c,$(LOCAL_SRC_FILES)) |
Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 52 | LOCAL_SRC_FILES := $(filter-out src/crypto/x509/by_dir.c,$(LOCAL_SRC_FILES)) |
Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 53 | |
| 54 | # BoringSSL detects Trusty based on this define and does things like switch to |
| 55 | # no-op threading functions. |
| 56 | MODULE_CFLAGS += -DTRUSTY |
| 57 | |
Arve Hjønnevåg | 8cd47e1 | 2015-09-18 21:10:36 -0700 | [diff] [blame] | 58 | # Define static armcap based on lk build variables |
| 59 | MODULE_STATIC_ARMCAP := -DOPENSSL_STATIC_ARMCAP |
| 60 | toarmcap = $(if $(filter-out 0 false,$(2)),-DOPENSSL_STATIC_ARMCAP_$(1),) |
| 61 | MODULE_STATIC_ARMCAP += $(call toarmcap,NEON,$(USE_ARM_V7_NEON)) |
| 62 | MODULE_STATIC_ARMCAP += $(call toarmcap,AES,$(USE_ARM_V8_AES)) |
| 63 | MODULE_STATIC_ARMCAP += $(call toarmcap,PMULL,$(USE_ARM_V8_PMULL)) |
| 64 | MODULE_STATIC_ARMCAP += $(call toarmcap,SHA1,$(USE_ARM_V8_SHA1)) |
| 65 | MODULE_STATIC_ARMCAP += $(call toarmcap,SHA256,$(USE_ARM_V8_SHA2)) |
| 66 | MODULE_CFLAGS += $(MODULE_STATIC_ARMCAP) |
| 67 | MODULE_ASMFLAGS += $(MODULE_STATIC_ARMCAP) |
| 68 | |
Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 69 | MODULE_SRCS += $(addprefix $(LOCAL_DIR)/,$(LOCAL_SRC_FILES)) |
| 70 | MODULE_SRCS += $(addprefix $(LOCAL_DIR)/,$(LOCAL_SRC_FILES_$(ARCH))) |
| 71 | LOCAL_C_INCLUDES := src/crypto src/include |
| 72 | |
| 73 | GLOBAL_INCLUDES += $(addprefix $(LOCAL_DIR)/,$(LOCAL_C_INCLUDES)) |
| 74 | |
David Benjamin | f0c4a6c | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 75 | # BoringSSL expects an STL to be available when building for C++11 to provide |
| 76 | # scopers. Suppress those APIs. |
| 77 | GLOBAL_CPPFLAGS += -DBORINGSSL_NO_CXX |
| 78 | |
Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 79 | MODULE_DEPS := \ |
| 80 | lib/openssl-stubs \ |
Adam Langley | dfce004 | 2015-05-13 10:49:39 -0700 | [diff] [blame] | 81 | |
| 82 | include make/module.mk |