1# 2# Copyright (C) 2015 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 17LOCAL_PATH := $(my-dir) 18 19# Default values for the USE flags. Override these USE flags from your product 20# by setting BRILLO_USE_* values. Note that we define local variables like 21# local_use_* to prevent leaking our default setting for other packages. 22local_use_binder := $(if $(BRILLO_USE_BINDER),$(BRILLO_USE_BINDER),1) 23local_use_dbus := $(if $(BRILLO_USE_DBUS),$(BRILLO_USE_DBUS),0) 24local_use_hwid_override := \ 25 $(if $(BRILLO_USE_HWID_OVERRIDE),$(BRILLO_USE_HWID_OVERRIDE),0) 26# "libcros" gates the LibCrosService exposed by the Chrome OS' chrome browser to 27# the system layer. 28local_use_libcros := $(if $(BRILLO_USE_LIBCROS),$(BRILLO_USE_LIBCROS),0) 29local_use_mtd := $(if $(BRILLO_USE_MTD),$(BRILLO_USE_MTD),0) 30local_use_power_management := \ 31 $(if $(BRILLO_USE_POWER_MANAGEMENT),$(BRILLO_USE_POWER_MANAGEMENT),0) 32local_use_weave := $(if $(BRILLO_USE_WEAVE),$(BRILLO_USE_WEAVE),0) 33 34ue_common_cflags := \ 35 -DUSE_BINDER=$(local_use_binder) \ 36 -DUSE_DBUS=$(local_use_dbus) \ 37 -DUSE_HWID_OVERRIDE=$(local_use_hwid_override) \ 38 -DUSE_LIBCROS=$(local_use_libcros) \ 39 -DUSE_MTD=$(local_use_mtd) \ 40 -DUSE_POWER_MANAGEMENT=$(local_use_power_management) \ 41 -DUSE_WEAVE=$(local_use_weave) \ 42 -D_FILE_OFFSET_BITS=64 \ 43 -D_POSIX_C_SOURCE=199309L \ 44 -Wa,--noexecstack \ 45 -Wall \ 46 -Werror \ 47 -Wextra \ 48 -Wformat=2 \ 49 -Wno-psabi \ 50 -Wno-unused-parameter \ 51 -ffunction-sections \ 52 -fstack-protector-strong \ 53 -fvisibility=hidden 54ue_common_cppflags := \ 55 -Wnon-virtual-dtor \ 56 -fno-strict-aliasing \ 57 -std=gnu++11 58ue_common_ldflags := \ 59 -Wl,--gc-sections 60ue_common_c_includes := \ 61 $(LOCAL_PATH)/client_library/include \ 62 external/gtest/include \ 63 system 64ue_common_shared_libraries := \ 65 libbrillo \ 66 libbrillo-http \ 67 libbrillo-stream \ 68 libchrome 69 70ifeq ($(local_use_dbus),1) 71 72# update_engine_client-dbus-proxies (from generate-dbus-proxies.gypi) 73# ======================================================== 74include $(CLEAR_VARS) 75LOCAL_MODULE := update_engine_client-dbus-proxies 76LOCAL_MODULE_CLASS := STATIC_LIBRARIES 77LOCAL_SRC_FILES := \ 78 dbus_bindings/dbus-service-config.json \ 79 dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml 80LOCAL_DBUS_PROXY_PREFIX := update_engine 81include $(BUILD_STATIC_LIBRARY) 82 83endif # local_use_dbus == 1 84 85# update_metadata-protos (type: static_library) 86# ======================================================== 87# Protobufs. 88ue_update_metadata_protos_exported_static_libraries := \ 89 update_metadata-protos 90ue_update_metadata_protos_exported_shared_libraries := \ 91 libprotobuf-cpp-lite 92 93ue_update_metadata_protos_src_files := \ 94 update_metadata.proto 95 96# Build for the host. 97include $(CLEAR_VARS) 98LOCAL_MODULE := update_metadata-protos 99LOCAL_MODULE_CLASS := STATIC_LIBRARIES 100LOCAL_IS_HOST_MODULE := true 101generated_sources_dir := $(call local-generated-sources-dir) 102LOCAL_EXPORT_C_INCLUDE_DIRS := $(generated_sources_dir)/proto/system 103LOCAL_SRC_FILES := $(ue_update_metadata_protos_src_files) 104include $(BUILD_HOST_STATIC_LIBRARY) 105 106# Build for the target. 107include $(CLEAR_VARS) 108LOCAL_MODULE := update_metadata-protos 109LOCAL_MODULE_CLASS := STATIC_LIBRARIES 110generated_sources_dir := $(call local-generated-sources-dir) 111LOCAL_EXPORT_C_INCLUDE_DIRS := $(generated_sources_dir)/proto/system 112LOCAL_SRC_FILES := $(ue_update_metadata_protos_src_files) 113include $(BUILD_STATIC_LIBRARY) 114 115ifeq ($(local_use_dbus),1) 116 117# update_engine-dbus-adaptor (from generate-dbus-adaptors.gypi) 118# ======================================================== 119# Chrome D-Bus bindings. 120include $(CLEAR_VARS) 121LOCAL_MODULE := update_engine-dbus-adaptor 122LOCAL_MODULE_CLASS := STATIC_LIBRARIES 123LOCAL_SRC_FILES := \ 124 dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml 125include $(BUILD_STATIC_LIBRARY) 126 127# update_engine-dbus-libcros-client (from generate-dbus-proxies.gypi) 128# ======================================================== 129include $(CLEAR_VARS) 130LOCAL_MODULE := update_engine-dbus-libcros-client 131LOCAL_MODULE_CLASS := STATIC_LIBRARIES 132LOCAL_SRC_FILES := \ 133 dbus_bindings/org.chromium.LibCrosService.dbus-xml 134LOCAL_DBUS_PROXY_PREFIX := libcros 135include $(BUILD_STATIC_LIBRARY) 136 137endif # local_use_dbus == 1 138 139# libpayload_consumer (type: static_library) 140# ======================================================== 141# The payload application component and common dependencies. 142ue_libpayload_consumer_exported_static_libraries := \ 143 update_metadata-protos \ 144 libxz-host \ 145 libbz \ 146 $(ue_update_metadata_protos_exported_static_libraries) 147ue_libpayload_consumer_exported_shared_libraries := \ 148 libcrypto-host \ 149 libcurl-host \ 150 libssl-host \ 151 $(ue_update_metadata_protos_exported_shared_libraries) 152 153ue_libpayload_consumer_src_files := \ 154 common/action_processor.cc \ 155 common/boot_control_stub.cc \ 156 common/certificate_checker.cc \ 157 common/clock.cc \ 158 common/constants.cc \ 159 common/cpu_limiter.cc \ 160 common/error_code_utils.cc \ 161 common/hash_calculator.cc \ 162 common/http_common.cc \ 163 common/http_fetcher.cc \ 164 common/hwid_override.cc \ 165 common/libcurl_http_fetcher.cc \ 166 common/multi_range_http_fetcher.cc \ 167 common/platform_constants_android.cc \ 168 common/prefs.cc \ 169 common/subprocess.cc \ 170 common/terminator.cc \ 171 common/utils.cc \ 172 payload_consumer/bzip_extent_writer.cc \ 173 payload_consumer/delta_performer.cc \ 174 payload_consumer/download_action.cc \ 175 payload_consumer/extent_writer.cc \ 176 payload_consumer/file_descriptor.cc \ 177 payload_consumer/file_writer.cc \ 178 payload_consumer/filesystem_verifier_action.cc \ 179 payload_consumer/install_plan.cc \ 180 payload_consumer/payload_constants.cc \ 181 payload_consumer/payload_verifier.cc \ 182 payload_consumer/postinstall_runner_action.cc \ 183 payload_consumer/xz_extent_writer.cc 184 185ifeq ($(HOST_OS),linux) 186# Build for the host. 187include $(CLEAR_VARS) 188LOCAL_MODULE := libpayload_consumer 189LOCAL_MODULE_CLASS := STATIC_LIBRARIES 190LOCAL_CPP_EXTENSION := .cc 191LOCAL_CLANG := true 192LOCAL_CFLAGS := $(ue_common_cflags) 193LOCAL_CPPFLAGS := $(ue_common_cppflags) 194LOCAL_LDFLAGS := $(ue_common_ldflags) 195LOCAL_C_INCLUDES := \ 196 $(ue_common_c_includes) \ 197 external/e2fsprogs/lib 198LOCAL_STATIC_LIBRARIES := \ 199 update_metadata-protos \ 200 $(ue_libpayload_consumer_exported_static_libraries) \ 201 $(ue_update_metadata_protos_exported_static_libraries) 202LOCAL_SHARED_LIBRARIES := \ 203 $(ue_common_shared_libraries) \ 204 $(ue_libpayload_consumer_exported_shared_libraries) \ 205 $(ue_update_metadata_protos_exported_shared_libraries) 206LOCAL_SRC_FILES := $(ue_libpayload_consumer_src_files) 207include $(BUILD_HOST_STATIC_LIBRARY) 208endif # HOST_OS == linux 209 210# Build for the target. 211include $(CLEAR_VARS) 212LOCAL_MODULE := libpayload_consumer 213LOCAL_MODULE_CLASS := STATIC_LIBRARIES 214LOCAL_CPP_EXTENSION := .cc 215LOCAL_CLANG := true 216LOCAL_CFLAGS := $(ue_common_cflags) 217LOCAL_CPPFLAGS := $(ue_common_cppflags) 218LOCAL_LDFLAGS := $(ue_common_ldflags) 219LOCAL_C_INCLUDES := \ 220 $(ue_common_c_includes) \ 221 external/e2fsprogs/lib 222LOCAL_STATIC_LIBRARIES := \ 223 update_metadata-protos \ 224 $(ue_libpayload_consumer_exported_static_libraries:-host=) \ 225 $(ue_update_metadata_protos_exported_static_libraries) 226LOCAL_SHARED_LIBRARIES := \ 227 $(ue_common_shared_libraries) \ 228 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \ 229 $(ue_update_metadata_protos_exported_shared_libraries) 230LOCAL_SRC_FILES := $(ue_libpayload_consumer_src_files) 231include $(BUILD_STATIC_LIBRARY) 232 233ifdef BRILLO 234 235# libupdate_engine (type: static_library) 236# ======================================================== 237# The main daemon static_library with all the code used to check for updates 238# with Omaha and expose a DBus daemon. 239ue_libupdate_engine_exported_c_includes := \ 240 $(LOCAL_PATH)/include \ 241 external/cros/system_api/dbus 242ue_libupdate_engine_exported_static_libraries := \ 243 libpayload_consumer \ 244 update_metadata-protos \ 245 update_engine-dbus-adaptor \ 246 update_engine-dbus-libcros-client \ 247 update_engine_client-dbus-proxies \ 248 libbz \ 249 libfs_mgr \ 250 $(ue_libpayload_consumer_exported_static_libraries) \ 251 $(ue_update_metadata_protos_exported_static_libraries) 252ue_libupdate_engine_exported_shared_libraries := \ 253 libdbus \ 254 libbrillo-dbus \ 255 libchrome-dbus \ 256 libmetrics \ 257 libshill-client \ 258 libexpat \ 259 libbrillo-policy \ 260 libhardware \ 261 libcutils \ 262 $(ue_libpayload_consumer_exported_shared_libraries) \ 263 $(ue_update_metadata_protos_exported_shared_libraries) 264ifeq ($(local_use_binder),1) 265ue_libupdate_engine_exported_shared_libraries += \ 266 libbinder \ 267 libbinderwrapper \ 268 libbrillo-binder \ 269 libutils 270endif # local_use_binder == 1 271ifeq ($(local_use_weave),1) 272ue_libupdate_engine_exported_shared_libraries += \ 273 libbinderwrapper \ 274 libbrillo-binder \ 275 libweaved 276endif # local_use_weave == 1 277 278include $(CLEAR_VARS) 279LOCAL_MODULE := libupdate_engine 280LOCAL_MODULE_CLASS := STATIC_LIBRARIES 281LOCAL_CPP_EXTENSION := .cc 282LOCAL_CLANG := true 283LOCAL_EXPORT_C_INCLUDE_DIRS := $(ue_libupdate_engine_exported_c_includes) 284LOCAL_CFLAGS := $(ue_common_cflags) 285LOCAL_CPPFLAGS := $(ue_common_cppflags) 286LOCAL_LDFLAGS := $(ue_common_ldflags) 287LOCAL_C_INCLUDES := \ 288 $(ue_common_c_includes) \ 289 $(ue_libupdate_engine_exported_c_includes) 290LOCAL_STATIC_LIBRARIES := \ 291 libpayload_consumer \ 292 update_metadata-protos \ 293 update_engine-dbus-adaptor \ 294 update_engine-dbus-libcros-client \ 295 update_engine_client-dbus-proxies \ 296 $(ue_libupdate_engine_exported_static_libraries:-host=) \ 297 $(ue_libpayload_consumer_exported_static_libraries:-host=) \ 298 $(ue_update_metadata_protos_exported_static_libraries) 299LOCAL_SHARED_LIBRARIES := \ 300 $(ue_common_shared_libraries) \ 301 $(ue_libupdate_engine_exported_shared_libraries:-host=) \ 302 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \ 303 $(ue_update_metadata_protos_exported_shared_libraries) 304LOCAL_SRC_FILES := \ 305 boot_control_android.cc \ 306 common_service.cc \ 307 connection_manager.cc \ 308 daemon.cc \ 309 dbus_service.cc \ 310 hardware_android.cc \ 311 image_properties_android.cc \ 312 libcros_proxy.cc \ 313 metrics.cc \ 314 metrics_utils.cc \ 315 omaha_request_action.cc \ 316 omaha_request_params.cc \ 317 omaha_response_handler_action.cc \ 318 p2p_manager.cc \ 319 payload_state.cc \ 320 proxy_resolver.cc \ 321 real_system_state.cc \ 322 shill_proxy.cc \ 323 update_attempter.cc \ 324 update_manager/boxed_value.cc \ 325 update_manager/chromeos_policy.cc \ 326 update_manager/default_policy.cc \ 327 update_manager/evaluation_context.cc \ 328 update_manager/policy.cc \ 329 update_manager/real_config_provider.cc \ 330 update_manager/real_device_policy_provider.cc \ 331 update_manager/real_random_provider.cc \ 332 update_manager/real_shill_provider.cc \ 333 update_manager/real_system_provider.cc \ 334 update_manager/real_time_provider.cc \ 335 update_manager/real_updater_provider.cc \ 336 update_manager/state_factory.cc \ 337 update_manager/update_manager.cc \ 338 update_status_utils.cc \ 339 weave_service_factory.cc 340ifeq ($(local_use_binder),1) 341LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/binder_bindings 342LOCAL_SRC_FILES += \ 343 binder_bindings/android/brillo/IUpdateEngine.aidl \ 344 binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl \ 345 binder_service_brillo.cc \ 346 parcelable_update_engine_status.cc 347endif # local_use_binder == 1 348ifeq ($(local_use_weave),1) 349LOCAL_SRC_FILES += \ 350 weave_service.cc 351endif # local_use_weave == 1 352ifeq ($(local_use_libcros),1) 353LOCAL_SRC_FILES += \ 354 chrome_browser_proxy_resolver.cc 355endif # local_use_libcros == 1 356include $(BUILD_STATIC_LIBRARY) 357 358else # !defined(BRILLO) 359 360ifneq ($(local_use_binder),1) 361$(error USE_BINDER is disabled but is required in non-Brillo devices.) 362endif # local_use_binder == 1 363 364# libupdate_engine_android (type: static_library) 365# ======================================================== 366# The main daemon static_library used in Android (non-Brillo). This only has a 367# loop to apply payloads provided by the upper layer via a Binder interface. 368ue_libupdate_engine_android_exported_static_libraries := \ 369 libpayload_consumer \ 370 libfs_mgr \ 371 $(ue_libpayload_consumer_exported_static_libraries) 372ue_libupdate_engine_android_exported_shared_libraries := \ 373 $(ue_libpayload_consumer_exported_shared_libraries) \ 374 libbinder \ 375 libbinderwrapper \ 376 libbrillo-binder \ 377 libcutils \ 378 libhardware \ 379 libutils 380 381include $(CLEAR_VARS) 382LOCAL_MODULE := libupdate_engine_android 383LOCAL_MODULE_CLASS := STATIC_LIBRARIES 384LOCAL_CPP_EXTENSION := .cc 385LOCAL_CLANG := true 386LOCAL_CFLAGS := $(ue_common_cflags) 387LOCAL_CPPFLAGS := $(ue_common_cppflags) 388LOCAL_LDFLAGS := $(ue_common_ldflags) 389LOCAL_C_INCLUDES := $(ue_common_c_includes) 390#TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved 391# out of the DBus interface. 392LOCAL_C_INCLUDES += \ 393 external/cros/system_api/dbus 394LOCAL_STATIC_LIBRARIES := \ 395 $(ue_libupdate_engine_android_exported_static_libraries:-host=) 396LOCAL_SHARED_LIBRARIES += \ 397 $(ue_common_shared_libraries) \ 398 $(ue_libupdate_engine_android_exported_shared_libraries:-host=) 399LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings 400LOCAL_SRC_FILES += \ 401 binder_bindings/android/os/IUpdateEngine.aidl \ 402 binder_bindings/android/os/IUpdateEngineCallback.aidl \ 403 binder_service_android.cc \ 404 boot_control_android.cc \ 405 daemon.cc \ 406 daemon_state_android.cc \ 407 hardware_android.cc \ 408 proxy_resolver.cc \ 409 update_attempter_android.cc \ 410 update_status_utils.cc 411include $(BUILD_STATIC_LIBRARY) 412 413endif # !defined(BRILLO) 414 415# update_engine (type: executable) 416# ======================================================== 417# update_engine daemon. 418include $(CLEAR_VARS) 419LOCAL_MODULE := update_engine 420LOCAL_MODULE_CLASS := EXECUTABLES 421LOCAL_REQUIRED_MODULES := \ 422 bspatch \ 423 cacerts_google 424ifeq ($(local_use_weave),1) 425LOCAL_REQUIRED_MODULES += updater.json 426endif # local_use_weave == 1 427LOCAL_CPP_EXTENSION := .cc 428LOCAL_CLANG := true 429LOCAL_CFLAGS := $(ue_common_cflags) 430LOCAL_CPPFLAGS := $(ue_common_cppflags) 431LOCAL_LDFLAGS := $(ue_common_ldflags) 432LOCAL_C_INCLUDES := \ 433 $(ue_common_c_includes) 434LOCAL_SHARED_LIBRARIES := \ 435 $(ue_common_shared_libraries) 436LOCAL_SRC_FILES := \ 437 main.cc 438 439ifdef BRILLO 440LOCAL_C_INCLUDES += \ 441 $(ue_libupdate_engine_exported_c_includes) 442LOCAL_STATIC_LIBRARIES := \ 443 libupdate_engine \ 444 $(ue_libupdate_engine_exported_static_libraries:-host=) 445LOCAL_SHARED_LIBRARIES += \ 446 $(ue_libupdate_engine_exported_shared_libraries:-host=) 447else # !defined(BRILLO) 448LOCAL_STATIC_LIBRARIES := \ 449 libupdate_engine_android \ 450 $(ue_libupdate_engine_android_exported_static_libraries:-host=) 451LOCAL_SHARED_LIBRARIES += \ 452 $(ue_libupdate_engine_android_exported_shared_libraries:-host=) 453endif # !defined(BRILLO) 454 455LOCAL_INIT_RC := update_engine.rc 456include $(BUILD_EXECUTABLE) 457 458# libupdate_engine_client (type: shared_library) 459# ======================================================== 460include $(CLEAR_VARS) 461LOCAL_MODULE := libupdate_engine_client 462LOCAL_CFLAGS := \ 463 -Wall \ 464 -Werror \ 465 -Wno-unused-parameter \ 466 -DUSE_DBUS=$(local_use_dbus) \ 467 -DUSE_BINDER=$(local_use_binder) 468LOCAL_CLANG := true 469LOCAL_CPP_EXTENSION := .cc 470# TODO(deymo): Remove "external/cros/system_api/dbus" when dbus is not used. 471LOCAL_C_INCLUDES := \ 472 $(LOCAL_PATH)/client_library/include \ 473 external/cros/system_api/dbus \ 474 system \ 475 external/gtest/include 476LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/client_library/include 477LOCAL_SHARED_LIBRARIES := \ 478 libchrome \ 479 libbrillo 480LOCAL_SRC_FILES := \ 481 client_library/client.cc \ 482 update_status_utils.cc 483 484# We can only compile support for one IPC mechanism. If both "binder" and "dbus" 485# are defined, we prefer binder. 486ifeq ($(local_use_binder),1) 487LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings 488LOCAL_SHARED_LIBRARIES += \ 489 libbinder \ 490 libbrillo-binder \ 491 libutils 492LOCAL_SRC_FILES += \ 493 binder_bindings/android/brillo/IUpdateEngine.aidl \ 494 binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl \ 495 client_library/client_binder.cc \ 496 parcelable_update_engine_status.cc 497else # local_use_binder != 1 498LOCAL_STATIC_LIBRARIES := \ 499 update_engine_client-dbus-proxies 500LOCAL_SHARED_LIBRARIES += \ 501 libchrome-dbus \ 502 libbrillo-dbus 503LOCAL_SRC_FILES += \ 504 client_library/client_dbus.cc 505endif # local_use_binder == 1 506 507include $(BUILD_SHARED_LIBRARY) 508 509# update_engine_client (type: executable) 510# ======================================================== 511# update_engine console client. 512include $(CLEAR_VARS) 513LOCAL_MODULE := update_engine_client 514LOCAL_MODULE_CLASS := EXECUTABLES 515LOCAL_CPP_EXTENSION := .cc 516LOCAL_CLANG := true 517LOCAL_CFLAGS := $(ue_common_cflags) 518LOCAL_CPPFLAGS := $(ue_common_cppflags) 519LOCAL_LDFLAGS := $(ue_common_ldflags) 520LOCAL_C_INCLUDES := $(ue_common_c_includes) 521LOCAL_SHARED_LIBRARIES := $(ue_common_shared_libraries) 522ifdef BRILLO 523LOCAL_SHARED_LIBRARIES += \ 524 libupdate_engine_client 525LOCAL_SRC_FILES := \ 526 update_engine_client.cc \ 527 common/error_code_utils.cc 528else # !defined(BRILLO) 529#TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved 530# out of the DBus interface. 531LOCAL_C_INCLUDES += \ 532 external/cros/system_api/dbus 533LOCAL_SHARED_LIBRARIES += \ 534 libbinder \ 535 libbinderwrapper \ 536 libbrillo-binder \ 537 libutils 538LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings 539LOCAL_SRC_FILES := \ 540 binder_bindings/android/os/IUpdateEngine.aidl \ 541 binder_bindings/android/os/IUpdateEngineCallback.aidl \ 542 common/error_code_utils.cc \ 543 update_engine_client_android.cc \ 544 update_status_utils.cc 545endif # !defined(BRILLO) 546include $(BUILD_EXECUTABLE) 547 548# libpayload_generator (type: static_library) 549# ======================================================== 550# server-side code. This is used for delta_generator and unittests but not 551# for any client code. 552ue_libpayload_generator_exported_static_libraries := \ 553 libpayload_consumer \ 554 update_metadata-protos \ 555 liblzma \ 556 $(ue_libpayload_consumer_exported_static_libraries) \ 557 $(ue_update_metadata_protos_exported_static_libraries) 558ue_libpayload_generator_exported_shared_libraries := \ 559 libext2fs-host \ 560 $(ue_libpayload_consumer_exported_shared_libraries) \ 561 $(ue_update_metadata_protos_exported_shared_libraries) 562 563ue_libpayload_generator_src_files := \ 564 payload_generator/ab_generator.cc \ 565 payload_generator/annotated_operation.cc \ 566 payload_generator/blob_file_writer.cc \ 567 payload_generator/block_mapping.cc \ 568 payload_generator/bzip.cc \ 569 payload_generator/cycle_breaker.cc \ 570 payload_generator/delta_diff_generator.cc \ 571 payload_generator/delta_diff_utils.cc \ 572 payload_generator/ext2_filesystem.cc \ 573 payload_generator/extent_ranges.cc \ 574 payload_generator/extent_utils.cc \ 575 payload_generator/full_update_generator.cc \ 576 payload_generator/graph_types.cc \ 577 payload_generator/graph_utils.cc \ 578 payload_generator/inplace_generator.cc \ 579 payload_generator/payload_file.cc \ 580 payload_generator/payload_generation_config.cc \ 581 payload_generator/payload_signer.cc \ 582 payload_generator/raw_filesystem.cc \ 583 payload_generator/tarjan.cc \ 584 payload_generator/topological_sort.cc \ 585 payload_generator/xz_android.cc 586 587ifeq ($(HOST_OS),linux) 588# Build for the host. 589include $(CLEAR_VARS) 590LOCAL_MODULE := libpayload_generator 591LOCAL_MODULE_CLASS := STATIC_LIBRARIES 592LOCAL_CPP_EXTENSION := .cc 593LOCAL_CLANG := true 594LOCAL_CFLAGS := $(ue_common_cflags) 595LOCAL_CPPFLAGS := $(ue_common_cppflags) 596LOCAL_LDFLAGS := $(ue_common_ldflags) 597LOCAL_C_INCLUDES := $(ue_common_c_includes) 598LOCAL_STATIC_LIBRARIES := \ 599 libpayload_consumer \ 600 update_metadata-protos \ 601 liblzma \ 602 $(ue_libpayload_consumer_exported_static_libraries) \ 603 $(ue_update_metadata_protos_exported_static_libraries) 604LOCAL_SHARED_LIBRARIES := \ 605 $(ue_common_shared_libraries) \ 606 $(ue_libpayload_generator_exported_shared_libraries) \ 607 $(ue_libpayload_consumer_exported_shared_libraries) \ 608 $(ue_update_metadata_protos_exported_shared_libraries) 609LOCAL_SRC_FILES := $(ue_libpayload_generator_src_files) 610include $(BUILD_HOST_STATIC_LIBRARY) 611endif # HOST_OS == linux 612 613# Build for the target. 614include $(CLEAR_VARS) 615LOCAL_MODULE := libpayload_generator 616LOCAL_MODULE_CLASS := STATIC_LIBRARIES 617LOCAL_CPP_EXTENSION := .cc 618LOCAL_CLANG := true 619LOCAL_CFLAGS := $(ue_common_cflags) 620LOCAL_CPPFLAGS := $(ue_common_cppflags) 621LOCAL_LDFLAGS := $(ue_common_ldflags) 622LOCAL_C_INCLUDES := $(ue_common_c_includes) 623LOCAL_STATIC_LIBRARIES := \ 624 libpayload_consumer \ 625 update_metadata-protos \ 626 liblzma \ 627 $(ue_libpayload_consumer_exported_static_libraries:-host=) \ 628 $(ue_update_metadata_protos_exported_static_libraries) 629LOCAL_SHARED_LIBRARIES := \ 630 $(ue_common_shared_libraries) \ 631 $(ue_libpayload_generator_exported_shared_libraries:-host=) \ 632 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \ 633 $(ue_update_metadata_protos_exported_shared_libraries) 634LOCAL_SRC_FILES := $(ue_libpayload_generator_src_files) 635include $(BUILD_STATIC_LIBRARY) 636 637# delta_generator (type: executable) 638# ======================================================== 639# server-side delta generator. 640ue_delta_generator_src_files := \ 641 payload_generator/generate_delta_main.cc 642 643ifeq ($(HOST_OS),linux) 644# Build for the host. 645include $(CLEAR_VARS) 646LOCAL_MODULE := delta_generator 647LOCAL_MODULE_CLASS := EXECUTABLES 648LOCAL_CPP_EXTENSION := .cc 649LOCAL_CLANG := true 650LOCAL_CFLAGS := $(ue_common_cflags) 651LOCAL_CPPFLAGS := $(ue_common_cppflags) 652LOCAL_LDFLAGS := $(ue_common_ldflags) 653LOCAL_C_INCLUDES := $(ue_common_c_includes) 654LOCAL_STATIC_LIBRARIES := \ 655 libpayload_consumer \ 656 libpayload_generator \ 657 $(ue_libpayload_consumer_exported_static_libraries) \ 658 $(ue_libpayload_generator_exported_static_libraries) 659LOCAL_SHARED_LIBRARIES := \ 660 $(ue_common_shared_libraries) \ 661 $(ue_libpayload_consumer_exported_shared_libraries) \ 662 $(ue_libpayload_generator_exported_shared_libraries) 663LOCAL_SRC_FILES := $(ue_delta_generator_src_files) 664include $(BUILD_HOST_EXECUTABLE) 665endif # HOST_OS == linux 666 667# Build for the target. 668include $(CLEAR_VARS) 669LOCAL_MODULE := delta_generator 670LOCAL_MODULE_CLASS := EXECUTABLES 671LOCAL_CPP_EXTENSION := .cc 672LOCAL_CLANG := true 673LOCAL_CFLAGS := $(ue_common_cflags) 674LOCAL_CPPFLAGS := $(ue_common_cppflags) 675LOCAL_LDFLAGS := $(ue_common_ldflags) 676LOCAL_C_INCLUDES := $(ue_common_c_includes) 677LOCAL_STATIC_LIBRARIES := \ 678 libpayload_consumer \ 679 libpayload_generator \ 680 $(ue_libpayload_consumer_exported_static_libraries:-host=) \ 681 $(ue_libpayload_generator_exported_static_libraries:-host=) 682LOCAL_SHARED_LIBRARIES := \ 683 $(ue_common_shared_libraries) \ 684 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \ 685 $(ue_libpayload_generator_exported_shared_libraries:-host=) 686LOCAL_SRC_FILES := $(ue_delta_generator_src_files) 687include $(BUILD_EXECUTABLE) 688 689# TODO(deymo): Enable the unittest binaries in non-Brillo builds once the DBus 690# dependencies are removed or placed behind the USE_DBUS flag. 691ifdef BRILLO 692 693# Private and public keys for unittests. 694# ======================================================== 695# Generate a module that installs a prebuilt private key and a module that 696# installs a public key generated from the private key. 697# 698# $(1): The path to the private key in pem format. 699define ue-unittest-keys 700 $(eval include $(CLEAR_VARS)) \ 701 $(eval LOCAL_MODULE := ue_$(1).pem) \ 702 $(eval LOCAL_MODULE_CLASS := ETC) \ 703 $(eval $(ifeq $(BRILLO), 1, LOCAL_MODULE_TAGS := eng)) \ 704 $(eval LOCAL_SRC_FILES := $(1).pem) \ 705 $(eval LOCAL_MODULE_PATH := \ 706 $(TARGET_OUT_DATA_NATIVE_TESTS)/update_engine_unittests) \ 707 $(eval LOCAL_MODULE_STEM := $(1).pem) \ 708 $(eval include $(BUILD_PREBUILT)) \ 709 \ 710 $(eval include $(CLEAR_VARS)) \ 711 $(eval LOCAL_MODULE := ue_$(1).pub.pem) \ 712 $(eval LOCAL_MODULE_CLASS := ETC) \ 713 $(eval $(ifeq $(BRILLO), 1, LOCAL_MODULE_TAGS := eng)) \ 714 $(eval LOCAL_MODULE_PATH := \ 715 $(TARGET_OUT_DATA_NATIVE_TESTS)/update_engine_unittests) \ 716 $(eval LOCAL_MODULE_STEM := $(1).pub.pem) \ 717 $(eval include $(BUILD_SYSTEM)/base_rules.mk) \ 718 $(eval $(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(1).pem ; \ 719 openssl rsa -in $$< -pubout -out $$@) 720endef 721 722$(call ue-unittest-keys,unittest_key) 723$(call ue-unittest-keys,unittest_key2) 724 725# Sample images for unittests. 726# ======================================================== 727# Generate a prebuilt module that installs a sample image from the compressed 728# sample_images.tar.bz2 file used by the unittests. 729# 730# $(1): The filename in the sample_images.tar.bz2 731define ue-unittest-sample-image 732 $(eval include $(CLEAR_VARS)) \ 733 $(eval LOCAL_MODULE := ue_unittest_$(1)) \ 734 $(eval LOCAL_MODULE_CLASS := EXECUTABLES) \ 735 $(eval $(ifeq $(BRILLO), 1, LOCAL_MODULE_TAGS := eng)) \ 736 $(eval LOCAL_MODULE_PATH := \ 737 $(TARGET_OUT_DATA_NATIVE_TESTS)/update_engine_unittests/gen) \ 738 $(eval LOCAL_MODULE_STEM := $(1)) \ 739 $(eval include $(BUILD_SYSTEM)/base_rules.mk) \ 740 $(eval $(LOCAL_BUILT_MODULE) : \ 741 $(LOCAL_PATH)/sample_images/sample_images.tar.bz2 ; \ 742 tar -jxf $$< -C $$(dir $$@) $$(notdir $$@) && touch $$@) 743endef 744 745$(call ue-unittest-sample-image,disk_ext2_1k.img) 746$(call ue-unittest-sample-image,disk_ext2_4k.img) 747$(call ue-unittest-sample-image,disk_ext2_4k_empty.img) 748$(call ue-unittest-sample-image,disk_ext2_unittest.img) 749 750# Zlib Fingerprint 751# ======================================================== 752include $(CLEAR_VARS) 753LOCAL_MODULE := zlib_fingerprint 754LOCAL_MODULE_CLASS := ETC 755LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/update_engine_unittests 756LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_COMMON_GEN)/zlib_fingerprint 757include $(BUILD_PREBUILT) 758 759# test_http_server (type: executable) 760# ======================================================== 761# Test HTTP Server. 762include $(CLEAR_VARS) 763LOCAL_MODULE := test_http_server 764ifdef BRILLO 765 LOCAL_MODULE_TAGS := eng 766endif 767LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/update_engine_unittests 768LOCAL_MODULE_CLASS := EXECUTABLES 769LOCAL_CPP_EXTENSION := .cc 770LOCAL_CLANG := true 771LOCAL_CFLAGS := $(ue_common_cflags) 772LOCAL_CPPFLAGS := $(ue_common_cppflags) 773LOCAL_LDFLAGS := $(ue_common_ldflags) 774LOCAL_C_INCLUDES := $(ue_common_c_includes) 775LOCAL_SHARED_LIBRARIES := $(ue_common_shared_libraries) 776LOCAL_SRC_FILES := \ 777 common/http_common.cc \ 778 test_http_server.cc 779include $(BUILD_EXECUTABLE) 780 781# update_engine_unittests (type: executable) 782# ======================================================== 783# Main unittest file. 784include $(CLEAR_VARS) 785LOCAL_MODULE := update_engine_unittests 786ifdef BRILLO 787 LOCAL_MODULE_TAGS := eng 788endif 789LOCAL_REQUIRED_MODULES := \ 790 ue_unittest_disk_ext2_1k.img \ 791 ue_unittest_disk_ext2_4k.img \ 792 ue_unittest_disk_ext2_4k_empty.img \ 793 ue_unittest_disk_ext2_unittest.img \ 794 ue_unittest_key.pem \ 795 ue_unittest_key.pub.pem \ 796 ue_unittest_key2.pem \ 797 ue_unittest_key2.pub.pem \ 798 zlib_fingerprint 799LOCAL_MODULE_CLASS := EXECUTABLES 800LOCAL_CPP_EXTENSION := .cc 801LOCAL_CLANG := true 802LOCAL_CFLAGS := $(ue_common_cflags) 803LOCAL_CPPFLAGS := $(ue_common_cppflags) 804LOCAL_LDFLAGS := $(ue_common_ldflags) 805LOCAL_C_INCLUDES := \ 806 $(ue_common_c_includes) \ 807 $(ue_libupdate_engine_exported_c_includes) 808LOCAL_STATIC_LIBRARIES := \ 809 libupdate_engine \ 810 libpayload_generator \ 811 libbrillo-test-helpers \ 812 libgmock \ 813 libgtest \ 814 libchrome_test_helpers \ 815 $(ue_libupdate_engine_exported_static_libraries:-host=) \ 816 $(ue_libpayload_generator_exported_static_libraries:-host=) 817LOCAL_SHARED_LIBRARIES := \ 818 $(ue_common_shared_libraries) \ 819 $(ue_libupdate_engine_exported_shared_libraries:-host=) \ 820 $(ue_libpayload_generator_exported_shared_libraries:-host=) 821LOCAL_SRC_FILES := \ 822 common/action_pipe_unittest.cc \ 823 common/action_processor_unittest.cc \ 824 common/action_unittest.cc \ 825 common/certificate_checker_unittest.cc \ 826 common/cpu_limiter_unittest.cc \ 827 common/fake_prefs.cc \ 828 common/hash_calculator_unittest.cc \ 829 common/http_fetcher_unittest.cc \ 830 common/hwid_override_unittest.cc \ 831 common/mock_http_fetcher.cc \ 832 common/prefs_unittest.cc \ 833 common/subprocess_unittest.cc \ 834 common/terminator_unittest.cc \ 835 common/test_utils.cc \ 836 common/utils_unittest.cc \ 837 common_service_unittest.cc \ 838 connection_manager_unittest.cc \ 839 fake_shill_proxy.cc \ 840 fake_system_state.cc \ 841 metrics_utils_unittest.cc \ 842 omaha_request_action_unittest.cc \ 843 omaha_request_params_unittest.cc \ 844 omaha_response_handler_action_unittest.cc \ 845 p2p_manager_unittest.cc \ 846 payload_consumer/bzip_extent_writer_unittest.cc \ 847 payload_consumer/delta_performer_integration_test.cc \ 848 payload_consumer/delta_performer_unittest.cc \ 849 payload_consumer/download_action_unittest.cc \ 850 payload_consumer/extent_writer_unittest.cc \ 851 payload_consumer/file_writer_unittest.cc \ 852 payload_consumer/filesystem_verifier_action_unittest.cc \ 853 payload_consumer/postinstall_runner_action_unittest.cc \ 854 payload_consumer/xz_extent_writer_unittest.cc \ 855 payload_generator/ab_generator_unittest.cc \ 856 payload_generator/blob_file_writer_unittest.cc \ 857 payload_generator/block_mapping_unittest.cc \ 858 payload_generator/cycle_breaker_unittest.cc \ 859 payload_generator/delta_diff_utils_unittest.cc \ 860 payload_generator/ext2_filesystem_unittest.cc \ 861 payload_generator/extent_ranges_unittest.cc \ 862 payload_generator/extent_utils_unittest.cc \ 863 payload_generator/fake_filesystem.cc \ 864 payload_generator/full_update_generator_unittest.cc \ 865 payload_generator/graph_utils_unittest.cc \ 866 payload_generator/inplace_generator_unittest.cc \ 867 payload_generator/payload_file_unittest.cc \ 868 payload_generator/payload_generation_config_unittest.cc \ 869 payload_generator/payload_signer_unittest.cc \ 870 payload_generator/tarjan_unittest.cc \ 871 payload_generator/topological_sort_unittest.cc \ 872 payload_generator/zip_unittest.cc \ 873 payload_state_unittest.cc \ 874 update_attempter_unittest.cc \ 875 update_manager/boxed_value_unittest.cc \ 876 update_manager/chromeos_policy_unittest.cc \ 877 update_manager/evaluation_context_unittest.cc \ 878 update_manager/generic_variables_unittest.cc \ 879 update_manager/prng_unittest.cc \ 880 update_manager/real_config_provider_unittest.cc \ 881 update_manager/real_device_policy_provider_unittest.cc \ 882 update_manager/real_random_provider_unittest.cc \ 883 update_manager/real_shill_provider_unittest.cc \ 884 update_manager/real_system_provider_unittest.cc \ 885 update_manager/real_time_provider_unittest.cc \ 886 update_manager/real_updater_provider_unittest.cc \ 887 update_manager/umtest_utils.cc \ 888 update_manager/update_manager_unittest.cc \ 889 update_manager/variable_unittest.cc \ 890 testrunner.cc 891ifeq ($(local_use_libcros),1) 892LOCAL_SRC_FILES += \ 893 chrome_browser_proxy_resolver_unittest.cc 894endif # local_use_libcros == 1 895include $(BUILD_NATIVE_TEST) 896endif # BRILLO 897 898# Weave schema files 899# ======================================================== 900include $(CLEAR_VARS) 901LOCAL_MODULE := updater.json 902LOCAL_MODULE_CLASS := ETC 903LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/weaved/traits 904LOCAL_SRC_FILES := weaved/traits/$(LOCAL_MODULE) 905include $(BUILD_PREBUILT) 906 907# Update payload signing public key. 908# ======================================================== 909ifdef BRILLO 910include $(CLEAR_VARS) 911LOCAL_MODULE := brillo-update-payload-key 912LOCAL_MODULE_CLASS := ETC 913LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/update_engine 914LOCAL_MODULE_STEM := update-payload-key.pub.pem 915LOCAL_SRC_FILES := update_payload_key/brillo-update-payload-key.pub.pem 916LOCAL_BUILT_MODULE_STEM := update_payload_key/brillo-update-payload-key.pub.pem 917include $(BUILD_PREBUILT) 918endif # BRILLO 919 920# Brillo update payload generation script 921# ======================================================== 922ifeq ($(HOST_OS),linux) 923include $(CLEAR_VARS) 924LOCAL_SRC_FILES := scripts/brillo_update_payload 925LOCAL_MODULE := brillo_update_payload 926LOCAL_MODULE_CLASS := EXECUTABLES 927LOCAL_IS_HOST_MODULE := true 928LOCAL_MODULE_TAGS := optional 929LOCAL_REQUIRED_MODULES := \ 930 delta_generator \ 931 shflags 932include $(BUILD_PREBUILT) 933endif # HOST_OS == linux 934