blob: 07d8f64b64b1b4272cec6505240655981bb60cbe [file] [log] [blame]
Alex Deymod5561a52015-09-03 23:17:52 -07001#
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
Alex Deymo78a954f2016-01-21 20:32:40 -080019# 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)
Alex Deymoe97b39c2016-01-20 13:22:17 -080023local_use_dbus := $(if $(BRILLO_USE_DBUS),$(BRILLO_USE_DBUS),0)
Alex Deymo78a954f2016-01-21 20:32:40 -080024local_use_hwid_override := \
25 $(if $(BRILLO_USE_HWID_OVERRIDE),$(BRILLO_USE_HWID_OVERRIDE),0)
26local_use_mtd := $(if $(BRILLO_USE_MTD),$(BRILLO_USE_MTD),0)
27local_use_power_management := \
28 $(if $(BRILLO_USE_POWER_MANAGEMENT),$(BRILLO_USE_POWER_MANAGEMENT),0)
29local_use_weave := $(if $(BRILLO_USE_WEAVE),$(BRILLO_USE_WEAVE),0)
Alex Deymo787dc412015-10-29 11:39:20 -070030
Alex Deymoc372ab62015-10-29 00:43:26 -070031ue_common_cflags := \
Alex Deymo78a954f2016-01-21 20:32:40 -080032 -DUSE_BINDER=$(local_use_binder) \
33 -DUSE_DBUS=$(local_use_dbus) \
34 -DUSE_HWID_OVERRIDE=$(local_use_hwid_override) \
35 -DUSE_MTD=$(local_use_mtd) \
36 -DUSE_POWER_MANAGEMENT=$(local_use_power_management) \
37 -DUSE_WEAVE=$(local_use_weave) \
Alex Deymoc372ab62015-10-29 00:43:26 -070038 -D_FILE_OFFSET_BITS=64 \
39 -D_POSIX_C_SOURCE=199309L \
40 -Wa,--noexecstack \
41 -Wall \
42 -Werror \
43 -Wextra \
44 -Wformat=2 \
45 -Wno-psabi \
46 -Wno-unused-parameter \
47 -ffunction-sections \
48 -fstack-protector-strong \
49 -fvisibility=hidden
50ue_common_cppflags := \
51 -Wnon-virtual-dtor \
52 -fno-strict-aliasing \
53 -std=gnu++11
54ue_common_ldflags := \
55 -Wl,--gc-sections
56ue_common_c_includes := \
57 $(LOCAL_PATH)/client_library/include \
58 external/gtest/include \
59 system
60ue_common_shared_libraries := \
61 libbrillo \
Alex Deymoc372ab62015-10-29 00:43:26 -070062 libbrillo-http \
63 libbrillo-stream \
Alex Deymo4218b7e2015-11-17 21:14:42 -030064 libchrome
Alex Deymod5561a52015-09-03 23:17:52 -070065
Alex Deymo78a954f2016-01-21 20:32:40 -080066ifeq ($(local_use_dbus),1)
Alex Deymoc372ab62015-10-29 00:43:26 -070067
68# update_engine_client-dbus-proxies (from generate-dbus-proxies.gypi)
69# ========================================================
70include $(CLEAR_VARS)
71LOCAL_MODULE := update_engine_client-dbus-proxies
72LOCAL_MODULE_CLASS := STATIC_LIBRARIES
73LOCAL_SRC_FILES := \
74 dbus_bindings/dbus-service-config.json \
75 dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml
76LOCAL_DBUS_PROXY_PREFIX := update_engine
77include $(BUILD_STATIC_LIBRARY)
Alex Deymod5561a52015-09-03 23:17:52 -070078
Alex Deymo78a954f2016-01-21 20:32:40 -080079endif # local_use_dbus == 1
Alex Deymo4218b7e2015-11-17 21:14:42 -030080
Alex Deymod5561a52015-09-03 23:17:52 -070081# update_metadata-protos (type: static_library)
82# ========================================================
83# Protobufs.
Alex Deymoc372ab62015-10-29 00:43:26 -070084ue_update_metadata_protos_exported_static_libraries := \
85 update_metadata-protos
86ue_update_metadata_protos_exported_shared_libraries := \
Alex Vakulenkoab5bd662015-12-21 12:24:45 -080087 libprotobuf-cpp-lite
Alex Deymoc372ab62015-10-29 00:43:26 -070088
Alex Deymo05e0e382015-12-07 20:18:16 -080089ue_update_metadata_protos_src_files := \
90 update_metadata.proto
91
92# Build for the host.
Alex Deymod5561a52015-09-03 23:17:52 -070093include $(CLEAR_VARS)
94LOCAL_MODULE := update_metadata-protos
95LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Ying Wangdbd17112015-12-17 11:59:09 -080096LOCAL_IS_HOST_MODULE := true
Alex Deymod5561a52015-09-03 23:17:52 -070097generated_sources_dir := $(call local-generated-sources-dir)
Alex Deymoc372ab62015-10-29 00:43:26 -070098LOCAL_EXPORT_C_INCLUDE_DIRS := $(generated_sources_dir)/proto/system
Alex Deymo05e0e382015-12-07 20:18:16 -080099LOCAL_SRC_FILES := $(ue_update_metadata_protos_src_files)
100include $(BUILD_HOST_STATIC_LIBRARY)
101
102# Build for the target.
103include $(CLEAR_VARS)
104LOCAL_MODULE := update_metadata-protos
105LOCAL_MODULE_CLASS := STATIC_LIBRARIES
106generated_sources_dir := $(call local-generated-sources-dir)
107LOCAL_EXPORT_C_INCLUDE_DIRS := $(generated_sources_dir)/proto/system
108LOCAL_SRC_FILES := $(ue_update_metadata_protos_src_files)
Alex Deymod5561a52015-09-03 23:17:52 -0700109include $(BUILD_STATIC_LIBRARY)
110
Alex Deymo78a954f2016-01-21 20:32:40 -0800111ifeq ($(local_use_dbus),1)
Alex Deymo4218b7e2015-11-17 21:14:42 -0300112
Alex Deymod5561a52015-09-03 23:17:52 -0700113# update_engine-dbus-adaptor (from generate-dbus-adaptors.gypi)
114# ========================================================
Alex Deymoc372ab62015-10-29 00:43:26 -0700115# Chrome D-Bus bindings.
Alex Deymod5561a52015-09-03 23:17:52 -0700116include $(CLEAR_VARS)
117LOCAL_MODULE := update_engine-dbus-adaptor
Alex Deymoc372ab62015-10-29 00:43:26 -0700118LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Alex Deymod5561a52015-09-03 23:17:52 -0700119LOCAL_SRC_FILES := \
120 dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml
121include $(BUILD_STATIC_LIBRARY)
122
123# update_engine-dbus-libcros-client (from generate-dbus-proxies.gypi)
124# ========================================================
125include $(CLEAR_VARS)
126LOCAL_MODULE := update_engine-dbus-libcros-client
Alex Deymoc372ab62015-10-29 00:43:26 -0700127LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Alex Deymod5561a52015-09-03 23:17:52 -0700128LOCAL_SRC_FILES := \
129 dbus_bindings/org.chromium.LibCrosService.dbus-xml
130LOCAL_DBUS_PROXY_PREFIX := libcros
131include $(BUILD_STATIC_LIBRARY)
132
Alex Deymo78a954f2016-01-21 20:32:40 -0800133endif # local_use_dbus == 1
Alex Deymo4218b7e2015-11-17 21:14:42 -0300134
Alex Deymo39910dc2015-11-09 17:04:30 -0800135# libpayload_consumer (type: static_library)
Alex Deymod5561a52015-09-03 23:17:52 -0700136# ========================================================
Alex Deymo39910dc2015-11-09 17:04:30 -0800137# The payload application component and common dependencies.
Alex Deymo39910dc2015-11-09 17:04:30 -0800138ue_libpayload_consumer_exported_static_libraries := \
139 update_metadata-protos \
Alex Deymo05e0e382015-12-07 20:18:16 -0800140 libxz-host \
Alex Deymo39910dc2015-11-09 17:04:30 -0800141 libbz \
Alex Deymo39910dc2015-11-09 17:04:30 -0800142 $(ue_update_metadata_protos_exported_static_libraries)
143ue_libpayload_consumer_exported_shared_libraries := \
Alex Deymo05e0e382015-12-07 20:18:16 -0800144 libcrypto-host \
145 libcurl-host \
146 libssl-host \
Alex Deymo39910dc2015-11-09 17:04:30 -0800147 $(ue_update_metadata_protos_exported_shared_libraries)
148
Alex Deymo05e0e382015-12-07 20:18:16 -0800149ue_libpayload_consumer_src_files := \
Alex Deymo39910dc2015-11-09 17:04:30 -0800150 common/action_processor.cc \
Alex Deymo39910dc2015-11-09 17:04:30 -0800151 common/boot_control_stub.cc \
152 common/certificate_checker.cc \
153 common/clock.cc \
154 common/constants.cc \
Alex Deymoab0d9762016-02-02 10:52:56 -0800155 common/cpu_limiter.cc \
Alex Deymoe88e9fe2016-02-03 16:38:00 -0800156 common/error_code_utils.cc \
Alex Deymo39910dc2015-11-09 17:04:30 -0800157 common/hash_calculator.cc \
158 common/http_common.cc \
159 common/http_fetcher.cc \
160 common/hwid_override.cc \
161 common/libcurl_http_fetcher.cc \
162 common/multi_range_http_fetcher.cc \
163 common/platform_constants_android.cc \
164 common/prefs.cc \
165 common/subprocess.cc \
166 common/terminator.cc \
167 common/utils.cc \
168 payload_consumer/bzip_extent_writer.cc \
169 payload_consumer/delta_performer.cc \
170 payload_consumer/download_action.cc \
171 payload_consumer/extent_writer.cc \
172 payload_consumer/file_descriptor.cc \
173 payload_consumer/file_writer.cc \
174 payload_consumer/filesystem_verifier_action.cc \
175 payload_consumer/install_plan.cc \
176 payload_consumer/payload_constants.cc \
177 payload_consumer/payload_verifier.cc \
178 payload_consumer/postinstall_runner_action.cc \
179 payload_consumer/xz_extent_writer.cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800180
181ifeq ($(HOST_OS),linux)
182# Build for the host.
183include $(CLEAR_VARS)
184LOCAL_MODULE := libpayload_consumer
185LOCAL_MODULE_CLASS := STATIC_LIBRARIES
186LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800187LOCAL_CLANG := true
188LOCAL_CFLAGS := $(ue_common_cflags)
189LOCAL_CPPFLAGS := $(ue_common_cppflags)
190LOCAL_LDFLAGS := $(ue_common_ldflags)
191LOCAL_C_INCLUDES := \
192 $(ue_common_c_includes) \
193 external/e2fsprogs/lib
194LOCAL_STATIC_LIBRARIES := \
195 update_metadata-protos \
196 $(ue_libpayload_consumer_exported_static_libraries) \
197 $(ue_update_metadata_protos_exported_static_libraries)
198LOCAL_SHARED_LIBRARIES := \
199 $(ue_common_shared_libraries) \
200 $(ue_libpayload_consumer_exported_shared_libraries) \
201 $(ue_update_metadata_protos_exported_shared_libraries)
202LOCAL_SRC_FILES := $(ue_libpayload_consumer_src_files)
203include $(BUILD_HOST_STATIC_LIBRARY)
204endif # HOST_OS == linux
205
206# Build for the target.
207include $(CLEAR_VARS)
208LOCAL_MODULE := libpayload_consumer
209LOCAL_MODULE_CLASS := STATIC_LIBRARIES
210LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800211LOCAL_CLANG := true
212LOCAL_CFLAGS := $(ue_common_cflags)
213LOCAL_CPPFLAGS := $(ue_common_cppflags)
214LOCAL_LDFLAGS := $(ue_common_ldflags)
215LOCAL_C_INCLUDES := \
216 $(ue_common_c_includes) \
217 external/e2fsprogs/lib
218LOCAL_STATIC_LIBRARIES := \
219 update_metadata-protos \
220 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
221 $(ue_update_metadata_protos_exported_static_libraries)
222LOCAL_SHARED_LIBRARIES := \
223 $(ue_common_shared_libraries) \
224 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
225 $(ue_update_metadata_protos_exported_shared_libraries)
226LOCAL_SRC_FILES := $(ue_libpayload_consumer_src_files)
Alex Deymo39910dc2015-11-09 17:04:30 -0800227include $(BUILD_STATIC_LIBRARY)
228
Alex Deymofa78f142016-01-26 21:36:16 -0800229ifdef BRILLO
Alex Deymo4218b7e2015-11-17 21:14:42 -0300230
Alex Deymo39910dc2015-11-09 17:04:30 -0800231# libupdate_engine (type: static_library)
232# ========================================================
233# The main daemon static_library with all the code used to check for updates
234# with Omaha and expose a DBus daemon.
235ue_libupdate_engine_exported_c_includes := \
236 $(LOCAL_PATH)/include \
Alex Deymob09305e2015-12-02 16:09:13 -0300237 external/cros/system_api/dbus
Alex Deymoc372ab62015-10-29 00:43:26 -0700238ue_libupdate_engine_exported_static_libraries := \
Alex Deymo39910dc2015-11-09 17:04:30 -0800239 libpayload_consumer \
Alex Deymod5561a52015-09-03 23:17:52 -0700240 update_metadata-protos \
241 update_engine-dbus-adaptor \
242 update_engine-dbus-libcros-client \
243 update_engine_client-dbus-proxies \
David Zeuthen753fadc2015-09-15 16:34:09 -0400244 libbz \
Alex Deymoc372ab62015-10-29 00:43:26 -0700245 libfs_mgr \
Alex Deymo39910dc2015-11-09 17:04:30 -0800246 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700247 $(ue_update_metadata_protos_exported_static_libraries)
248ue_libupdate_engine_exported_shared_libraries := \
Alex Deymod5561a52015-09-03 23:17:52 -0700249 libdbus \
Alex Deymo05e0e382015-12-07 20:18:16 -0800250 libbrillo-dbus \
251 libchrome-dbus \
Alex Deymod5561a52015-09-03 23:17:52 -0700252 libmetrics \
Alex Deymo7eb23052015-10-09 15:27:59 -0700253 libshill-client \
Alex Deymod5561a52015-09-03 23:17:52 -0700254 libexpat \
Alex Vakulenko1bab5a82015-10-27 11:47:28 -0700255 libbrillo-policy \
Alex Deymoeadab7d2015-10-09 14:45:02 -0700256 libhardware \
Alex Deymoc372ab62015-10-29 00:43:26 -0700257 libcutils \
Alex Deymo39910dc2015-11-09 17:04:30 -0800258 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700259 $(ue_update_metadata_protos_exported_shared_libraries)
Alex Deymoc0037902016-01-23 17:29:02 -0800260ifeq ($(local_use_binder),1)
261ue_libupdate_engine_exported_shared_libraries += \
262 libbinder \
263 libbinderwrapper \
264 libbrillo-binder \
265 libutils
266endif # local_use_binder == 1
Alex Deymo78a954f2016-01-21 20:32:40 -0800267ifeq ($(local_use_weave),1)
Alex Deymof7ead812015-10-23 17:37:27 -0700268ue_libupdate_engine_exported_shared_libraries += \
Alex Deymo7ff02cf2016-01-22 11:06:51 -0800269 libbinderwrapper \
270 libbrillo-binder \
Alex Deymof7ead812015-10-23 17:37:27 -0700271 libweaved
Alex Deymo78a954f2016-01-21 20:32:40 -0800272endif # local_use_weave == 1
Alex Deymoc372ab62015-10-29 00:43:26 -0700273
274include $(CLEAR_VARS)
275LOCAL_MODULE := libupdate_engine
276LOCAL_MODULE_CLASS := STATIC_LIBRARIES
277LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700278LOCAL_CLANG := true
279LOCAL_EXPORT_C_INCLUDE_DIRS := $(ue_libupdate_engine_exported_c_includes)
280LOCAL_CFLAGS := $(ue_common_cflags)
281LOCAL_CPPFLAGS := $(ue_common_cppflags)
282LOCAL_LDFLAGS := $(ue_common_ldflags)
283LOCAL_C_INCLUDES := \
284 $(ue_common_c_includes) \
Alex Deymob09305e2015-12-02 16:09:13 -0300285 $(ue_libupdate_engine_exported_c_includes)
Alex Deymoc372ab62015-10-29 00:43:26 -0700286LOCAL_STATIC_LIBRARIES := \
Alex Deymo39910dc2015-11-09 17:04:30 -0800287 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700288 update_metadata-protos \
289 update_engine-dbus-adaptor \
290 update_engine-dbus-libcros-client \
291 update_engine_client-dbus-proxies \
Alex Deymo05e0e382015-12-07 20:18:16 -0800292 $(ue_libupdate_engine_exported_static_libraries:-host=) \
293 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700294 $(ue_update_metadata_protos_exported_static_libraries)
295LOCAL_SHARED_LIBRARIES := \
296 $(ue_common_shared_libraries) \
Alex Deymo05e0e382015-12-07 20:18:16 -0800297 $(ue_libupdate_engine_exported_shared_libraries:-host=) \
298 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700299 $(ue_update_metadata_protos_exported_shared_libraries)
Alex Deymod5561a52015-09-03 23:17:52 -0700300LOCAL_SRC_FILES := \
Alex Deymo1b03f9f2015-12-09 00:38:36 -0800301 boot_control_android.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700302 chrome_browser_proxy_resolver.cc \
Alex Deymo78a954f2016-01-21 20:32:40 -0800303 common_service.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700304 connection_manager.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700305 daemon.cc \
306 dbus_service.cc \
Alex Deymo1b03f9f2015-12-09 00:38:36 -0800307 hardware_android.cc \
Alex Deymo85616652015-10-15 18:48:31 -0700308 image_properties_android.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700309 libcros_proxy.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700310 metrics.cc \
Alex Deymo38429cf2015-11-11 18:27:22 -0800311 metrics_utils.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700312 omaha_request_action.cc \
313 omaha_request_params.cc \
314 omaha_response_handler_action.cc \
315 p2p_manager.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700316 payload_state.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700317 proxy_resolver.cc \
318 real_system_state.cc \
319 shill_proxy.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700320 update_attempter.cc \
321 update_manager/boxed_value.cc \
322 update_manager/chromeos_policy.cc \
323 update_manager/default_policy.cc \
324 update_manager/evaluation_context.cc \
325 update_manager/policy.cc \
326 update_manager/real_config_provider.cc \
327 update_manager/real_device_policy_provider.cc \
328 update_manager/real_random_provider.cc \
329 update_manager/real_shill_provider.cc \
330 update_manager/real_system_provider.cc \
331 update_manager/real_time_provider.cc \
332 update_manager/real_updater_provider.cc \
333 update_manager/state_factory.cc \
334 update_manager/update_manager.cc \
Alex Deymof7ead812015-10-23 17:37:27 -0700335 update_status_utils.cc \
336 weave_service_factory.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800337ifeq ($(local_use_binder),1)
Casey Dahlina93cd532016-01-14 16:55:11 -0800338LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/binder_bindings
Casey Dahlina93cd532016-01-14 16:55:11 -0800339LOCAL_SRC_FILES += \
340 binder_bindings/android/brillo/IUpdateEngine.aidl \
341 binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl \
Alex Deymofa78f142016-01-26 21:36:16 -0800342 binder_service_brillo.cc \
Casey Dahlina93cd532016-01-14 16:55:11 -0800343 parcelable_update_engine_status.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800344endif # local_use_binder == 1
Alex Deymoaabd81e2016-01-26 20:03:08 -0800345ifeq ($(local_use_weave),1)
346LOCAL_SRC_FILES += \
347 weave_service.cc
348endif # local_use_weave == 1
Alex Deymod5561a52015-09-03 23:17:52 -0700349include $(BUILD_STATIC_LIBRARY)
350
Alex Deymofa78f142016-01-26 21:36:16 -0800351else # !defined(BRILLO)
352
353ifneq ($(local_use_binder),1)
354$(error USE_BINDER is disabled but is required in non-Brillo devices.)
355endif # local_use_binder == 1
356
357# libupdate_engine_android (type: static_library)
358# ========================================================
359# The main daemon static_library used in Android (non-Brillo). This only has a
360# loop to apply payloads provided by the upper layer via a Binder interface.
361ue_libupdate_engine_android_exported_static_libraries := \
362 libpayload_consumer \
Alex Deymo5e3ea272016-01-28 13:42:23 -0800363 libfs_mgr \
Alex Deymofa78f142016-01-26 21:36:16 -0800364 $(ue_libpayload_consumer_exported_static_libraries)
365ue_libupdate_engine_android_exported_shared_libraries := \
366 $(ue_libpayload_consumer_exported_shared_libraries) \
367 libbinder \
368 libbinderwrapper \
369 libbrillo-binder \
Alex Deymo5e3ea272016-01-28 13:42:23 -0800370 libcutils \
371 libhardware \
Alex Deymofa78f142016-01-26 21:36:16 -0800372 libutils
373
374include $(CLEAR_VARS)
375LOCAL_MODULE := libupdate_engine_android
376LOCAL_MODULE_CLASS := STATIC_LIBRARIES
377LOCAL_CPP_EXTENSION := .cc
378LOCAL_CLANG := true
379LOCAL_CFLAGS := $(ue_common_cflags)
380LOCAL_CPPFLAGS := $(ue_common_cppflags)
381LOCAL_LDFLAGS := $(ue_common_ldflags)
382LOCAL_C_INCLUDES := $(ue_common_c_includes)
Alex Deymo3b678db2016-02-09 11:50:06 -0800383#TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
384# out of the DBus interface.
385LOCAL_C_INCLUDES += \
386 external/cros/system_api/dbus
Alex Deymofa78f142016-01-26 21:36:16 -0800387LOCAL_STATIC_LIBRARIES := \
388 $(ue_libupdate_engine_android_exported_static_libraries:-host=)
389LOCAL_SHARED_LIBRARIES += \
390 $(ue_common_shared_libraries) \
391 $(ue_libupdate_engine_android_exported_shared_libraries:-host=)
392LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
393LOCAL_SRC_FILES += \
394 binder_bindings/android/os/IUpdateEngine.aidl \
395 binder_bindings/android/os/IUpdateEngineCallback.aidl \
396 binder_service_android.cc \
Alex Deymo5e3ea272016-01-28 13:42:23 -0800397 boot_control_android.cc \
Alex Deymofa78f142016-01-26 21:36:16 -0800398 daemon.cc \
Alex Deymo5e3ea272016-01-28 13:42:23 -0800399 daemon_state_android.cc \
400 hardware_android.cc \
401 proxy_resolver.cc \
Alex Deymo3b678db2016-02-09 11:50:06 -0800402 update_attempter_android.cc \
403 update_status_utils.cc
Alex Deymofa78f142016-01-26 21:36:16 -0800404include $(BUILD_STATIC_LIBRARY)
405
406endif # !defined(BRILLO)
Alex Deymo4218b7e2015-11-17 21:14:42 -0300407
Alex Deymod5561a52015-09-03 23:17:52 -0700408# update_engine (type: executable)
409# ========================================================
410# update_engine daemon.
411include $(CLEAR_VARS)
412LOCAL_MODULE := update_engine
413LOCAL_MODULE_CLASS := EXECUTABLES
Sen Jiang56092772015-11-23 14:41:00 -0800414LOCAL_REQUIRED_MODULES := \
Alex Deymoab494462015-11-30 17:07:36 -0300415 bspatch \
416 cacerts_google
Alex Deymo78a954f2016-01-21 20:32:40 -0800417ifeq ($(local_use_weave),1)
Alex Deymof7ead812015-10-23 17:37:27 -0700418LOCAL_REQUIRED_MODULES += updater.json
Alex Deymo78a954f2016-01-21 20:32:40 -0800419endif # local_use_weave == 1
Alex Deymoc372ab62015-10-29 00:43:26 -0700420LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700421LOCAL_CLANG := true
422LOCAL_CFLAGS := $(ue_common_cflags)
423LOCAL_CPPFLAGS := $(ue_common_cppflags)
424LOCAL_LDFLAGS := $(ue_common_ldflags)
425LOCAL_C_INCLUDES := \
Alex Deymo4218b7e2015-11-17 21:14:42 -0300426 $(ue_common_c_includes)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800427LOCAL_SHARED_LIBRARIES := \
428 $(ue_common_shared_libraries)
429LOCAL_SRC_FILES := \
430 main.cc
Alex Deymo4218b7e2015-11-17 21:14:42 -0300431
432ifdef BRILLO
Alex Deymo4218b7e2015-11-17 21:14:42 -0300433LOCAL_C_INCLUDES += \
Alex Deymoc372ab62015-10-29 00:43:26 -0700434 $(ue_libupdate_engine_exported_c_includes)
435LOCAL_STATIC_LIBRARIES := \
Alex Deymod5561a52015-09-03 23:17:52 -0700436 libupdate_engine \
Alex Deymo05e0e382015-12-07 20:18:16 -0800437 $(ue_libupdate_engine_exported_static_libraries:-host=)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800438LOCAL_SHARED_LIBRARIES += \
Alex Deymo05e0e382015-12-07 20:18:16 -0800439 $(ue_libupdate_engine_exported_shared_libraries:-host=)
Christopher Wiley9e1eda92015-11-16 15:23:37 -0800440else # !defined(BRILLO)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800441LOCAL_STATIC_LIBRARIES := \
Alex Deymofa78f142016-01-26 21:36:16 -0800442 libupdate_engine_android \
443 $(ue_libupdate_engine_android_exported_static_libraries:-host=)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800444LOCAL_SHARED_LIBRARIES += \
Alex Deymofa78f142016-01-26 21:36:16 -0800445 $(ue_libupdate_engine_android_exported_shared_libraries:-host=)
446endif # !defined(BRILLO)
Casey Dahlina93cd532016-01-14 16:55:11 -0800447
Gilad Arnold70141f22015-09-17 09:06:30 -0700448LOCAL_INIT_RC := update_engine.rc
Alex Deymod5561a52015-09-03 23:17:52 -0700449include $(BUILD_EXECUTABLE)
450
451# update_engine_client (type: executable)
452# ========================================================
453# update_engine console client.
454include $(CLEAR_VARS)
455LOCAL_MODULE := update_engine_client
456LOCAL_MODULE_CLASS := EXECUTABLES
Alex Deymoc372ab62015-10-29 00:43:26 -0700457LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700458LOCAL_CLANG := true
459LOCAL_CFLAGS := $(ue_common_cflags)
460LOCAL_CPPFLAGS := $(ue_common_cppflags)
461LOCAL_LDFLAGS := $(ue_common_ldflags)
Casey Dahlince90f442016-01-25 16:55:28 -0800462LOCAL_C_INCLUDES := $(ue_common_c_includes)
Alex Deymo5f528112016-01-27 23:32:36 -0800463LOCAL_SHARED_LIBRARIES := $(ue_common_shared_libraries)
464ifdef BRILLO
465LOCAL_SHARED_LIBRARIES += \
Casey Dahline844c1a2015-12-16 14:30:58 -0800466 libupdate_engine_client
Alex Deymod5561a52015-09-03 23:17:52 -0700467LOCAL_SRC_FILES := \
Shuqian Zhao29971732016-02-05 11:29:32 -0800468 update_engine_client.cc \
469 common/error_code_utils.cc
Alex Deymo5f528112016-01-27 23:32:36 -0800470else # !defined(BRILLO)
471#TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
472# out of the DBus interface.
473LOCAL_C_INCLUDES += \
474 external/cros/system_api/dbus
475LOCAL_SHARED_LIBRARIES += \
476 libbinder \
Alex Deymo2130ee02016-02-02 18:35:50 -0800477 libbinderwrapper \
Alex Deymo5f528112016-01-27 23:32:36 -0800478 libbrillo-binder \
479 libutils
480LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
481LOCAL_SRC_FILES := \
482 binder_bindings/android/os/IUpdateEngine.aidl \
483 binder_bindings/android/os/IUpdateEngineCallback.aidl \
Alex Deymoe88e9fe2016-02-03 16:38:00 -0800484 common/error_code_utils.cc \
Alex Deymo5f528112016-01-27 23:32:36 -0800485 update_engine_client_android.cc \
486 update_status_utils.cc
487endif # !defined(BRILLO)
Alex Deymod5561a52015-09-03 23:17:52 -0700488include $(BUILD_EXECUTABLE)
489
490# libpayload_generator (type: static_library)
491# ========================================================
492# server-side code. This is used for delta_generator and unittests but not
493# for any client code.
Alex Deymoc372ab62015-10-29 00:43:26 -0700494ue_libpayload_generator_exported_static_libraries := \
Alex Deymob09305e2015-12-02 16:09:13 -0300495 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700496 update_metadata-protos \
Alex Deymob09305e2015-12-02 16:09:13 -0300497 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700498 $(ue_update_metadata_protos_exported_static_libraries)
499ue_libpayload_generator_exported_shared_libraries := \
Alex Deymo05e0e382015-12-07 20:18:16 -0800500 libext2fs-host \
Alex Deymob09305e2015-12-02 16:09:13 -0300501 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700502 $(ue_update_metadata_protos_exported_shared_libraries)
503
Alex Deymo05e0e382015-12-07 20:18:16 -0800504ue_libpayload_generator_src_files := \
Alex Deymod5561a52015-09-03 23:17:52 -0700505 payload_generator/ab_generator.cc \
506 payload_generator/annotated_operation.cc \
507 payload_generator/blob_file_writer.cc \
508 payload_generator/block_mapping.cc \
Alex Deymo0bc26112015-10-19 20:54:57 -0700509 payload_generator/bzip.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700510 payload_generator/cycle_breaker.cc \
511 payload_generator/delta_diff_generator.cc \
512 payload_generator/delta_diff_utils.cc \
513 payload_generator/ext2_filesystem.cc \
514 payload_generator/extent_ranges.cc \
515 payload_generator/extent_utils.cc \
516 payload_generator/full_update_generator.cc \
517 payload_generator/graph_types.cc \
518 payload_generator/graph_utils.cc \
519 payload_generator/inplace_generator.cc \
520 payload_generator/payload_file.cc \
521 payload_generator/payload_generation_config.cc \
522 payload_generator/payload_signer.cc \
523 payload_generator/raw_filesystem.cc \
524 payload_generator/tarjan.cc \
525 payload_generator/topological_sort.cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800526
527ifeq ($(HOST_OS),linux)
528# Build for the host.
529include $(CLEAR_VARS)
530LOCAL_MODULE := libpayload_generator
531LOCAL_MODULE_CLASS := STATIC_LIBRARIES
532LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800533LOCAL_CLANG := true
534LOCAL_CFLAGS := $(ue_common_cflags)
535LOCAL_CPPFLAGS := $(ue_common_cppflags)
536LOCAL_LDFLAGS := $(ue_common_ldflags)
537LOCAL_C_INCLUDES := $(ue_common_c_includes)
538LOCAL_STATIC_LIBRARIES := \
539 libpayload_consumer \
540 update_metadata-protos \
541 $(ue_libpayload_consumer_exported_static_libraries) \
542 $(ue_update_metadata_protos_exported_static_libraries)
543LOCAL_SHARED_LIBRARIES := \
544 $(ue_common_shared_libraries) \
545 $(ue_libpayload_generator_exported_shared_libraries) \
546 $(ue_libpayload_consumer_exported_shared_libraries) \
547 $(ue_update_metadata_protos_exported_shared_libraries)
548LOCAL_SRC_FILES := $(ue_libpayload_generator_src_files)
549include $(BUILD_HOST_STATIC_LIBRARY)
550endif # HOST_OS == linux
551
552# Build for the target.
553include $(CLEAR_VARS)
554LOCAL_MODULE := libpayload_generator
555LOCAL_MODULE_CLASS := STATIC_LIBRARIES
556LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800557LOCAL_CLANG := true
558LOCAL_CFLAGS := $(ue_common_cflags)
559LOCAL_CPPFLAGS := $(ue_common_cppflags)
560LOCAL_LDFLAGS := $(ue_common_ldflags)
561LOCAL_C_INCLUDES := $(ue_common_c_includes)
562LOCAL_STATIC_LIBRARIES := \
563 libpayload_consumer \
564 update_metadata-protos \
565 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
566 $(ue_update_metadata_protos_exported_static_libraries)
567LOCAL_SHARED_LIBRARIES := \
568 $(ue_common_shared_libraries) \
569 $(ue_libpayload_generator_exported_shared_libraries:-host=) \
570 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
571 $(ue_update_metadata_protos_exported_shared_libraries)
572LOCAL_SRC_FILES := $(ue_libpayload_generator_src_files)
Alex Deymod5561a52015-09-03 23:17:52 -0700573include $(BUILD_STATIC_LIBRARY)
574
575# delta_generator (type: executable)
576# ========================================================
577# server-side delta generator.
Alex Deymo05e0e382015-12-07 20:18:16 -0800578ue_delta_generator_src_files := \
579 payload_generator/generate_delta_main.cc
580
581ifeq ($(HOST_OS),linux)
582# Build for the host.
Alex Deymod5561a52015-09-03 23:17:52 -0700583include $(CLEAR_VARS)
584LOCAL_MODULE := delta_generator
585LOCAL_MODULE_CLASS := EXECUTABLES
Alex Deymoc372ab62015-10-29 00:43:26 -0700586LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700587LOCAL_CLANG := true
588LOCAL_CFLAGS := $(ue_common_cflags)
589LOCAL_CPPFLAGS := $(ue_common_cppflags)
590LOCAL_LDFLAGS := $(ue_common_ldflags)
Alex Deymob09305e2015-12-02 16:09:13 -0300591LOCAL_C_INCLUDES := $(ue_common_c_includes)
Alex Deymoc372ab62015-10-29 00:43:26 -0700592LOCAL_STATIC_LIBRARIES := \
Alex Deymob09305e2015-12-02 16:09:13 -0300593 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700594 libpayload_generator \
Alex Deymob09305e2015-12-02 16:09:13 -0300595 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700596 $(ue_libpayload_generator_exported_static_libraries)
597LOCAL_SHARED_LIBRARIES := \
598 $(ue_common_shared_libraries) \
Alex Deymob09305e2015-12-02 16:09:13 -0300599 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700600 $(ue_libpayload_generator_exported_shared_libraries)
Alex Deymo05e0e382015-12-07 20:18:16 -0800601LOCAL_SRC_FILES := $(ue_delta_generator_src_files)
602include $(BUILD_HOST_EXECUTABLE)
603endif # HOST_OS == linux
604
605# Build for the target.
606include $(CLEAR_VARS)
607LOCAL_MODULE := delta_generator
608LOCAL_MODULE_CLASS := EXECUTABLES
609LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800610LOCAL_CLANG := true
611LOCAL_CFLAGS := $(ue_common_cflags)
612LOCAL_CPPFLAGS := $(ue_common_cppflags)
613LOCAL_LDFLAGS := $(ue_common_ldflags)
614LOCAL_C_INCLUDES := $(ue_common_c_includes)
615LOCAL_STATIC_LIBRARIES := \
616 libpayload_consumer \
617 libpayload_generator \
618 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
619 $(ue_libpayload_generator_exported_static_libraries:-host=)
620LOCAL_SHARED_LIBRARIES := \
621 $(ue_common_shared_libraries) \
622 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
623 $(ue_libpayload_generator_exported_shared_libraries:-host=)
624LOCAL_SRC_FILES := $(ue_delta_generator_src_files)
Alex Deymod5561a52015-09-03 23:17:52 -0700625include $(BUILD_EXECUTABLE)
626
Christopher Wiley16daa082015-10-01 17:18:40 -0700627# libupdate_engine_client
628# ========================================================
629include $(CLEAR_VARS)
630LOCAL_MODULE := libupdate_engine_client
Christopher Wiley16daa082015-10-01 17:18:40 -0700631LOCAL_CFLAGS := \
632 -Wall \
633 -Werror \
Casey Dahlina93cd532016-01-14 16:55:11 -0800634 -Wno-unused-parameter \
Alex Deymo71d7c212016-01-22 11:54:20 -0800635 -DUSE_DBUS=$(local_use_dbus) \
Alex Deymo78a954f2016-01-21 20:32:40 -0800636 -DUSE_BINDER=$(local_use_binder)
Christopher Wiley16daa082015-10-01 17:18:40 -0700637LOCAL_CLANG := true
638LOCAL_CPP_EXTENSION := .cc
Alex Deymo71d7c212016-01-22 11:54:20 -0800639# TODO(deymo): Remove "external/cros/system_api/dbus" when dbus is not used.
Christopher Wiley16daa082015-10-01 17:18:40 -0700640LOCAL_C_INCLUDES := \
641 $(LOCAL_PATH)/client_library/include \
642 external/cros/system_api/dbus \
643 system \
644 external/gtest/include
645LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/client_library/include
646LOCAL_SHARED_LIBRARIES := \
647 libchrome \
Alex Deymo71d7c212016-01-22 11:54:20 -0800648 libbrillo
Christopher Wiley16daa082015-10-01 17:18:40 -0700649LOCAL_SRC_FILES := \
650 client_library/client.cc \
Christopher Wiley16daa082015-10-01 17:18:40 -0700651 update_status_utils.cc
Casey Dahlina93cd532016-01-14 16:55:11 -0800652
Alex Deymo71d7c212016-01-22 11:54:20 -0800653# We can only compile support for one IPC mechanism. If both "binder" and "dbus"
654# are defined, we prefer binder.
Alex Deymo78a954f2016-01-21 20:32:40 -0800655ifeq ($(local_use_binder),1)
Casey Dahlina93cd532016-01-14 16:55:11 -0800656LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
Casey Dahlina93cd532016-01-14 16:55:11 -0800657LOCAL_SHARED_LIBRARIES += \
658 libbinder \
Casey Dahlin40892492016-01-25 16:55:28 -0800659 libbrillo-binder \
Casey Dahlina93cd532016-01-14 16:55:11 -0800660 libutils
Alex Deymo71d7c212016-01-22 11:54:20 -0800661LOCAL_SRC_FILES += \
662 binder_bindings/android/brillo/IUpdateEngine.aidl \
663 binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl \
664 client_library/client_binder.cc \
665 parcelable_update_engine_status.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800666else # local_use_binder != 1
Alex Deymo71d7c212016-01-22 11:54:20 -0800667LOCAL_STATIC_LIBRARIES := \
668 update_engine_client-dbus-proxies
669LOCAL_SHARED_LIBRARIES += \
670 libchrome-dbus \
671 libbrillo-dbus
672LOCAL_SRC_FILES += \
673 client_library/client_dbus.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800674endif # local_use_binder == 1
Casey Dahlina93cd532016-01-14 16:55:11 -0800675
Christopher Wiley16daa082015-10-01 17:18:40 -0700676include $(BUILD_SHARED_LIBRARY)
677
Alex Deymof7ead812015-10-23 17:37:27 -0700678# Weave schema files
679# ========================================================
680include $(CLEAR_VARS)
681LOCAL_MODULE := updater.json
682LOCAL_MODULE_CLASS := ETC
683LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/weaved/traits
684LOCAL_SRC_FILES := weaved/traits/$(LOCAL_MODULE)
685include $(BUILD_PREBUILT)
686
Gaurav Shah263614f2015-09-24 14:20:38 -0700687# Update payload signing public key.
688# ========================================================
Alex Deymo50e24f42016-01-27 20:48:54 -0800689ifdef BRILLO
Gaurav Shah263614f2015-09-24 14:20:38 -0700690include $(CLEAR_VARS)
691LOCAL_MODULE := brillo-update-payload-key
692LOCAL_MODULE_CLASS := ETC
693LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/update_engine
694LOCAL_MODULE_STEM := update-payload-key.pub.pem
695LOCAL_SRC_FILES := update_payload_key/brillo-update-payload-key.pub.pem
696LOCAL_BUILT_MODULE_STEM := update_payload_key/brillo-update-payload-key.pub.pem
697include $(BUILD_PREBUILT)
Alex Deymo50e24f42016-01-27 20:48:54 -0800698endif # BRILLO
Tao Bao042f8a12016-01-07 16:52:14 -0800699
700# Brillo update payload generation script
701# ========================================================
702ifeq ($(HOST_OS),linux)
703include $(CLEAR_VARS)
704LOCAL_SRC_FILES := scripts/brillo_update_payload
705LOCAL_MODULE := brillo_update_payload
706LOCAL_MODULE_CLASS := EXECUTABLES
707LOCAL_IS_HOST_MODULE := true
708LOCAL_MODULE_TAGS := optional
709LOCAL_REQUIRED_MODULES := \
710 delta_generator \
711 shflags
712include $(BUILD_PREBUILT)
713endif # HOST_OS == linux