1# Note that some host libraries have the same module name as the target
2# libraries. This is currently needed to build, for example, adb. But it's
3# probably something that should be changed.
4
5LOCAL_PATH := $(call my-dir)
6
7## libcrypto
8
9# Target static library
10include $(CLEAR_VARS)
11LOCAL_MODULE_TAGS := optional
12LOCAL_MODULE := libcrypto_static
13LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
14LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/crypto-sources.mk
15LOCAL_SDK_VERSION := 9
16LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
17# sha256-armv4.S does not compile with clang.
18LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
19LOCAL_CLANG_ASFLAGS_arm64 += -march=armv8-a+crypto
20include $(LOCAL_PATH)/crypto-sources.mk
21include $(BUILD_STATIC_LIBRARY)
22
23# Target shared library
24include $(CLEAR_VARS)
25LOCAL_MODULE_TAGS := optional
26LOCAL_MODULE := libcrypto
27LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
28LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/crypto-sources.mk
29LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
30LOCAL_SDK_VERSION := 9
31# sha256-armv4.S does not compile with clang.
32LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
33LOCAL_CLANG_ASFLAGS_arm64 += -march=armv8-a+crypto
34include $(LOCAL_PATH)/crypto-sources.mk
35include $(BUILD_SHARED_LIBRARY)
36
37# Target static tool
38include $(CLEAR_VARS)
39LOCAL_CFLAGS += -Wall -Werror -std=c++0x
40LOCAL_CPP_EXTENSION := cc
41LOCAL_MODULE := bssl
42LOCAL_MODULE_TAGS := optional
43LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/sources.mk
44LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
45LOCAL_SHARED_LIBRARIES=libcrypto libssl
46include $(LOCAL_PATH)/sources.mk
47LOCAL_SRC_FILES = $(tool_sources)
48include $(BUILD_EXECUTABLE)
49
50# Host static library
51include $(CLEAR_VARS)
52LOCAL_IS_HOST_MODULE := true
53LOCAL_MODULE := libcrypto_static
54LOCAL_MODULE_HOST_OS := darwin linux windows
55LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
56LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/crypto-sources.mk
57LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
58LOCAL_CXX_STL := none
59# Windows and Macs both have problems with assembly files
60LOCAL_CFLAGS_darwin += -DOPENSSL_NO_ASM
61LOCAL_CFLAGS_windows += -DOPENSSL_NO_ASM
62# TODO: b/26097626. ASAN breaks use of this library in JVM.
63# Re-enable sanitization when the issue with making clients of this library
64# preload ASAN runtime is resolved. Without that, clients are getting runtime
65# errors due to unresoled ASAN symbols, such as
66# __asan_option_detect_stack_use_after_return.
67LOCAL_SANITIZE := never
68include $(LOCAL_PATH)/crypto-sources.mk
69include $(BUILD_HOST_STATIC_LIBRARY)
70
71# Host shared library
72include $(CLEAR_VARS)
73LOCAL_IS_HOST_MODULE := true
74LOCAL_MODULE := libcrypto-host
75LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
76LOCAL_MULTILIB := both
77LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/crypto-sources.mk
78LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
79# Windows and Macs both have problems with assembly files
80LOCAL_CFLAGS_darwin += -DOPENSSL_NO_ASM
81LOCAL_CFLAGS_windows += -DOPENSSL_NO_ASM
82LOCAL_LDLIBS_darwin := -lpthread
83LOCAL_LDLIBS_linux := -lpthread
84LOCAL_CXX_STL := none
85include $(LOCAL_PATH)/crypto-sources.mk
86include $(BUILD_HOST_SHARED_LIBRARY)
87
88
89## libssl
90
91# Target static library
92include $(CLEAR_VARS)
93LOCAL_MODULE_TAGS := optional
94LOCAL_MODULE := libssl_static
95LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
96LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/ssl-sources.mk
97LOCAL_SDK_VERSION := 9
98LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
99include $(LOCAL_PATH)/ssl-sources.mk
100include $(BUILD_STATIC_LIBRARY)
101
102# Target shared library
103include $(CLEAR_VARS)
104LOCAL_MODULE_TAGS := optional
105LOCAL_MODULE := libssl
106LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
107LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/ssl-sources.mk
108LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
109LOCAL_SHARED_LIBRARIES=libcrypto
110LOCAL_SDK_VERSION := 9
111include $(LOCAL_PATH)/ssl-sources.mk
112include $(BUILD_SHARED_LIBRARY)
113
114# Host static library
115include $(CLEAR_VARS)
116LOCAL_MODULE_TAGS := optional
117LOCAL_MODULE := libssl_static-host
118LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
119LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/ssl-sources.mk
120LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
121LOCAL_CXX_STL := none
122# TODO: b/26097626. ASAN breaks use of this library in JVM.
123# Re-enable sanitization when the issue with making clients of this library
124# preload ASAN runtime is resolved. Without that, clients are getting runtime
125# errors due to unresoled ASAN symbols, such as
126# __asan_option_detect_stack_use_after_return.
127LOCAL_SANITIZE := never
128include $(LOCAL_PATH)/ssl-sources.mk
129include $(BUILD_HOST_STATIC_LIBRARY)
130
131# Host static tool (for linux only).
132ifeq ($(HOST_OS), linux)
133include $(CLEAR_VARS)
134LOCAL_CFLAGS += -Wall -Werror -std=c++0x
135LOCAL_CPP_EXTENSION := cc
136LOCAL_MODULE := bssl
137LOCAL_MODULE_TAGS := optional
138LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/sources.mk
139LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
140LOCAL_SHARED_LIBRARIES=libcrypto-host libssl-host
141# Needed for clock_gettime.
142LOCAL_LDFLAGS := -lrt
143include $(LOCAL_PATH)/sources.mk
144LOCAL_SRC_FILES = $(tool_sources)
145include $(BUILD_HOST_EXECUTABLE)
146endif  # HOST_OS == linux
147
148# Host shared library
149include $(CLEAR_VARS)
150LOCAL_MODULE_TAGS := optional
151LOCAL_MODULE := libssl-host
152LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
153LOCAL_MULTILIB := both
154LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/ssl-sources.mk
155LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
156LOCAL_CXX_STL := none
157LOCAL_SHARED_LIBRARIES += libcrypto-host
158include $(LOCAL_PATH)/ssl-sources.mk
159include $(BUILD_HOST_SHARED_LIBRARY)
160