David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 1 | # |
David Zeuthen | c612e2e | 2016-09-16 16:44:08 -0400 | [diff] [blame] | 2 | # Copyright 2016, The Android Open Source Project |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 3 | # |
David Zeuthen | c612e2e | 2016-09-16 16:44:08 -0400 | [diff] [blame] | 4 | # Permission is hereby granted, free of charge, to any person |
| 5 | # obtaining a copy of this software and associated documentation |
| 6 | # files (the "Software"), to deal in the Software without |
| 7 | # restriction, including without limitation the rights to use, copy, |
| 8 | # modify, merge, publish, distribute, sublicense, and/or sell copies |
| 9 | # of the Software, and to permit persons to whom the Software is |
| 10 | # furnished to do so, subject to the following conditions: |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 11 | # |
David Zeuthen | c612e2e | 2016-09-16 16:44:08 -0400 | [diff] [blame] | 12 | # The above copyright notice and this permission notice shall be |
| 13 | # included in all copies or substantial portions of the Software. |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 14 | # |
David Zeuthen | c612e2e | 2016-09-16 16:44:08 -0400 | [diff] [blame] | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 19 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 20 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 21 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | # SOFTWARE. |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 23 | # |
| 24 | |
| 25 | LOCAL_PATH := $(my-dir) |
| 26 | |
| 27 | avb_common_cflags := \ |
| 28 | -D_FILE_OFFSET_BITS=64 \ |
| 29 | -D_POSIX_C_SOURCE=199309L \ |
| 30 | -Wa,--noexecstack \ |
| 31 | -Werror \ |
| 32 | -Wall \ |
| 33 | -Wextra \ |
| 34 | -Wformat=2 \ |
| 35 | -Wno-psabi \ |
| 36 | -Wno-unused-parameter \ |
| 37 | -ffunction-sections \ |
David Zeuthen | 0f7de94 | 2017-03-08 13:23:55 -0500 | [diff] [blame] | 38 | -fstack-protector-strong \ |
| 39 | -g |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 40 | avb_common_cppflags := \ |
| 41 | -Wnon-virtual-dtor \ |
| 42 | -fno-strict-aliasing |
| 43 | avb_common_ldflags := \ |
David Zeuthen | 0f7de94 | 2017-03-08 13:23:55 -0500 | [diff] [blame] | 44 | -Wl,--gc-sections \ |
| 45 | -rdynamic |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 46 | |
David Zeuthen | 3a58015 | 2017-04-12 15:50:47 -0400 | [diff] [blame] | 47 | # The sources that make up libavb (excluding sysdeps). |
| 48 | libavb_sources := \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 49 | libavb/avb_chain_partition_descriptor.c \ |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 50 | libavb/avb_crc32.c \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 51 | libavb/avb_crypto.c \ |
| 52 | libavb/avb_descriptor.c \ |
| 53 | libavb/avb_footer.c \ |
| 54 | libavb/avb_hash_descriptor.c \ |
| 55 | libavb/avb_hashtree_descriptor.c \ |
| 56 | libavb/avb_kernel_cmdline_descriptor.c \ |
| 57 | libavb/avb_property_descriptor.c \ |
| 58 | libavb/avb_rsa.c \ |
| 59 | libavb/avb_sha256.c \ |
| 60 | libavb/avb_sha512.c \ |
| 61 | libavb/avb_slot_verify.c \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 62 | libavb/avb_util.c \ |
David Zeuthen | e3cadca | 2017-02-22 21:25:46 -0500 | [diff] [blame] | 63 | libavb/avb_vbmeta_image.c \ |
| 64 | libavb/avb_version.c |
David Zeuthen | 3a58015 | 2017-04-12 15:50:47 -0400 | [diff] [blame] | 65 | |
| 66 | include $(CLEAR_VARS) |
| 67 | LOCAL_SRC_FILES := avbtool |
| 68 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 69 | LOCAL_REQUIRED_MODULES := fec |
| 70 | LOCAL_IS_HOST_MODULE := true |
| 71 | LOCAL_MODULE := avbtool |
| 72 | include $(BUILD_PREBUILT) |
| 73 | |
| 74 | # Build libavb for the target - this is a static library that depends |
| 75 | # on only libc and doesn't drag in any other dependencies. |
| 76 | include $(CLEAR_VARS) |
| 77 | LOCAL_MODULE := libavb |
| 78 | LOCAL_MODULE_HOST_OS := linux |
| 79 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 80 | LOCAL_CLANG := true |
| 81 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 82 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 83 | LOCAL_SRC_FILES := \ |
| 84 | $(libavb_sources) \ |
| 85 | libavb/avb_sysdeps_posix.c |
| 86 | include $(BUILD_STATIC_LIBRARY) |
| 87 | |
| 88 | # Build libavb_user for the target - in addition to libavb, it |
| 89 | # includes libavb_ab, libavb_user and also depends on libbase and |
| 90 | # libfs_mgr. |
| 91 | include $(CLEAR_VARS) |
| 92 | LOCAL_MODULE := libavb_user |
| 93 | LOCAL_MODULE_HOST_OS := linux |
| 94 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 95 | LOCAL_CLANG := true |
| 96 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 97 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 98 | LOCAL_SHARED_LIBRARIES := \ |
| 99 | libbase |
| 100 | LOCAL_STATIC_LIBRARIES := \ |
| 101 | libfs_mgr |
| 102 | LOCAL_SRC_FILES := \ |
| 103 | $(libavb_sources) \ |
| 104 | libavb/avb_sysdeps_posix.c \ |
| 105 | libavb_ab/avb_ab_flow.c \ |
| 106 | libavb_user/avb_ops_user.c \ |
| 107 | libavb_user/avb_user_verity.c |
bowgotsai | af004a8 | 2016-10-24 17:10:45 +0800 | [diff] [blame] | 108 | include $(BUILD_STATIC_LIBRARY) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 109 | |
David Zeuthen | 86fd178 | 2017-03-28 15:37:55 -0400 | [diff] [blame] | 110 | # Build avbctl for the target. |
| 111 | include $(CLEAR_VARS) |
| 112 | LOCAL_MODULE := avbctl |
| 113 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 114 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 115 | LOCAL_CPP_EXTENSION := .cc |
| 116 | LOCAL_CLANG := true |
| 117 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_COMPILATION -DAVB_ENABLE_DEBUG |
| 118 | LOCAL_CPPFLAGS := $(avb_common_cppflags) |
| 119 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 120 | LOCAL_STATIC_LIBRARIES := \ |
David Zeuthen | 3a58015 | 2017-04-12 15:50:47 -0400 | [diff] [blame] | 121 | libavb_user \ |
David Zeuthen | 86fd178 | 2017-03-28 15:37:55 -0400 | [diff] [blame] | 122 | libfs_mgr |
| 123 | LOCAL_SHARED_LIBRARIES := \ |
David Zeuthen | 3a58015 | 2017-04-12 15:50:47 -0400 | [diff] [blame] | 124 | libbase |
David Zeuthen | 86fd178 | 2017-03-28 15:37:55 -0400 | [diff] [blame] | 125 | LOCAL_SRC_FILES := \ |
David Zeuthen | 86fd178 | 2017-03-28 15:37:55 -0400 | [diff] [blame] | 126 | tools/avbctl/avbctl.cc |
| 127 | include $(BUILD_EXECUTABLE) |
| 128 | |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 129 | # Build libavb for the host (for unit tests). |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 130 | include $(CLEAR_VARS) |
| 131 | LOCAL_MODULE := libavb_host |
| 132 | LOCAL_MODULE_HOST_OS := linux |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 133 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 134 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 135 | LOCAL_CLANG := true |
| 136 | LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 137 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 138 | LOCAL_SRC_FILES := \ |
David Zeuthen | 3a58015 | 2017-04-12 15:50:47 -0400 | [diff] [blame] | 139 | $(libavb_sources) \ |
David Zeuthen | e3cadca | 2017-02-22 21:25:46 -0500 | [diff] [blame] | 140 | libavb/avb_version.c |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 141 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 142 | |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 143 | # Build libavb_ab for the host (for unit tests). |
| 144 | include $(CLEAR_VARS) |
| 145 | LOCAL_MODULE := libavb_ab_host |
| 146 | LOCAL_REQUIRED_MODULES := libavb_host |
| 147 | LOCAL_MODULE_HOST_OS := linux |
| 148 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 149 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 150 | LOCAL_CLANG := true |
| 151 | LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 152 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 153 | LOCAL_SRC_FILES := \ |
| 154 | libavb_ab/avb_ab_flow.c |
| 155 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 156 | |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 157 | # Build libavb_atx for the host (for unit tests). |
| 158 | include $(CLEAR_VARS) |
| 159 | LOCAL_MODULE := libavb_atx_host |
| 160 | LOCAL_REQUIRED_MODULES := libavb_host |
| 161 | LOCAL_MODULE_HOST_OS := linux |
| 162 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 163 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 164 | LOCAL_CLANG := true |
| 165 | LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 166 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 167 | LOCAL_SRC_FILES := \ |
| 168 | libavb_atx/avb_atx_validate.c |
| 169 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 170 | |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 171 | include $(CLEAR_VARS) |
| 172 | LOCAL_MODULE := libavb_host_sysdeps |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 173 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 174 | LOCAL_MODULE_HOST_OS := linux |
| 175 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 176 | LOCAL_CLANG := true |
| 177 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 178 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 179 | LOCAL_SRC_FILES := \ |
| 180 | libavb/avb_sysdeps_posix.c |
| 181 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 182 | |
| 183 | include $(CLEAR_VARS) |
| 184 | LOCAL_MODULE := libavb_host_unittest |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 185 | LOCAL_REQUIRED_MODULES := simg2img img2simg avbtool |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 186 | LOCAL_MODULE_HOST_OS := linux |
| 187 | LOCAL_CPP_EXTENSION := .cc |
| 188 | LOCAL_CLANG := true |
| 189 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 190 | LOCAL_CPPFLAGS := $(avb_common_cppflags) |
| 191 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 192 | LOCAL_STATIC_LIBRARIES := \ |
| 193 | libavb_host \ |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 194 | libavb_ab_host \ |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 195 | libavb_atx_host \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 196 | libgmock_host \ |
| 197 | libgtest_host |
| 198 | LOCAL_SHARED_LIBRARIES := \ |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 199 | libchrome \ |
Jocelyn Bohr | 1bb0e3b | 2017-01-20 13:55:51 -0800 | [diff] [blame] | 200 | libcrypto |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 201 | LOCAL_SRC_FILES := \ |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 202 | test/avb_ab_flow_unittest.cc \ |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 203 | test/avb_atx_validate_unittest.cc \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 204 | test/avb_slot_verify_unittest.cc \ |
David Zeuthen | 8681a33 | 2016-11-23 13:44:06 -0500 | [diff] [blame] | 205 | test/avb_unittest_util.cc \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 206 | test/avb_util_unittest.cc \ |
| 207 | test/avb_vbmeta_image_unittest.cc \ |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 208 | test/avbtool_unittest.cc \ |
David Zeuthen | 0f7de94 | 2017-03-08 13:23:55 -0500 | [diff] [blame] | 209 | test/fake_avb_ops.cc \ |
| 210 | test/avb_sysdeps_posix_testing.cc |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 211 | LOCAL_LDLIBS_linux := -lrt |
| 212 | include $(BUILD_HOST_NATIVE_TEST) |
| 213 | |
| 214 | include $(CLEAR_VARS) |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 215 | LOCAL_MODULE := libavb_host_user_code_test |
| 216 | LOCAL_MODULE_HOST_OS := linux |
| 217 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 218 | LOCAL_CPP_EXTENSION := .cc |
| 219 | LOCAL_CLANG := true |
| 220 | LOCAL_CFLAGS := $(avb_common_cflags) |
| 221 | LOCAL_CPPFLAGS := $(avb_common_cppflags) |
| 222 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 223 | LOCAL_SRC_FILES := test/user_code_test.cc |
| 224 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 225 | |
| 226 | include $(CLEAR_VARS) |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 227 | LOCAL_MODULE := bootctrl.avb |
| 228 | LOCAL_MODULE_RELATIVE_PATH := hw |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 229 | LOCAL_SRC_FILES := \ |
David Zeuthen | 86fd178 | 2017-03-28 15:37:55 -0400 | [diff] [blame] | 230 | boot_control/boot_control_avb.c |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 231 | LOCAL_CLANG := true |
| 232 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_COMPILATION |
| 233 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
David Zeuthen | 3a58015 | 2017-04-12 15:50:47 -0400 | [diff] [blame] | 234 | LOCAL_SHARED_LIBRARIES := \ |
| 235 | libbase \ |
| 236 | libcutils |
| 237 | LOCAL_STATIC_LIBRARIES := \ |
| 238 | libavb_user \ |
| 239 | libfs_mgr |
David Zeuthen | b0013ae | 2016-10-20 17:00:49 -0400 | [diff] [blame] | 240 | LOCAL_POST_INSTALL_CMD := \ |
| 241 | $(hide) mkdir -p $(TARGET_OUT_SHARED_LIBRARIES)/hw && \ |
| 242 | ln -sf bootctrl.avb.so $(TARGET_OUT_SHARED_LIBRARIES)/hw/bootctrl.default.so |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 243 | include $(BUILD_SHARED_LIBRARY) |
| 244 | |
| 245 | include $(CLEAR_VARS) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 246 | LOCAL_SRC_FILES := libavb_host_symbols_test |
| 247 | LOCAL_MODULE_TAGS := debug |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 248 | LOCAL_ADDITIONAL_DEPENDENCIES := libavb_ab_host |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 249 | include $(BUILD_HOST_PREBUILT) |