Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 1 | # -*- mode: makefile -*- |
| 2 | # Copyright (C) 2013 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | # |
| 17 | # Definitions for building the Conscrypt Java library, native code, |
| 18 | # and associated tests. |
| 19 | # |
| 20 | |
| 21 | # |
| 22 | # Common definitions for host and target. |
| 23 | # |
| 24 | |
| 25 | # Conscrypt is divided into modules. |
| 26 | # |
| 27 | # The structure is: |
| 28 | # |
| 29 | # src/ |
| 30 | # main/ # To be shipped on every device. |
| 31 | # java/ # Java source for library code. |
| 32 | # native/ # C++ source for library code. |
| 33 | # resources/ # Support files. |
| 34 | # test/ # Built only on demand, for testing. |
| 35 | # java/ # Java source for tests. |
| 36 | # native/ # C++ source for tests (rare). |
| 37 | # resources/ # Support files. |
| 38 | # |
| 39 | # All subdirectories are optional (hence the "2> /dev/null"s below). |
| 40 | |
| 41 | LOCAL_PATH := $(call my-dir) |
| 42 | |
| 43 | local_javac_flags=-encoding UTF-8 |
| 44 | #local_javac_flags+=-Xlint:all -Xlint:-serial,-deprecation,-unchecked |
| 45 | local_javac_flags+=-Xmaxwarns 9999999 |
| 46 | |
| 47 | core_cflags := -Wall -Wextra -Werror |
| 48 | core_cppflags := -std=gnu++11 |
| 49 | |
| 50 | # |
| 51 | # Build for the target (device). |
| 52 | # |
| 53 | |
Kenny Root | 1cfba2b | 2014-05-27 18:44:53 +0000 | [diff] [blame] | 54 | # Create the conscrypt library |
| 55 | include $(CLEAR_VARS) |
| 56 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
Kenny Root | 39deada | 2014-05-30 13:15:27 -0700 | [diff] [blame] | 57 | LOCAL_SRC_FILES += $(call all-java-files-under,src/platform/java) |
Brian Carlstrom | ecd29ab | 2014-06-18 15:11:01 -0700 | [diff] [blame] | 58 | LOCAL_JAVA_LIBRARIES := core-libart |
Kenny Root | 1cfba2b | 2014-05-27 18:44:53 +0000 | [diff] [blame] | 59 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 60 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 61 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| 62 | LOCAL_MODULE_TAGS := optional |
| 63 | LOCAL_MODULE := conscrypt |
| 64 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 65 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 66 | include $(BUILD_JAVA_LIBRARY) |
| 67 | |
| 68 | # Create the conscrypt library without jarjar for tests |
| 69 | include $(CLEAR_VARS) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 70 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
Kenny Root | 39deada | 2014-05-30 13:15:27 -0700 | [diff] [blame] | 71 | LOCAL_SRC_FILES += $(call all-java-files-under,src/platform/java) |
Brian Carlstrom | ecd29ab | 2014-06-18 15:11:01 -0700 | [diff] [blame] | 72 | LOCAL_JAVA_LIBRARIES := core-libart |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 73 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 74 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 75 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 76 | LOCAL_MODULE := conscrypt-nojarjar |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 77 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 78 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 79 | |
| 80 | ifeq ($(LIBCORE_SKIP_TESTS),) |
| 81 | # Make the conscrypt-tests library. |
| 82 | include $(CLEAR_VARS) |
| 83 | LOCAL_SRC_FILES := $(call all-java-files-under,src/test/java) |
| 84 | LOCAL_NO_STANDARD_LIBRARIES := true |
Brian Carlstrom | ecd29ab | 2014-06-18 15:11:01 -0700 | [diff] [blame] | 85 | LOCAL_JAVA_LIBRARIES := core-libart core-junit bouncycastle |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 86 | LOCAL_STATIC_JAVA_LIBRARIES := core-tests-support conscrypt-nojarjar |
| 87 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 88 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 89 | LOCAL_MODULE := conscrypt-tests |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 90 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 91 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| 92 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 93 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 94 | endif |
| 95 | |
| 96 | # Platform conscrypt crypto JNI library |
| 97 | include $(CLEAR_VARS) |
| 98 | LOCAL_CFLAGS += $(core_cflags) |
| 99 | LOCAL_CFLAGS += -DJNI_JARJAR_PREFIX="com/android/" |
| 100 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 101 | LOCAL_SRC_FILES := \ |
| 102 | src/main/native/org_conscrypt_NativeCrypto.cpp |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 103 | LOCAL_C_INCLUDES += \ |
| 104 | external/openssl/include \ |
Kenny Root | f24ba06 | 2014-06-09 10:37:46 -0700 | [diff] [blame] | 105 | external/openssl \ |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 106 | libcore/include \ |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 107 | libcore/luni/src/main/native |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 108 | LOCAL_SHARED_LIBRARIES := libcrypto libjavacore liblog libnativehelper libssl libz |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 109 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 110 | LOCAL_MODULE := libjavacrypto |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 111 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 112 | include $(BUILD_SHARED_LIBRARY) |
| 113 | |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 114 | # Unbundled Conscrypt jar |
| 115 | include $(CLEAR_VARS) |
Kenny Root | 39deada | 2014-05-30 13:15:27 -0700 | [diff] [blame] | 116 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 117 | LOCAL_SRC_FILES += $(call all-java-files-under,src/compat/java) |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 118 | LOCAL_SDK_VERSION := 9 |
| 119 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 120 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 031510f | 2014-05-29 13:53:05 -0700 | [diff] [blame] | 121 | LOCAL_MODULE := conscrypt_unbundled |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 122 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 123 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 124 | |
| 125 | # Unbundled Conscrypt crypto JNI library |
| 126 | include $(CLEAR_VARS) |
| 127 | LOCAL_CFLAGS += $(core_cflags) |
| 128 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 129 | LOCAL_SRC_FILES := \ |
| 130 | src/main/native/org_conscrypt_NativeCrypto.cpp \ |
Kenny Root | f24ba06 | 2014-06-09 10:37:46 -0700 | [diff] [blame] | 131 | src/compat/native/JNIHelp.cpp |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 132 | LOCAL_C_INCLUDES += \ |
| 133 | external/openssl/include \ |
Kenny Root | f24ba06 | 2014-06-09 10:37:46 -0700 | [diff] [blame] | 134 | external/openssl \ |
| 135 | external/conscrypt/src/compat/native |
Kenny Root | 031510f | 2014-05-29 13:53:05 -0700 | [diff] [blame] | 136 | LOCAL_LDFLAGS := -llog -lz -ldl |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 137 | LOCAL_STATIC_LIBRARIES := libssl_static libcrypto_static |
| 138 | LOCAL_MODULE_TAGS := optional |
| 139 | LOCAL_MODULE := libconscrypt_jni |
| 140 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 141 | LOCAL_SDK_VERSION := 9 |
| 142 | include $(BUILD_SHARED_LIBRARY) |
| 143 | |
Justin Morey | e66dbe5 | 2014-06-10 14:35:13 -0500 | [diff] [blame] | 144 | # Static unbundled Conscrypt crypto JNI library |
| 145 | include $(CLEAR_VARS) |
| 146 | LOCAL_CFLAGS += $(core_cflags) |
| 147 | LOCAL_CPPFLAGS += $(core_cppflags) -DJNI_JARJAR_PREFIX="com/google/android/gms/" -DCONSCRYPT_UNBUNDLED -DSTATIC_LIB |
| 148 | LOCAL_SRC_FILES := \ |
| 149 | src/main/native/org_conscrypt_NativeCrypto.cpp \ |
| 150 | src/compat/native/JNIHelp.cpp |
| 151 | LOCAL_C_INCLUDES += \ |
| 152 | external/openssl/include \ |
| 153 | external/openssl \ |
| 154 | external/conscrypt/src/compat/native |
| 155 | LOCAL_MODULE_TAGS := optional |
| 156 | LOCAL_MODULE := libconscrypt_static |
| 157 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 158 | LOCAL_SDK_VERSION := 9 |
| 159 | include $(BUILD_STATIC_LIBRARY) |
| 160 | |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 161 | # |
| 162 | # Build for the host. |
| 163 | # |
| 164 | |
Ian Rogers | 3a03c73 | 2014-05-23 11:53:18 -0700 | [diff] [blame] | 165 | # Make the conscrypt-hostdex library |
| 166 | include $(CLEAR_VARS) |
| 167 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 168 | LOCAL_SRC_FILES += $(call all-java-files-under,src/platform/java) |
| 169 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 170 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| 171 | LOCAL_MODULE_TAGS := optional |
| 172 | LOCAL_MODULE := conscrypt-hostdex |
| 173 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 174 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 175 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Kenny Root | 1cfba2b | 2014-05-27 18:44:53 +0000 | [diff] [blame] | 176 | |
Ian Rogers | 3a03c73 | 2014-05-23 11:53:18 -0700 | [diff] [blame] | 177 | # Make the conscrypt-hostdex-nojarjar for tests |
| 178 | include $(CLEAR_VARS) |
| 179 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 180 | LOCAL_SRC_FILES += $(call all-java-files-under,src/platform/java) |
| 181 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 182 | LOCAL_BUILD_HOST_DEX := true |
| 183 | LOCAL_MODULE_TAGS := optional |
| 184 | LOCAL_MODULE := conscrypt-hostdex-nojarjar |
| 185 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 186 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 187 | |
Ian Rogers | 3a03c73 | 2014-05-23 11:53:18 -0700 | [diff] [blame] | 188 | # Make the conscrypt-tests library. |
| 189 | ifeq ($(LIBCORE_SKIP_TESTS),) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 190 | include $(CLEAR_VARS) |
| 191 | LOCAL_SRC_FILES := $(call all-java-files-under,src/test/java) |
Narayan Kamath | b32d679 | 2013-10-28 14:22:43 +0000 | [diff] [blame] | 192 | LOCAL_JAVA_LIBRARIES := bouncycastle-hostdex core-junit-hostdex core-tests-support-hostdex conscrypt-hostdex-nojarjar |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 193 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 194 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 195 | LOCAL_MODULE := conscrypt-tests-hostdex |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 196 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 197 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Narayan Kamath | b32d679 | 2013-10-28 14:22:43 +0000 | [diff] [blame] | 198 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Ian Rogers | 3a03c73 | 2014-05-23 11:53:18 -0700 | [diff] [blame] | 199 | endif |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 200 | |
Ian Rogers | 3a03c73 | 2014-05-23 11:53:18 -0700 | [diff] [blame] | 201 | # Conscrypt native library for host |
| 202 | include $(CLEAR_VARS) |
| 203 | LOCAL_CLANG := true |
| 204 | LOCAL_SRC_FILES += \ |
| 205 | src/main/native/org_conscrypt_NativeCrypto.cpp |
| 206 | LOCAL_C_INCLUDES += \ |
| 207 | external/openssl/include \ |
Kenny Root | f24ba06 | 2014-06-09 10:37:46 -0700 | [diff] [blame] | 208 | external/openssl \ |
Ian Rogers | 3a03c73 | 2014-05-23 11:53:18 -0700 | [diff] [blame] | 209 | libcore/include \ |
| 210 | libcore/luni/src/main/native |
| 211 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 212 | LOCAL_LDLIBS += -lpthread |
| 213 | LOCAL_MODULE_TAGS := optional |
| 214 | LOCAL_MODULE := libjavacrypto |
| 215 | LOCAL_CFLAGS += -DJNI_JARJAR_PREFIX="com/android/" |
| 216 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 217 | LOCAL_SHARED_LIBRARIES := libcrypto-host libjavacore liblog libnativehelper libssl-host |
| 218 | include $(BUILD_HOST_SHARED_LIBRARY) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 219 | |
Ian Rogers | 3a03c73 | 2014-05-23 11:53:18 -0700 | [diff] [blame] | 220 | # Conscrypt native library for nojarjar'd version |
| 221 | # Don't build this for unbundled conscrypt build |
| 222 | ifeq (,$(TARGET_BUILD_APPS)) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 223 | include $(CLEAR_VARS) |
Ian Rogers | 3a03c73 | 2014-05-23 11:53:18 -0700 | [diff] [blame] | 224 | LOCAL_CLANG := true |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 225 | LOCAL_SRC_FILES += \ |
| 226 | src/main/native/org_conscrypt_NativeCrypto.cpp |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 227 | LOCAL_C_INCLUDES += \ |
| 228 | external/openssl/include \ |
Kenny Root | f24ba06 | 2014-06-09 10:37:46 -0700 | [diff] [blame] | 229 | external/openssl \ |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 230 | libcore/include \ |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 231 | libcore/luni/src/main/native |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 232 | LOCAL_CPPFLAGS += $(core_cppflags) -DCONSCRYPT_NOT_UNBUNDLED |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 233 | LOCAL_LDLIBS += -lpthread |
| 234 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 235 | LOCAL_MODULE := libconscrypt_jni |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 236 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Kenny Root | 7150e32 | 2013-10-01 19:54:34 -0700 | [diff] [blame] | 237 | LOCAL_SHARED_LIBRARIES := libcrypto-host libjavacore liblog libnativehelper libssl-host |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 238 | include $(BUILD_HOST_SHARED_LIBRARY) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 239 | endif |