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