blob: 686414de9af6b267395198dcfed51be37402414b [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 Deymo39910dc2015-11-09 17:04:30 -0800156 common/hash_calculator.cc \
157 common/http_common.cc \
158 common/http_fetcher.cc \
159 common/hwid_override.cc \
160 common/libcurl_http_fetcher.cc \
161 common/multi_range_http_fetcher.cc \
162 common/platform_constants_android.cc \
163 common/prefs.cc \
164 common/subprocess.cc \
165 common/terminator.cc \
166 common/utils.cc \
167 payload_consumer/bzip_extent_writer.cc \
168 payload_consumer/delta_performer.cc \
169 payload_consumer/download_action.cc \
170 payload_consumer/extent_writer.cc \
171 payload_consumer/file_descriptor.cc \
172 payload_consumer/file_writer.cc \
173 payload_consumer/filesystem_verifier_action.cc \
174 payload_consumer/install_plan.cc \
175 payload_consumer/payload_constants.cc \
176 payload_consumer/payload_verifier.cc \
177 payload_consumer/postinstall_runner_action.cc \
178 payload_consumer/xz_extent_writer.cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800179
180ifeq ($(HOST_OS),linux)
181# Build for the host.
182include $(CLEAR_VARS)
183LOCAL_MODULE := libpayload_consumer
184LOCAL_MODULE_CLASS := STATIC_LIBRARIES
185LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800186LOCAL_CLANG := true
187LOCAL_CFLAGS := $(ue_common_cflags)
188LOCAL_CPPFLAGS := $(ue_common_cppflags)
189LOCAL_LDFLAGS := $(ue_common_ldflags)
190LOCAL_C_INCLUDES := \
191 $(ue_common_c_includes) \
192 external/e2fsprogs/lib
193LOCAL_STATIC_LIBRARIES := \
194 update_metadata-protos \
195 $(ue_libpayload_consumer_exported_static_libraries) \
196 $(ue_update_metadata_protos_exported_static_libraries)
197LOCAL_SHARED_LIBRARIES := \
198 $(ue_common_shared_libraries) \
199 $(ue_libpayload_consumer_exported_shared_libraries) \
200 $(ue_update_metadata_protos_exported_shared_libraries)
201LOCAL_SRC_FILES := $(ue_libpayload_consumer_src_files)
202include $(BUILD_HOST_STATIC_LIBRARY)
203endif # HOST_OS == linux
204
205# Build for the target.
206include $(CLEAR_VARS)
207LOCAL_MODULE := libpayload_consumer
208LOCAL_MODULE_CLASS := STATIC_LIBRARIES
209LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800210LOCAL_CLANG := true
211LOCAL_CFLAGS := $(ue_common_cflags)
212LOCAL_CPPFLAGS := $(ue_common_cppflags)
213LOCAL_LDFLAGS := $(ue_common_ldflags)
214LOCAL_C_INCLUDES := \
215 $(ue_common_c_includes) \
216 external/e2fsprogs/lib
217LOCAL_STATIC_LIBRARIES := \
218 update_metadata-protos \
219 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
220 $(ue_update_metadata_protos_exported_static_libraries)
221LOCAL_SHARED_LIBRARIES := \
222 $(ue_common_shared_libraries) \
223 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
224 $(ue_update_metadata_protos_exported_shared_libraries)
225LOCAL_SRC_FILES := $(ue_libpayload_consumer_src_files)
Alex Deymo39910dc2015-11-09 17:04:30 -0800226include $(BUILD_STATIC_LIBRARY)
227
Alex Deymofa78f142016-01-26 21:36:16 -0800228ifdef BRILLO
Alex Deymo4218b7e2015-11-17 21:14:42 -0300229
Alex Deymo39910dc2015-11-09 17:04:30 -0800230# libupdate_engine (type: static_library)
231# ========================================================
232# The main daemon static_library with all the code used to check for updates
233# with Omaha and expose a DBus daemon.
234ue_libupdate_engine_exported_c_includes := \
235 $(LOCAL_PATH)/include \
Alex Deymob09305e2015-12-02 16:09:13 -0300236 external/cros/system_api/dbus
Alex Deymoc372ab62015-10-29 00:43:26 -0700237ue_libupdate_engine_exported_static_libraries := \
Alex Deymo39910dc2015-11-09 17:04:30 -0800238 libpayload_consumer \
Alex Deymod5561a52015-09-03 23:17:52 -0700239 update_metadata-protos \
240 update_engine-dbus-adaptor \
241 update_engine-dbus-libcros-client \
242 update_engine_client-dbus-proxies \
David Zeuthen753fadc2015-09-15 16:34:09 -0400243 libbz \
Alex Deymoc372ab62015-10-29 00:43:26 -0700244 libfs_mgr \
Alex Deymo39910dc2015-11-09 17:04:30 -0800245 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700246 $(ue_update_metadata_protos_exported_static_libraries)
247ue_libupdate_engine_exported_shared_libraries := \
Alex Deymod5561a52015-09-03 23:17:52 -0700248 libdbus \
Alex Deymo05e0e382015-12-07 20:18:16 -0800249 libbrillo-dbus \
250 libchrome-dbus \
Alex Deymod5561a52015-09-03 23:17:52 -0700251 libmetrics \
Alex Deymo7eb23052015-10-09 15:27:59 -0700252 libshill-client \
Alex Deymod5561a52015-09-03 23:17:52 -0700253 libexpat \
Alex Vakulenko1bab5a82015-10-27 11:47:28 -0700254 libbrillo-policy \
Alex Deymoeadab7d2015-10-09 14:45:02 -0700255 libhardware \
Alex Deymoc372ab62015-10-29 00:43:26 -0700256 libcutils \
Alex Deymo39910dc2015-11-09 17:04:30 -0800257 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700258 $(ue_update_metadata_protos_exported_shared_libraries)
Alex Deymoc0037902016-01-23 17:29:02 -0800259ifeq ($(local_use_binder),1)
260ue_libupdate_engine_exported_shared_libraries += \
261 libbinder \
262 libbinderwrapper \
263 libbrillo-binder \
264 libutils
265endif # local_use_binder == 1
Alex Deymo78a954f2016-01-21 20:32:40 -0800266ifeq ($(local_use_weave),1)
Alex Deymof7ead812015-10-23 17:37:27 -0700267ue_libupdate_engine_exported_shared_libraries += \
Alex Deymo7ff02cf2016-01-22 11:06:51 -0800268 libbinderwrapper \
269 libbrillo-binder \
Alex Deymof7ead812015-10-23 17:37:27 -0700270 libweaved
Alex Deymo78a954f2016-01-21 20:32:40 -0800271endif # local_use_weave == 1
Alex Deymoc372ab62015-10-29 00:43:26 -0700272
273include $(CLEAR_VARS)
274LOCAL_MODULE := libupdate_engine
275LOCAL_MODULE_CLASS := STATIC_LIBRARIES
276LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700277LOCAL_CLANG := true
278LOCAL_EXPORT_C_INCLUDE_DIRS := $(ue_libupdate_engine_exported_c_includes)
279LOCAL_CFLAGS := $(ue_common_cflags)
280LOCAL_CPPFLAGS := $(ue_common_cppflags)
281LOCAL_LDFLAGS := $(ue_common_ldflags)
282LOCAL_C_INCLUDES := \
283 $(ue_common_c_includes) \
Alex Deymob09305e2015-12-02 16:09:13 -0300284 $(ue_libupdate_engine_exported_c_includes)
Alex Deymoc372ab62015-10-29 00:43:26 -0700285LOCAL_STATIC_LIBRARIES := \
Alex Deymo39910dc2015-11-09 17:04:30 -0800286 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700287 update_metadata-protos \
288 update_engine-dbus-adaptor \
289 update_engine-dbus-libcros-client \
290 update_engine_client-dbus-proxies \
Alex Deymo05e0e382015-12-07 20:18:16 -0800291 $(ue_libupdate_engine_exported_static_libraries:-host=) \
292 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700293 $(ue_update_metadata_protos_exported_static_libraries)
294LOCAL_SHARED_LIBRARIES := \
295 $(ue_common_shared_libraries) \
Alex Deymo05e0e382015-12-07 20:18:16 -0800296 $(ue_libupdate_engine_exported_shared_libraries:-host=) \
297 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700298 $(ue_update_metadata_protos_exported_shared_libraries)
Alex Deymod5561a52015-09-03 23:17:52 -0700299LOCAL_SRC_FILES := \
Alex Deymo1b03f9f2015-12-09 00:38:36 -0800300 boot_control_android.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700301 chrome_browser_proxy_resolver.cc \
Alex Deymo78a954f2016-01-21 20:32:40 -0800302 common_service.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700303 connection_manager.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700304 daemon.cc \
305 dbus_service.cc \
Alex Deymo1b03f9f2015-12-09 00:38:36 -0800306 hardware_android.cc \
Alex Deymo85616652015-10-15 18:48:31 -0700307 image_properties_android.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700308 libcros_proxy.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700309 metrics.cc \
Alex Deymo38429cf2015-11-11 18:27:22 -0800310 metrics_utils.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700311 omaha_request_action.cc \
312 omaha_request_params.cc \
313 omaha_response_handler_action.cc \
314 p2p_manager.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700315 payload_state.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700316 proxy_resolver.cc \
317 real_system_state.cc \
318 shill_proxy.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700319 update_attempter.cc \
320 update_manager/boxed_value.cc \
321 update_manager/chromeos_policy.cc \
322 update_manager/default_policy.cc \
323 update_manager/evaluation_context.cc \
324 update_manager/policy.cc \
325 update_manager/real_config_provider.cc \
326 update_manager/real_device_policy_provider.cc \
327 update_manager/real_random_provider.cc \
328 update_manager/real_shill_provider.cc \
329 update_manager/real_system_provider.cc \
330 update_manager/real_time_provider.cc \
331 update_manager/real_updater_provider.cc \
332 update_manager/state_factory.cc \
333 update_manager/update_manager.cc \
Alex Deymof7ead812015-10-23 17:37:27 -0700334 update_status_utils.cc \
335 weave_service_factory.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800336ifeq ($(local_use_binder),1)
Casey Dahlina93cd532016-01-14 16:55:11 -0800337LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/binder_bindings
Casey Dahlina93cd532016-01-14 16:55:11 -0800338LOCAL_SRC_FILES += \
339 binder_bindings/android/brillo/IUpdateEngine.aidl \
340 binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl \
Alex Deymofa78f142016-01-26 21:36:16 -0800341 binder_service_brillo.cc \
Casey Dahlina93cd532016-01-14 16:55:11 -0800342 parcelable_update_engine_status.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800343endif # local_use_binder == 1
Alex Deymoaabd81e2016-01-26 20:03:08 -0800344ifeq ($(local_use_weave),1)
345LOCAL_SRC_FILES += \
346 weave_service.cc
347endif # local_use_weave == 1
Alex Deymod5561a52015-09-03 23:17:52 -0700348include $(BUILD_STATIC_LIBRARY)
349
Alex Deymofa78f142016-01-26 21:36:16 -0800350else # !defined(BRILLO)
351
352ifneq ($(local_use_binder),1)
353$(error USE_BINDER is disabled but is required in non-Brillo devices.)
354endif # local_use_binder == 1
355
356# libupdate_engine_android (type: static_library)
357# ========================================================
358# The main daemon static_library used in Android (non-Brillo). This only has a
359# loop to apply payloads provided by the upper layer via a Binder interface.
360ue_libupdate_engine_android_exported_static_libraries := \
361 libpayload_consumer \
362 $(ue_libpayload_consumer_exported_static_libraries)
363ue_libupdate_engine_android_exported_shared_libraries := \
364 $(ue_libpayload_consumer_exported_shared_libraries) \
365 libbinder \
366 libbinderwrapper \
367 libbrillo-binder \
368 libutils
369
370include $(CLEAR_VARS)
371LOCAL_MODULE := libupdate_engine_android
372LOCAL_MODULE_CLASS := STATIC_LIBRARIES
373LOCAL_CPP_EXTENSION := .cc
374LOCAL_CLANG := true
375LOCAL_CFLAGS := $(ue_common_cflags)
376LOCAL_CPPFLAGS := $(ue_common_cppflags)
377LOCAL_LDFLAGS := $(ue_common_ldflags)
378LOCAL_C_INCLUDES := $(ue_common_c_includes)
379LOCAL_STATIC_LIBRARIES := \
380 $(ue_libupdate_engine_android_exported_static_libraries:-host=)
381LOCAL_SHARED_LIBRARIES += \
382 $(ue_common_shared_libraries) \
383 $(ue_libupdate_engine_android_exported_shared_libraries:-host=)
384LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
385LOCAL_SRC_FILES += \
386 binder_bindings/android/os/IUpdateEngine.aidl \
387 binder_bindings/android/os/IUpdateEngineCallback.aidl \
388 binder_service_android.cc \
389 daemon.cc \
390 daemon_state_android.cc
391include $(BUILD_STATIC_LIBRARY)
392
393endif # !defined(BRILLO)
Alex Deymo4218b7e2015-11-17 21:14:42 -0300394
Alex Deymod5561a52015-09-03 23:17:52 -0700395# update_engine (type: executable)
396# ========================================================
397# update_engine daemon.
398include $(CLEAR_VARS)
399LOCAL_MODULE := update_engine
400LOCAL_MODULE_CLASS := EXECUTABLES
Sen Jiang56092772015-11-23 14:41:00 -0800401LOCAL_REQUIRED_MODULES := \
Alex Deymoab494462015-11-30 17:07:36 -0300402 bspatch \
403 cacerts_google
Alex Deymo78a954f2016-01-21 20:32:40 -0800404ifeq ($(local_use_weave),1)
Alex Deymof7ead812015-10-23 17:37:27 -0700405LOCAL_REQUIRED_MODULES += updater.json
Alex Deymo78a954f2016-01-21 20:32:40 -0800406endif # local_use_weave == 1
Alex Deymoc372ab62015-10-29 00:43:26 -0700407LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700408LOCAL_CLANG := true
409LOCAL_CFLAGS := $(ue_common_cflags)
410LOCAL_CPPFLAGS := $(ue_common_cppflags)
411LOCAL_LDFLAGS := $(ue_common_ldflags)
412LOCAL_C_INCLUDES := \
Alex Deymo4218b7e2015-11-17 21:14:42 -0300413 $(ue_common_c_includes)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800414LOCAL_SHARED_LIBRARIES := \
415 $(ue_common_shared_libraries)
416LOCAL_SRC_FILES := \
417 main.cc
Alex Deymo4218b7e2015-11-17 21:14:42 -0300418
419ifdef BRILLO
Alex Deymo4218b7e2015-11-17 21:14:42 -0300420LOCAL_C_INCLUDES += \
Alex Deymoc372ab62015-10-29 00:43:26 -0700421 $(ue_libupdate_engine_exported_c_includes)
422LOCAL_STATIC_LIBRARIES := \
Alex Deymod5561a52015-09-03 23:17:52 -0700423 libupdate_engine \
Alex Deymo05e0e382015-12-07 20:18:16 -0800424 $(ue_libupdate_engine_exported_static_libraries:-host=)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800425LOCAL_SHARED_LIBRARIES += \
Alex Deymo05e0e382015-12-07 20:18:16 -0800426 $(ue_libupdate_engine_exported_shared_libraries:-host=)
Christopher Wiley9e1eda92015-11-16 15:23:37 -0800427else # !defined(BRILLO)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800428LOCAL_STATIC_LIBRARIES := \
Alex Deymofa78f142016-01-26 21:36:16 -0800429 libupdate_engine_android \
430 $(ue_libupdate_engine_android_exported_static_libraries:-host=)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800431LOCAL_SHARED_LIBRARIES += \
Alex Deymofa78f142016-01-26 21:36:16 -0800432 $(ue_libupdate_engine_android_exported_shared_libraries:-host=)
433endif # !defined(BRILLO)
Casey Dahlina93cd532016-01-14 16:55:11 -0800434
Gilad Arnold70141f22015-09-17 09:06:30 -0700435LOCAL_INIT_RC := update_engine.rc
Alex Deymod5561a52015-09-03 23:17:52 -0700436include $(BUILD_EXECUTABLE)
437
438# update_engine_client (type: executable)
439# ========================================================
440# update_engine console client.
441include $(CLEAR_VARS)
442LOCAL_MODULE := update_engine_client
443LOCAL_MODULE_CLASS := EXECUTABLES
Alex Deymoc372ab62015-10-29 00:43:26 -0700444LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700445LOCAL_CLANG := true
446LOCAL_CFLAGS := $(ue_common_cflags)
447LOCAL_CPPFLAGS := $(ue_common_cppflags)
448LOCAL_LDFLAGS := $(ue_common_ldflags)
Casey Dahlince90f442016-01-25 16:55:28 -0800449LOCAL_C_INCLUDES := $(ue_common_c_includes)
Alex Deymo5f528112016-01-27 23:32:36 -0800450LOCAL_SHARED_LIBRARIES := $(ue_common_shared_libraries)
451ifdef BRILLO
452LOCAL_SHARED_LIBRARIES += \
Casey Dahline844c1a2015-12-16 14:30:58 -0800453 libupdate_engine_client
Alex Deymod5561a52015-09-03 23:17:52 -0700454LOCAL_SRC_FILES := \
455 update_engine_client.cc
Alex Deymo5f528112016-01-27 23:32:36 -0800456else # !defined(BRILLO)
457#TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
458# out of the DBus interface.
459LOCAL_C_INCLUDES += \
460 external/cros/system_api/dbus
461LOCAL_SHARED_LIBRARIES += \
462 libbinder \
Alex Deymo2130ee02016-02-02 18:35:50 -0800463 libbinderwrapper \
Alex Deymo5f528112016-01-27 23:32:36 -0800464 libbrillo-binder \
465 libutils
466LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
467LOCAL_SRC_FILES := \
468 binder_bindings/android/os/IUpdateEngine.aidl \
469 binder_bindings/android/os/IUpdateEngineCallback.aidl \
470 update_engine_client_android.cc \
471 update_status_utils.cc
472endif # !defined(BRILLO)
Alex Deymod5561a52015-09-03 23:17:52 -0700473include $(BUILD_EXECUTABLE)
474
475# libpayload_generator (type: static_library)
476# ========================================================
477# server-side code. This is used for delta_generator and unittests but not
478# for any client code.
Alex Deymoc372ab62015-10-29 00:43:26 -0700479ue_libpayload_generator_exported_static_libraries := \
Alex Deymob09305e2015-12-02 16:09:13 -0300480 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700481 update_metadata-protos \
Alex Deymob09305e2015-12-02 16:09:13 -0300482 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700483 $(ue_update_metadata_protos_exported_static_libraries)
484ue_libpayload_generator_exported_shared_libraries := \
Alex Deymo05e0e382015-12-07 20:18:16 -0800485 libext2fs-host \
Alex Deymob09305e2015-12-02 16:09:13 -0300486 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700487 $(ue_update_metadata_protos_exported_shared_libraries)
488
Alex Deymo05e0e382015-12-07 20:18:16 -0800489ue_libpayload_generator_src_files := \
Alex Deymod5561a52015-09-03 23:17:52 -0700490 payload_generator/ab_generator.cc \
491 payload_generator/annotated_operation.cc \
492 payload_generator/blob_file_writer.cc \
493 payload_generator/block_mapping.cc \
Alex Deymo0bc26112015-10-19 20:54:57 -0700494 payload_generator/bzip.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700495 payload_generator/cycle_breaker.cc \
496 payload_generator/delta_diff_generator.cc \
497 payload_generator/delta_diff_utils.cc \
498 payload_generator/ext2_filesystem.cc \
499 payload_generator/extent_ranges.cc \
500 payload_generator/extent_utils.cc \
501 payload_generator/full_update_generator.cc \
502 payload_generator/graph_types.cc \
503 payload_generator/graph_utils.cc \
504 payload_generator/inplace_generator.cc \
505 payload_generator/payload_file.cc \
506 payload_generator/payload_generation_config.cc \
507 payload_generator/payload_signer.cc \
508 payload_generator/raw_filesystem.cc \
509 payload_generator/tarjan.cc \
510 payload_generator/topological_sort.cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800511
512ifeq ($(HOST_OS),linux)
513# Build for the host.
514include $(CLEAR_VARS)
515LOCAL_MODULE := libpayload_generator
516LOCAL_MODULE_CLASS := STATIC_LIBRARIES
517LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800518LOCAL_CLANG := true
519LOCAL_CFLAGS := $(ue_common_cflags)
520LOCAL_CPPFLAGS := $(ue_common_cppflags)
521LOCAL_LDFLAGS := $(ue_common_ldflags)
522LOCAL_C_INCLUDES := $(ue_common_c_includes)
523LOCAL_STATIC_LIBRARIES := \
524 libpayload_consumer \
525 update_metadata-protos \
526 $(ue_libpayload_consumer_exported_static_libraries) \
527 $(ue_update_metadata_protos_exported_static_libraries)
528LOCAL_SHARED_LIBRARIES := \
529 $(ue_common_shared_libraries) \
530 $(ue_libpayload_generator_exported_shared_libraries) \
531 $(ue_libpayload_consumer_exported_shared_libraries) \
532 $(ue_update_metadata_protos_exported_shared_libraries)
533LOCAL_SRC_FILES := $(ue_libpayload_generator_src_files)
534include $(BUILD_HOST_STATIC_LIBRARY)
535endif # HOST_OS == linux
536
537# Build for the target.
538include $(CLEAR_VARS)
539LOCAL_MODULE := libpayload_generator
540LOCAL_MODULE_CLASS := STATIC_LIBRARIES
541LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800542LOCAL_CLANG := true
543LOCAL_CFLAGS := $(ue_common_cflags)
544LOCAL_CPPFLAGS := $(ue_common_cppflags)
545LOCAL_LDFLAGS := $(ue_common_ldflags)
546LOCAL_C_INCLUDES := $(ue_common_c_includes)
547LOCAL_STATIC_LIBRARIES := \
548 libpayload_consumer \
549 update_metadata-protos \
550 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
551 $(ue_update_metadata_protos_exported_static_libraries)
552LOCAL_SHARED_LIBRARIES := \
553 $(ue_common_shared_libraries) \
554 $(ue_libpayload_generator_exported_shared_libraries:-host=) \
555 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
556 $(ue_update_metadata_protos_exported_shared_libraries)
557LOCAL_SRC_FILES := $(ue_libpayload_generator_src_files)
Alex Deymod5561a52015-09-03 23:17:52 -0700558include $(BUILD_STATIC_LIBRARY)
559
560# delta_generator (type: executable)
561# ========================================================
562# server-side delta generator.
Alex Deymo05e0e382015-12-07 20:18:16 -0800563ue_delta_generator_src_files := \
564 payload_generator/generate_delta_main.cc
565
566ifeq ($(HOST_OS),linux)
567# Build for the host.
Alex Deymod5561a52015-09-03 23:17:52 -0700568include $(CLEAR_VARS)
569LOCAL_MODULE := delta_generator
570LOCAL_MODULE_CLASS := EXECUTABLES
Alex Deymoc372ab62015-10-29 00:43:26 -0700571LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700572LOCAL_CLANG := true
573LOCAL_CFLAGS := $(ue_common_cflags)
574LOCAL_CPPFLAGS := $(ue_common_cppflags)
575LOCAL_LDFLAGS := $(ue_common_ldflags)
Alex Deymob09305e2015-12-02 16:09:13 -0300576LOCAL_C_INCLUDES := $(ue_common_c_includes)
Alex Deymoc372ab62015-10-29 00:43:26 -0700577LOCAL_STATIC_LIBRARIES := \
Alex Deymob09305e2015-12-02 16:09:13 -0300578 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700579 libpayload_generator \
Alex Deymob09305e2015-12-02 16:09:13 -0300580 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700581 $(ue_libpayload_generator_exported_static_libraries)
582LOCAL_SHARED_LIBRARIES := \
583 $(ue_common_shared_libraries) \
Alex Deymob09305e2015-12-02 16:09:13 -0300584 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700585 $(ue_libpayload_generator_exported_shared_libraries)
Alex Deymo05e0e382015-12-07 20:18:16 -0800586LOCAL_SRC_FILES := $(ue_delta_generator_src_files)
587include $(BUILD_HOST_EXECUTABLE)
588endif # HOST_OS == linux
589
590# Build for the target.
591include $(CLEAR_VARS)
592LOCAL_MODULE := delta_generator
593LOCAL_MODULE_CLASS := EXECUTABLES
594LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800595LOCAL_CLANG := true
596LOCAL_CFLAGS := $(ue_common_cflags)
597LOCAL_CPPFLAGS := $(ue_common_cppflags)
598LOCAL_LDFLAGS := $(ue_common_ldflags)
599LOCAL_C_INCLUDES := $(ue_common_c_includes)
600LOCAL_STATIC_LIBRARIES := \
601 libpayload_consumer \
602 libpayload_generator \
603 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
604 $(ue_libpayload_generator_exported_static_libraries:-host=)
605LOCAL_SHARED_LIBRARIES := \
606 $(ue_common_shared_libraries) \
607 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
608 $(ue_libpayload_generator_exported_shared_libraries:-host=)
609LOCAL_SRC_FILES := $(ue_delta_generator_src_files)
Alex Deymod5561a52015-09-03 23:17:52 -0700610include $(BUILD_EXECUTABLE)
611
Christopher Wiley16daa082015-10-01 17:18:40 -0700612# libupdate_engine_client
613# ========================================================
614include $(CLEAR_VARS)
615LOCAL_MODULE := libupdate_engine_client
Christopher Wiley16daa082015-10-01 17:18:40 -0700616LOCAL_CFLAGS := \
617 -Wall \
618 -Werror \
Casey Dahlina93cd532016-01-14 16:55:11 -0800619 -Wno-unused-parameter \
Alex Deymo71d7c212016-01-22 11:54:20 -0800620 -DUSE_DBUS=$(local_use_dbus) \
Alex Deymo78a954f2016-01-21 20:32:40 -0800621 -DUSE_BINDER=$(local_use_binder)
Christopher Wiley16daa082015-10-01 17:18:40 -0700622LOCAL_CLANG := true
623LOCAL_CPP_EXTENSION := .cc
Alex Deymo71d7c212016-01-22 11:54:20 -0800624# TODO(deymo): Remove "external/cros/system_api/dbus" when dbus is not used.
Christopher Wiley16daa082015-10-01 17:18:40 -0700625LOCAL_C_INCLUDES := \
626 $(LOCAL_PATH)/client_library/include \
627 external/cros/system_api/dbus \
628 system \
629 external/gtest/include
630LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/client_library/include
631LOCAL_SHARED_LIBRARIES := \
632 libchrome \
Alex Deymo71d7c212016-01-22 11:54:20 -0800633 libbrillo
Christopher Wiley16daa082015-10-01 17:18:40 -0700634LOCAL_SRC_FILES := \
635 client_library/client.cc \
Christopher Wiley16daa082015-10-01 17:18:40 -0700636 update_status_utils.cc
Casey Dahlina93cd532016-01-14 16:55:11 -0800637
Alex Deymo71d7c212016-01-22 11:54:20 -0800638# We can only compile support for one IPC mechanism. If both "binder" and "dbus"
639# are defined, we prefer binder.
Alex Deymo78a954f2016-01-21 20:32:40 -0800640ifeq ($(local_use_binder),1)
Casey Dahlina93cd532016-01-14 16:55:11 -0800641LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
Casey Dahlina93cd532016-01-14 16:55:11 -0800642LOCAL_SHARED_LIBRARIES += \
643 libbinder \
Casey Dahlin40892492016-01-25 16:55:28 -0800644 libbrillo-binder \
Casey Dahlina93cd532016-01-14 16:55:11 -0800645 libutils
Alex Deymo71d7c212016-01-22 11:54:20 -0800646LOCAL_SRC_FILES += \
647 binder_bindings/android/brillo/IUpdateEngine.aidl \
648 binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl \
649 client_library/client_binder.cc \
650 parcelable_update_engine_status.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800651else # local_use_binder != 1
Alex Deymo71d7c212016-01-22 11:54:20 -0800652LOCAL_STATIC_LIBRARIES := \
653 update_engine_client-dbus-proxies
654LOCAL_SHARED_LIBRARIES += \
655 libchrome-dbus \
656 libbrillo-dbus
657LOCAL_SRC_FILES += \
658 client_library/client_dbus.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800659endif # local_use_binder == 1
Casey Dahlina93cd532016-01-14 16:55:11 -0800660
Christopher Wiley16daa082015-10-01 17:18:40 -0700661include $(BUILD_SHARED_LIBRARY)
662
Alex Deymof7ead812015-10-23 17:37:27 -0700663# Weave schema files
664# ========================================================
665include $(CLEAR_VARS)
666LOCAL_MODULE := updater.json
667LOCAL_MODULE_CLASS := ETC
668LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/weaved/traits
669LOCAL_SRC_FILES := weaved/traits/$(LOCAL_MODULE)
670include $(BUILD_PREBUILT)
671
Gaurav Shah263614f2015-09-24 14:20:38 -0700672# Update payload signing public key.
673# ========================================================
Alex Deymo50e24f42016-01-27 20:48:54 -0800674ifdef BRILLO
Gaurav Shah263614f2015-09-24 14:20:38 -0700675include $(CLEAR_VARS)
676LOCAL_MODULE := brillo-update-payload-key
677LOCAL_MODULE_CLASS := ETC
678LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/update_engine
679LOCAL_MODULE_STEM := update-payload-key.pub.pem
680LOCAL_SRC_FILES := update_payload_key/brillo-update-payload-key.pub.pem
681LOCAL_BUILT_MODULE_STEM := update_payload_key/brillo-update-payload-key.pub.pem
682include $(BUILD_PREBUILT)
Alex Deymo50e24f42016-01-27 20:48:54 -0800683endif # BRILLO
Tao Bao042f8a12016-01-07 16:52:14 -0800684
685# Brillo update payload generation script
686# ========================================================
687ifeq ($(HOST_OS),linux)
688include $(CLEAR_VARS)
689LOCAL_SRC_FILES := scripts/brillo_update_payload
690LOCAL_MODULE := brillo_update_payload
691LOCAL_MODULE_CLASS := EXECUTABLES
692LOCAL_IS_HOST_MODULE := true
693LOCAL_MODULE_TAGS := optional
694LOCAL_REQUIRED_MODULES := \
695 delta_generator \
696 shflags
697include $(BUILD_PREBUILT)
698endif # HOST_OS == linux