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 | |
| 47 | include $(CLEAR_VARS) |
| 48 | LOCAL_SRC_FILES := avbtool |
| 49 | LOCAL_MODULE_CLASS := EXECUTABLES |
David Zeuthen | 0b7f1d3 | 2016-10-25 17:53:49 -0400 | [diff] [blame] | 50 | LOCAL_REQUIRED_MODULES := fec |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 51 | LOCAL_IS_HOST_MODULE := true |
| 52 | LOCAL_MODULE := avbtool |
| 53 | include $(BUILD_PREBUILT) |
| 54 | |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 55 | # Build libavb for the target (for e.g. fs_mgr usage). |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 56 | include $(CLEAR_VARS) |
| 57 | LOCAL_MODULE := libavb |
| 58 | LOCAL_MODULE_HOST_OS := linux |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 59 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 60 | LOCAL_CLANG := true |
David Zeuthen | 1eb74c9 | 2016-10-03 16:47:38 -0400 | [diff] [blame] | 61 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 62 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 63 | LOCAL_SRC_FILES := \ |
| 64 | libavb/avb_chain_partition_descriptor.c \ |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 65 | libavb/avb_crc32.c \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 66 | libavb/avb_crypto.c \ |
| 67 | libavb/avb_descriptor.c \ |
| 68 | libavb/avb_footer.c \ |
| 69 | libavb/avb_hash_descriptor.c \ |
| 70 | libavb/avb_hashtree_descriptor.c \ |
| 71 | libavb/avb_kernel_cmdline_descriptor.c \ |
| 72 | libavb/avb_property_descriptor.c \ |
| 73 | libavb/avb_rsa.c \ |
| 74 | libavb/avb_sha256.c \ |
| 75 | libavb/avb_sha512.c \ |
| 76 | libavb/avb_slot_verify.c \ |
| 77 | libavb/avb_sysdeps_posix.c \ |
| 78 | libavb/avb_util.c \ |
David Zeuthen | e3cadca | 2017-02-22 21:25:46 -0500 | [diff] [blame] | 79 | libavb/avb_vbmeta_image.c \ |
| 80 | libavb/avb_version.c |
bowgotsai | af004a8 | 2016-10-24 17:10:45 +0800 | [diff] [blame] | 81 | include $(BUILD_STATIC_LIBRARY) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 82 | |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 83 | # Build libavb for the host (for unit tests). |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 84 | include $(CLEAR_VARS) |
| 85 | LOCAL_MODULE := libavb_host |
| 86 | LOCAL_MODULE_HOST_OS := linux |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 87 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 88 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 89 | LOCAL_CLANG := true |
| 90 | LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 91 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 92 | LOCAL_SRC_FILES := \ |
| 93 | libavb/avb_chain_partition_descriptor.c \ |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 94 | libavb/avb_crc32.c \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 95 | libavb/avb_crypto.c \ |
| 96 | libavb/avb_descriptor.c \ |
| 97 | libavb/avb_footer.c \ |
| 98 | libavb/avb_hash_descriptor.c \ |
| 99 | libavb/avb_hashtree_descriptor.c \ |
| 100 | libavb/avb_kernel_cmdline_descriptor.c \ |
| 101 | libavb/avb_property_descriptor.c \ |
| 102 | libavb/avb_rsa.c \ |
| 103 | libavb/avb_sha256.c \ |
| 104 | libavb/avb_sha512.c \ |
| 105 | libavb/avb_slot_verify.c \ |
| 106 | libavb/avb_util.c \ |
David Zeuthen | e3cadca | 2017-02-22 21:25:46 -0500 | [diff] [blame] | 107 | libavb/avb_vbmeta_image.c \ |
| 108 | libavb/avb_version.c |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 109 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 110 | |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 111 | # Build libavb_ab for the host (for unit tests). |
| 112 | include $(CLEAR_VARS) |
| 113 | LOCAL_MODULE := libavb_ab_host |
| 114 | LOCAL_REQUIRED_MODULES := libavb_host |
| 115 | LOCAL_MODULE_HOST_OS := linux |
| 116 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 117 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 118 | LOCAL_CLANG := true |
| 119 | LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 120 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 121 | LOCAL_SRC_FILES := \ |
| 122 | libavb_ab/avb_ab_flow.c |
| 123 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 124 | |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 125 | # Build libavb_atx for the host (for unit tests). |
| 126 | include $(CLEAR_VARS) |
| 127 | LOCAL_MODULE := libavb_atx_host |
| 128 | LOCAL_REQUIRED_MODULES := libavb_host |
| 129 | LOCAL_MODULE_HOST_OS := linux |
| 130 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 131 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 132 | LOCAL_CLANG := true |
| 133 | LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 134 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 135 | LOCAL_SRC_FILES := \ |
| 136 | libavb_atx/avb_atx_validate.c |
| 137 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 138 | |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 139 | include $(CLEAR_VARS) |
| 140 | LOCAL_MODULE := libavb_host_sysdeps |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 141 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 142 | LOCAL_MODULE_HOST_OS := linux |
| 143 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 144 | LOCAL_CLANG := true |
| 145 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 146 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 147 | LOCAL_SRC_FILES := \ |
| 148 | libavb/avb_sysdeps_posix.c |
| 149 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 150 | |
| 151 | include $(CLEAR_VARS) |
| 152 | LOCAL_MODULE := libavb_host_unittest |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 153 | LOCAL_REQUIRED_MODULES := simg2img img2simg avbtool |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 154 | LOCAL_MODULE_HOST_OS := linux |
| 155 | LOCAL_CPP_EXTENSION := .cc |
| 156 | LOCAL_CLANG := true |
| 157 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION |
| 158 | LOCAL_CPPFLAGS := $(avb_common_cppflags) |
| 159 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 160 | LOCAL_STATIC_LIBRARIES := \ |
| 161 | libavb_host \ |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 162 | libavb_ab_host \ |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 163 | libavb_atx_host \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 164 | libgmock_host \ |
| 165 | libgtest_host |
| 166 | LOCAL_SHARED_LIBRARIES := \ |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 167 | libchrome \ |
Jocelyn Bohr | 1bb0e3b | 2017-01-20 13:55:51 -0800 | [diff] [blame] | 168 | libcrypto |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 169 | LOCAL_SRC_FILES := \ |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 170 | test/avb_ab_flow_unittest.cc \ |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 171 | test/avb_atx_validate_unittest.cc \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 172 | test/avb_slot_verify_unittest.cc \ |
David Zeuthen | 8681a33 | 2016-11-23 13:44:06 -0500 | [diff] [blame] | 173 | test/avb_unittest_util.cc \ |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 174 | test/avb_util_unittest.cc \ |
| 175 | test/avb_vbmeta_image_unittest.cc \ |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 176 | test/avbtool_unittest.cc \ |
David Zeuthen | 0f7de94 | 2017-03-08 13:23:55 -0500 | [diff] [blame^] | 177 | test/fake_avb_ops.cc \ |
| 178 | test/avb_sysdeps_posix_testing.cc |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 179 | LOCAL_LDLIBS_linux := -lrt |
| 180 | include $(BUILD_HOST_NATIVE_TEST) |
| 181 | |
| 182 | include $(CLEAR_VARS) |
Darren Krahn | 147b08d | 2016-12-20 16:38:29 -0800 | [diff] [blame] | 183 | LOCAL_MODULE := libavb_host_user_code_test |
| 184 | LOCAL_MODULE_HOST_OS := linux |
| 185 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 186 | LOCAL_CPP_EXTENSION := .cc |
| 187 | LOCAL_CLANG := true |
| 188 | LOCAL_CFLAGS := $(avb_common_cflags) |
| 189 | LOCAL_CPPFLAGS := $(avb_common_cppflags) |
| 190 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
| 191 | LOCAL_SRC_FILES := test/user_code_test.cc |
| 192 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 193 | |
| 194 | include $(CLEAR_VARS) |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 195 | LOCAL_MODULE := bootctrl.avb |
| 196 | LOCAL_MODULE_RELATIVE_PATH := hw |
| 197 | LOCAL_REQUIRED_MODULES := libavb |
| 198 | LOCAL_SRC_FILES := \ |
| 199 | boot_control/boot_control_avb.c \ |
| 200 | boot_control/avb_ops_device.c \ |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 201 | libavb_ab/avb_ab_flow.c \ |
David Zeuthen | 8b6973b | 2016-09-20 12:39:49 -0400 | [diff] [blame] | 202 | libavb/avb_sysdeps_posix.c |
| 203 | LOCAL_CLANG := true |
| 204 | LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_COMPILATION |
| 205 | LOCAL_LDFLAGS := $(avb_common_ldflags) |
bowgotsai | faa5d3a | 2017-01-24 21:35:31 +0800 | [diff] [blame] | 206 | LOCAL_SHARED_LIBRARIES := libbase libcutils |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 207 | LOCAL_STATIC_LIBRARIES := libfs_mgr libavb |
David Zeuthen | b0013ae | 2016-10-20 17:00:49 -0400 | [diff] [blame] | 208 | LOCAL_POST_INSTALL_CMD := \ |
| 209 | $(hide) mkdir -p $(TARGET_OUT_SHARED_LIBRARIES)/hw && \ |
| 210 | 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] | 211 | include $(BUILD_SHARED_LIBRARY) |
| 212 | |
| 213 | include $(CLEAR_VARS) |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 214 | LOCAL_SRC_FILES := libavb_host_symbols_test |
| 215 | LOCAL_MODULE_TAGS := debug |
David Zeuthen | baf59e2 | 2016-11-14 15:39:43 -0500 | [diff] [blame] | 216 | LOCAL_ADDITIONAL_DEPENDENCIES := libavb_ab_host |
David Zeuthen | 21e9526 | 2016-07-27 17:58:40 -0400 | [diff] [blame] | 217 | include $(BUILD_HOST_PREBUILT) |