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) |
Kenny Root | 1cfba2b | 2014-05-27 18:44:53 +0000 | [diff] [blame] | 58 | LOCAL_JAVA_LIBRARIES := core |
| 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) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 72 | LOCAL_JAVA_LIBRARIES := core |
| 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 |
| 85 | LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit |
| 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 \ |
| 105 | libcore/include \ |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 106 | libcore/luni/src/main/native |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 107 | LOCAL_SHARED_LIBRARIES := libcrypto libjavacore liblog libnativehelper libssl libz |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 108 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 109 | LOCAL_MODULE := libjavacrypto |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 110 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 111 | include $(BUILD_SHARED_LIBRARY) |
| 112 | |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 113 | # Unbundled Conscrypt jar |
| 114 | include $(CLEAR_VARS) |
Kenny Root | 39deada | 2014-05-30 13:15:27 -0700 | [diff] [blame^] | 115 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| 116 | LOCAL_SRC_FILES += $(call all-java-files-under,src/compat/java) |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 117 | LOCAL_SDK_VERSION := 9 |
| 118 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 119 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 031510f | 2014-05-29 13:53:05 -0700 | [diff] [blame] | 120 | LOCAL_MODULE := conscrypt_unbundled |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 121 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 122 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 123 | |
| 124 | # Unbundled Conscrypt crypto JNI library |
| 125 | include $(CLEAR_VARS) |
| 126 | LOCAL_CFLAGS += $(core_cflags) |
| 127 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 128 | LOCAL_SRC_FILES := \ |
| 129 | src/main/native/org_conscrypt_NativeCrypto.cpp \ |
| 130 | src/compat/native/JNIHelp.cpp |
| 131 | LOCAL_C_INCLUDES += \ |
| 132 | external/openssl/include \ |
| 133 | external/conscrypt/src/compat/native |
Kenny Root | 031510f | 2014-05-29 13:53:05 -0700 | [diff] [blame] | 134 | LOCAL_LDFLAGS := -llog -lz -ldl |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 135 | LOCAL_STATIC_LIBRARIES := libssl_static libcrypto_static |
| 136 | LOCAL_MODULE_TAGS := optional |
| 137 | LOCAL_MODULE := libconscrypt_jni |
| 138 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 139 | LOCAL_SDK_VERSION := 9 |
| 140 | include $(BUILD_SHARED_LIBRARY) |
| 141 | |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 142 | # |
| 143 | # Build for the host. |
| 144 | # |
| 145 | |
| 146 | ifeq ($(WITH_HOST_DALVIK),true) |
Kenny Root | 1cfba2b | 2014-05-27 18:44:53 +0000 | [diff] [blame] | 147 | # Make the conscrypt-hostdex library |
| 148 | include $(CLEAR_VARS) |
| 149 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
Kenny Root | 39deada | 2014-05-30 13:15:27 -0700 | [diff] [blame^] | 150 | LOCAL_SRC_FILES += $(call all-java-files-under,src/platform/java) |
Kenny Root | 1cfba2b | 2014-05-27 18:44:53 +0000 | [diff] [blame] | 151 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 152 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| 153 | LOCAL_MODULE_TAGS := optional |
| 154 | LOCAL_MODULE := conscrypt-hostdex |
| 155 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 156 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 157 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
| 158 | |
| 159 | # Make the conscrypt-hostdex-nojarjar for tests |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 160 | include $(CLEAR_VARS) |
| 161 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
Kenny Root | 39deada | 2014-05-30 13:15:27 -0700 | [diff] [blame^] | 162 | LOCAL_SRC_FILES += $(call all-java-files-under,src/platform/java) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 163 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 164 | LOCAL_BUILD_HOST_DEX := true |
| 165 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 166 | LOCAL_MODULE := conscrypt-hostdex-nojarjar |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 167 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Narayan Kamath | b32d679 | 2013-10-28 14:22:43 +0000 | [diff] [blame] | 168 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 169 | |
| 170 | # Make the conscrypt-tests library. |
| 171 | ifeq ($(LIBCORE_SKIP_TESTS),) |
| 172 | include $(CLEAR_VARS) |
| 173 | LOCAL_SRC_FILES := $(call all-java-files-under,src/test/java) |
Narayan Kamath | b32d679 | 2013-10-28 14:22:43 +0000 | [diff] [blame] | 174 | 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] | 175 | LOCAL_JAVACFLAGS := $(local_javac_flags) |
| 176 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 177 | LOCAL_MODULE := conscrypt-tests-hostdex |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 178 | LOCAL_REQUIRED_MODULES := libjavacrypto |
| 179 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Narayan Kamath | b32d679 | 2013-10-28 14:22:43 +0000 | [diff] [blame] | 180 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 181 | endif |
| 182 | |
| 183 | # Conscrypt native library for host |
| 184 | include $(CLEAR_VARS) |
| 185 | LOCAL_SRC_FILES += \ |
| 186 | src/main/native/org_conscrypt_NativeCrypto.cpp |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 187 | LOCAL_C_INCLUDES += \ |
| 188 | external/openssl/include \ |
| 189 | libcore/include \ |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 190 | libcore/luni/src/main/native |
| 191 | LOCAL_CPPFLAGS += $(core_cppflags) |
| 192 | LOCAL_LDLIBS += -lpthread |
| 193 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 194 | LOCAL_MODULE := libjavacrypto |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 195 | LOCAL_CFLAGS += -DJNI_JARJAR_PREFIX="com/android/" |
| 196 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 197 | LOCAL_SHARED_LIBRARIES := libcrypto-host libjavacore liblog libnativehelper libssl-host |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 198 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 199 | |
| 200 | # Conscrypt native library for nojarjar'd version |
Kenny Root | 4ccb72f | 2014-05-30 11:27:32 -0700 | [diff] [blame] | 201 | # Don't build this for unbundled conscrypt build |
| 202 | ifeq (,$(TARGET_BUILD_APPS)) |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 203 | include $(CLEAR_VARS) |
| 204 | LOCAL_SRC_FILES += \ |
| 205 | src/main/native/org_conscrypt_NativeCrypto.cpp |
Kenny Root | 0a84a21 | 2013-10-01 17:48:03 -0700 | [diff] [blame] | 206 | LOCAL_C_INCLUDES += \ |
| 207 | external/openssl/include \ |
| 208 | libcore/include \ |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 209 | libcore/luni/src/main/native |
Kenny Root | 3e46e4e | 2014-05-23 13:35:10 -0700 | [diff] [blame] | 210 | LOCAL_CPPFLAGS += $(core_cppflags) -DCONSCRYPT_NOT_UNBUNDLED |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 211 | LOCAL_LDLIBS += -lpthread |
| 212 | LOCAL_MODULE_TAGS := optional |
Kenny Root | 92b12a8 | 2013-10-02 16:44:41 -0700 | [diff] [blame] | 213 | LOCAL_MODULE := libconscrypt_jni |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 214 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Kenny Root | 7150e32 | 2013-10-01 19:54:34 -0700 | [diff] [blame] | 215 | LOCAL_SHARED_LIBRARIES := libcrypto-host libjavacore liblog libnativehelper libssl-host |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 216 | include $(BUILD_HOST_SHARED_LIBRARY) |
Kenny Root | 4ccb72f | 2014-05-30 11:27:32 -0700 | [diff] [blame] | 217 | endif |
Kenny Root | 0e27f2a | 2013-09-16 13:58:19 -0700 | [diff] [blame] | 218 | endif |