blob: 04ecfe5ca2e74ddb6e9585f767921d39b5e8e5c2 [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 Deymo39910dc2015-11-09 17:04:30 -0800155 common/hash_calculator.cc \
156 common/http_common.cc \
157 common/http_fetcher.cc \
158 common/hwid_override.cc \
159 common/libcurl_http_fetcher.cc \
160 common/multi_range_http_fetcher.cc \
161 common/platform_constants_android.cc \
162 common/prefs.cc \
163 common/subprocess.cc \
164 common/terminator.cc \
165 common/utils.cc \
166 payload_consumer/bzip_extent_writer.cc \
167 payload_consumer/delta_performer.cc \
168 payload_consumer/download_action.cc \
169 payload_consumer/extent_writer.cc \
170 payload_consumer/file_descriptor.cc \
171 payload_consumer/file_writer.cc \
172 payload_consumer/filesystem_verifier_action.cc \
173 payload_consumer/install_plan.cc \
174 payload_consumer/payload_constants.cc \
175 payload_consumer/payload_verifier.cc \
176 payload_consumer/postinstall_runner_action.cc \
177 payload_consumer/xz_extent_writer.cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800178
179ifeq ($(HOST_OS),linux)
180# Build for the host.
181include $(CLEAR_VARS)
182LOCAL_MODULE := libpayload_consumer
183LOCAL_MODULE_CLASS := STATIC_LIBRARIES
184LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800185LOCAL_CLANG := true
186LOCAL_CFLAGS := $(ue_common_cflags)
187LOCAL_CPPFLAGS := $(ue_common_cppflags)
188LOCAL_LDFLAGS := $(ue_common_ldflags)
189LOCAL_C_INCLUDES := \
190 $(ue_common_c_includes) \
191 external/e2fsprogs/lib
192LOCAL_STATIC_LIBRARIES := \
193 update_metadata-protos \
194 $(ue_libpayload_consumer_exported_static_libraries) \
195 $(ue_update_metadata_protos_exported_static_libraries)
196LOCAL_SHARED_LIBRARIES := \
197 $(ue_common_shared_libraries) \
198 $(ue_libpayload_consumer_exported_shared_libraries) \
199 $(ue_update_metadata_protos_exported_shared_libraries)
200LOCAL_SRC_FILES := $(ue_libpayload_consumer_src_files)
201include $(BUILD_HOST_STATIC_LIBRARY)
202endif # HOST_OS == linux
203
204# Build for the target.
205include $(CLEAR_VARS)
206LOCAL_MODULE := libpayload_consumer
207LOCAL_MODULE_CLASS := STATIC_LIBRARIES
208LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800209LOCAL_CLANG := true
210LOCAL_CFLAGS := $(ue_common_cflags)
211LOCAL_CPPFLAGS := $(ue_common_cppflags)
212LOCAL_LDFLAGS := $(ue_common_ldflags)
213LOCAL_C_INCLUDES := \
214 $(ue_common_c_includes) \
215 external/e2fsprogs/lib
216LOCAL_STATIC_LIBRARIES := \
217 update_metadata-protos \
218 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
219 $(ue_update_metadata_protos_exported_static_libraries)
220LOCAL_SHARED_LIBRARIES := \
221 $(ue_common_shared_libraries) \
222 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
223 $(ue_update_metadata_protos_exported_shared_libraries)
224LOCAL_SRC_FILES := $(ue_libpayload_consumer_src_files)
Alex Deymo39910dc2015-11-09 17:04:30 -0800225include $(BUILD_STATIC_LIBRARY)
226
Alex Deymofa78f142016-01-26 21:36:16 -0800227ifdef BRILLO
Alex Deymo4218b7e2015-11-17 21:14:42 -0300228
Alex Deymo39910dc2015-11-09 17:04:30 -0800229# libupdate_engine (type: static_library)
230# ========================================================
231# The main daemon static_library with all the code used to check for updates
232# with Omaha and expose a DBus daemon.
233ue_libupdate_engine_exported_c_includes := \
234 $(LOCAL_PATH)/include \
Alex Deymob09305e2015-12-02 16:09:13 -0300235 external/cros/system_api/dbus
Alex Deymoc372ab62015-10-29 00:43:26 -0700236ue_libupdate_engine_exported_static_libraries := \
Alex Deymo39910dc2015-11-09 17:04:30 -0800237 libpayload_consumer \
Alex Deymod5561a52015-09-03 23:17:52 -0700238 update_metadata-protos \
239 update_engine-dbus-adaptor \
240 update_engine-dbus-libcros-client \
241 update_engine_client-dbus-proxies \
David Zeuthen753fadc2015-09-15 16:34:09 -0400242 libbz \
Alex Deymoc372ab62015-10-29 00:43:26 -0700243 libfs_mgr \
Alex Deymo39910dc2015-11-09 17:04:30 -0800244 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700245 $(ue_update_metadata_protos_exported_static_libraries)
246ue_libupdate_engine_exported_shared_libraries := \
Alex Deymod5561a52015-09-03 23:17:52 -0700247 libdbus \
Alex Deymo05e0e382015-12-07 20:18:16 -0800248 libbrillo-dbus \
249 libchrome-dbus \
Alex Deymod5561a52015-09-03 23:17:52 -0700250 libmetrics \
Alex Deymo7eb23052015-10-09 15:27:59 -0700251 libshill-client \
Alex Deymod5561a52015-09-03 23:17:52 -0700252 libexpat \
Alex Vakulenko1bab5a82015-10-27 11:47:28 -0700253 libbrillo-policy \
Alex Deymoeadab7d2015-10-09 14:45:02 -0700254 libhardware \
Alex Deymoc372ab62015-10-29 00:43:26 -0700255 libcutils \
Alex Deymo39910dc2015-11-09 17:04:30 -0800256 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700257 $(ue_update_metadata_protos_exported_shared_libraries)
Alex Deymoc0037902016-01-23 17:29:02 -0800258ifeq ($(local_use_binder),1)
259ue_libupdate_engine_exported_shared_libraries += \
260 libbinder \
261 libbinderwrapper \
262 libbrillo-binder \
263 libutils
264endif # local_use_binder == 1
Alex Deymo78a954f2016-01-21 20:32:40 -0800265ifeq ($(local_use_weave),1)
Alex Deymof7ead812015-10-23 17:37:27 -0700266ue_libupdate_engine_exported_shared_libraries += \
Alex Deymo7ff02cf2016-01-22 11:06:51 -0800267 libbinderwrapper \
268 libbrillo-binder \
Alex Deymof7ead812015-10-23 17:37:27 -0700269 libweaved
Alex Deymo78a954f2016-01-21 20:32:40 -0800270endif # local_use_weave == 1
Alex Deymoc372ab62015-10-29 00:43:26 -0700271
272include $(CLEAR_VARS)
273LOCAL_MODULE := libupdate_engine
274LOCAL_MODULE_CLASS := STATIC_LIBRARIES
275LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700276LOCAL_CLANG := true
277LOCAL_EXPORT_C_INCLUDE_DIRS := $(ue_libupdate_engine_exported_c_includes)
278LOCAL_CFLAGS := $(ue_common_cflags)
279LOCAL_CPPFLAGS := $(ue_common_cppflags)
280LOCAL_LDFLAGS := $(ue_common_ldflags)
281LOCAL_C_INCLUDES := \
282 $(ue_common_c_includes) \
Alex Deymob09305e2015-12-02 16:09:13 -0300283 $(ue_libupdate_engine_exported_c_includes)
Alex Deymoc372ab62015-10-29 00:43:26 -0700284LOCAL_STATIC_LIBRARIES := \
Alex Deymo39910dc2015-11-09 17:04:30 -0800285 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700286 update_metadata-protos \
287 update_engine-dbus-adaptor \
288 update_engine-dbus-libcros-client \
289 update_engine_client-dbus-proxies \
Alex Deymo05e0e382015-12-07 20:18:16 -0800290 $(ue_libupdate_engine_exported_static_libraries:-host=) \
291 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700292 $(ue_update_metadata_protos_exported_static_libraries)
293LOCAL_SHARED_LIBRARIES := \
294 $(ue_common_shared_libraries) \
Alex Deymo05e0e382015-12-07 20:18:16 -0800295 $(ue_libupdate_engine_exported_shared_libraries:-host=) \
296 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700297 $(ue_update_metadata_protos_exported_shared_libraries)
Alex Deymod5561a52015-09-03 23:17:52 -0700298LOCAL_SRC_FILES := \
Alex Deymo1b03f9f2015-12-09 00:38:36 -0800299 boot_control_android.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700300 chrome_browser_proxy_resolver.cc \
Alex Deymo78a954f2016-01-21 20:32:40 -0800301 common_service.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700302 connection_manager.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700303 daemon.cc \
304 dbus_service.cc \
Alex Deymo1b03f9f2015-12-09 00:38:36 -0800305 hardware_android.cc \
Alex Deymo85616652015-10-15 18:48:31 -0700306 image_properties_android.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700307 libcros_proxy.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700308 metrics.cc \
Alex Deymo38429cf2015-11-11 18:27:22 -0800309 metrics_utils.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700310 omaha_request_action.cc \
311 omaha_request_params.cc \
312 omaha_response_handler_action.cc \
313 p2p_manager.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700314 payload_state.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700315 proxy_resolver.cc \
316 real_system_state.cc \
317 shill_proxy.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700318 update_attempter.cc \
319 update_manager/boxed_value.cc \
320 update_manager/chromeos_policy.cc \
321 update_manager/default_policy.cc \
322 update_manager/evaluation_context.cc \
323 update_manager/policy.cc \
324 update_manager/real_config_provider.cc \
325 update_manager/real_device_policy_provider.cc \
326 update_manager/real_random_provider.cc \
327 update_manager/real_shill_provider.cc \
328 update_manager/real_system_provider.cc \
329 update_manager/real_time_provider.cc \
330 update_manager/real_updater_provider.cc \
331 update_manager/state_factory.cc \
332 update_manager/update_manager.cc \
Alex Deymof7ead812015-10-23 17:37:27 -0700333 update_status_utils.cc \
334 weave_service_factory.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800335ifeq ($(local_use_binder),1)
Casey Dahlina93cd532016-01-14 16:55:11 -0800336LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/binder_bindings
Casey Dahlina93cd532016-01-14 16:55:11 -0800337LOCAL_SRC_FILES += \
338 binder_bindings/android/brillo/IUpdateEngine.aidl \
339 binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl \
Alex Deymofa78f142016-01-26 21:36:16 -0800340 binder_service_brillo.cc \
Casey Dahlina93cd532016-01-14 16:55:11 -0800341 parcelable_update_engine_status.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800342endif # local_use_binder == 1
Alex Deymoaabd81e2016-01-26 20:03:08 -0800343ifeq ($(local_use_weave),1)
344LOCAL_SRC_FILES += \
345 weave_service.cc
346endif # local_use_weave == 1
Alex Deymod5561a52015-09-03 23:17:52 -0700347include $(BUILD_STATIC_LIBRARY)
348
Alex Deymofa78f142016-01-26 21:36:16 -0800349else # !defined(BRILLO)
350
351ifneq ($(local_use_binder),1)
352$(error USE_BINDER is disabled but is required in non-Brillo devices.)
353endif # local_use_binder == 1
354
355# libupdate_engine_android (type: static_library)
356# ========================================================
357# The main daemon static_library used in Android (non-Brillo). This only has a
358# loop to apply payloads provided by the upper layer via a Binder interface.
359ue_libupdate_engine_android_exported_static_libraries := \
360 libpayload_consumer \
361 $(ue_libpayload_consumer_exported_static_libraries)
362ue_libupdate_engine_android_exported_shared_libraries := \
363 $(ue_libpayload_consumer_exported_shared_libraries) \
364 libbinder \
365 libbinderwrapper \
366 libbrillo-binder \
367 libutils
368
369include $(CLEAR_VARS)
370LOCAL_MODULE := libupdate_engine_android
371LOCAL_MODULE_CLASS := STATIC_LIBRARIES
372LOCAL_CPP_EXTENSION := .cc
373LOCAL_CLANG := true
374LOCAL_CFLAGS := $(ue_common_cflags)
375LOCAL_CPPFLAGS := $(ue_common_cppflags)
376LOCAL_LDFLAGS := $(ue_common_ldflags)
377LOCAL_C_INCLUDES := $(ue_common_c_includes)
378LOCAL_STATIC_LIBRARIES := \
379 $(ue_libupdate_engine_android_exported_static_libraries:-host=)
380LOCAL_SHARED_LIBRARIES += \
381 $(ue_common_shared_libraries) \
382 $(ue_libupdate_engine_android_exported_shared_libraries:-host=)
383LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
384LOCAL_SRC_FILES += \
385 binder_bindings/android/os/IUpdateEngine.aidl \
386 binder_bindings/android/os/IUpdateEngineCallback.aidl \
387 binder_service_android.cc \
388 daemon.cc \
389 daemon_state_android.cc
390include $(BUILD_STATIC_LIBRARY)
391
392endif # !defined(BRILLO)
Alex Deymo4218b7e2015-11-17 21:14:42 -0300393
Alex Deymod5561a52015-09-03 23:17:52 -0700394# update_engine (type: executable)
395# ========================================================
396# update_engine daemon.
397include $(CLEAR_VARS)
398LOCAL_MODULE := update_engine
399LOCAL_MODULE_CLASS := EXECUTABLES
Sen Jiang56092772015-11-23 14:41:00 -0800400LOCAL_REQUIRED_MODULES := \
Alex Deymoab494462015-11-30 17:07:36 -0300401 bspatch \
402 cacerts_google
Alex Deymo78a954f2016-01-21 20:32:40 -0800403ifeq ($(local_use_weave),1)
Alex Deymof7ead812015-10-23 17:37:27 -0700404LOCAL_REQUIRED_MODULES += updater.json
Alex Deymo78a954f2016-01-21 20:32:40 -0800405endif # local_use_weave == 1
Alex Deymoc372ab62015-10-29 00:43:26 -0700406LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700407LOCAL_CLANG := true
408LOCAL_CFLAGS := $(ue_common_cflags)
409LOCAL_CPPFLAGS := $(ue_common_cppflags)
410LOCAL_LDFLAGS := $(ue_common_ldflags)
411LOCAL_C_INCLUDES := \
Alex Deymo4218b7e2015-11-17 21:14:42 -0300412 $(ue_common_c_includes)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800413LOCAL_SHARED_LIBRARIES := \
414 $(ue_common_shared_libraries)
415LOCAL_SRC_FILES := \
416 main.cc
Alex Deymo4218b7e2015-11-17 21:14:42 -0300417
418ifdef BRILLO
Alex Deymo4218b7e2015-11-17 21:14:42 -0300419LOCAL_C_INCLUDES += \
Alex Deymoc372ab62015-10-29 00:43:26 -0700420 $(ue_libupdate_engine_exported_c_includes)
421LOCAL_STATIC_LIBRARIES := \
Alex Deymod5561a52015-09-03 23:17:52 -0700422 libupdate_engine \
Alex Deymo05e0e382015-12-07 20:18:16 -0800423 $(ue_libupdate_engine_exported_static_libraries:-host=)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800424LOCAL_SHARED_LIBRARIES += \
Alex Deymo05e0e382015-12-07 20:18:16 -0800425 $(ue_libupdate_engine_exported_shared_libraries:-host=)
Christopher Wiley9e1eda92015-11-16 15:23:37 -0800426else # !defined(BRILLO)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800427LOCAL_STATIC_LIBRARIES := \
Alex Deymofa78f142016-01-26 21:36:16 -0800428 libupdate_engine_android \
429 $(ue_libupdate_engine_android_exported_static_libraries:-host=)
Alex Deymoe97b39c2016-01-20 13:22:17 -0800430LOCAL_SHARED_LIBRARIES += \
Alex Deymofa78f142016-01-26 21:36:16 -0800431 $(ue_libupdate_engine_android_exported_shared_libraries:-host=)
432endif # !defined(BRILLO)
Casey Dahlina93cd532016-01-14 16:55:11 -0800433
Gilad Arnold70141f22015-09-17 09:06:30 -0700434LOCAL_INIT_RC := update_engine.rc
Alex Deymod5561a52015-09-03 23:17:52 -0700435include $(BUILD_EXECUTABLE)
436
437# update_engine_client (type: executable)
438# ========================================================
439# update_engine console client.
440include $(CLEAR_VARS)
441LOCAL_MODULE := update_engine_client
442LOCAL_MODULE_CLASS := EXECUTABLES
Alex Deymoc372ab62015-10-29 00:43:26 -0700443LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700444LOCAL_CLANG := true
445LOCAL_CFLAGS := $(ue_common_cflags)
446LOCAL_CPPFLAGS := $(ue_common_cppflags)
447LOCAL_LDFLAGS := $(ue_common_ldflags)
Casey Dahlince90f442016-01-25 16:55:28 -0800448LOCAL_C_INCLUDES := $(ue_common_c_includes)
Alex Deymo5f528112016-01-27 23:32:36 -0800449LOCAL_SHARED_LIBRARIES := $(ue_common_shared_libraries)
450ifdef BRILLO
451LOCAL_SHARED_LIBRARIES += \
Casey Dahline844c1a2015-12-16 14:30:58 -0800452 libupdate_engine_client
Alex Deymod5561a52015-09-03 23:17:52 -0700453LOCAL_SRC_FILES := \
454 update_engine_client.cc
Alex Deymo5f528112016-01-27 23:32:36 -0800455else # !defined(BRILLO)
456#TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
457# out of the DBus interface.
458LOCAL_C_INCLUDES += \
459 external/cros/system_api/dbus
460LOCAL_SHARED_LIBRARIES += \
461 libbinder \
462 libbrillo-binder \
463 libutils
464LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
465LOCAL_SRC_FILES := \
466 binder_bindings/android/os/IUpdateEngine.aidl \
467 binder_bindings/android/os/IUpdateEngineCallback.aidl \
468 update_engine_client_android.cc \
469 update_status_utils.cc
470endif # !defined(BRILLO)
Alex Deymod5561a52015-09-03 23:17:52 -0700471include $(BUILD_EXECUTABLE)
472
473# libpayload_generator (type: static_library)
474# ========================================================
475# server-side code. This is used for delta_generator and unittests but not
476# for any client code.
Alex Deymoc372ab62015-10-29 00:43:26 -0700477ue_libpayload_generator_exported_static_libraries := \
Alex Deymob09305e2015-12-02 16:09:13 -0300478 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700479 update_metadata-protos \
Alex Deymob09305e2015-12-02 16:09:13 -0300480 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700481 $(ue_update_metadata_protos_exported_static_libraries)
482ue_libpayload_generator_exported_shared_libraries := \
Alex Deymo05e0e382015-12-07 20:18:16 -0800483 libext2fs-host \
Alex Deymob09305e2015-12-02 16:09:13 -0300484 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700485 $(ue_update_metadata_protos_exported_shared_libraries)
486
Alex Deymo05e0e382015-12-07 20:18:16 -0800487ue_libpayload_generator_src_files := \
Alex Deymod5561a52015-09-03 23:17:52 -0700488 payload_generator/ab_generator.cc \
489 payload_generator/annotated_operation.cc \
490 payload_generator/blob_file_writer.cc \
491 payload_generator/block_mapping.cc \
Alex Deymo0bc26112015-10-19 20:54:57 -0700492 payload_generator/bzip.cc \
Alex Deymod5561a52015-09-03 23:17:52 -0700493 payload_generator/cycle_breaker.cc \
494 payload_generator/delta_diff_generator.cc \
495 payload_generator/delta_diff_utils.cc \
496 payload_generator/ext2_filesystem.cc \
497 payload_generator/extent_ranges.cc \
498 payload_generator/extent_utils.cc \
499 payload_generator/full_update_generator.cc \
500 payload_generator/graph_types.cc \
501 payload_generator/graph_utils.cc \
502 payload_generator/inplace_generator.cc \
503 payload_generator/payload_file.cc \
504 payload_generator/payload_generation_config.cc \
505 payload_generator/payload_signer.cc \
506 payload_generator/raw_filesystem.cc \
507 payload_generator/tarjan.cc \
508 payload_generator/topological_sort.cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800509
510ifeq ($(HOST_OS),linux)
511# Build for the host.
512include $(CLEAR_VARS)
513LOCAL_MODULE := libpayload_generator
514LOCAL_MODULE_CLASS := STATIC_LIBRARIES
515LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800516LOCAL_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_STATIC_LIBRARIES := \
522 libpayload_consumer \
523 update_metadata-protos \
524 $(ue_libpayload_consumer_exported_static_libraries) \
525 $(ue_update_metadata_protos_exported_static_libraries)
526LOCAL_SHARED_LIBRARIES := \
527 $(ue_common_shared_libraries) \
528 $(ue_libpayload_generator_exported_shared_libraries) \
529 $(ue_libpayload_consumer_exported_shared_libraries) \
530 $(ue_update_metadata_protos_exported_shared_libraries)
531LOCAL_SRC_FILES := $(ue_libpayload_generator_src_files)
532include $(BUILD_HOST_STATIC_LIBRARY)
533endif # HOST_OS == linux
534
535# Build for the target.
536include $(CLEAR_VARS)
537LOCAL_MODULE := libpayload_generator
538LOCAL_MODULE_CLASS := STATIC_LIBRARIES
539LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800540LOCAL_CLANG := true
541LOCAL_CFLAGS := $(ue_common_cflags)
542LOCAL_CPPFLAGS := $(ue_common_cppflags)
543LOCAL_LDFLAGS := $(ue_common_ldflags)
544LOCAL_C_INCLUDES := $(ue_common_c_includes)
545LOCAL_STATIC_LIBRARIES := \
546 libpayload_consumer \
547 update_metadata-protos \
548 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
549 $(ue_update_metadata_protos_exported_static_libraries)
550LOCAL_SHARED_LIBRARIES := \
551 $(ue_common_shared_libraries) \
552 $(ue_libpayload_generator_exported_shared_libraries:-host=) \
553 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
554 $(ue_update_metadata_protos_exported_shared_libraries)
555LOCAL_SRC_FILES := $(ue_libpayload_generator_src_files)
Alex Deymod5561a52015-09-03 23:17:52 -0700556include $(BUILD_STATIC_LIBRARY)
557
558# delta_generator (type: executable)
559# ========================================================
560# server-side delta generator.
Alex Deymo05e0e382015-12-07 20:18:16 -0800561ue_delta_generator_src_files := \
562 payload_generator/generate_delta_main.cc
563
564ifeq ($(HOST_OS),linux)
565# Build for the host.
Alex Deymod5561a52015-09-03 23:17:52 -0700566include $(CLEAR_VARS)
567LOCAL_MODULE := delta_generator
568LOCAL_MODULE_CLASS := EXECUTABLES
Alex Deymoc372ab62015-10-29 00:43:26 -0700569LOCAL_CPP_EXTENSION := .cc
Alex Deymoc372ab62015-10-29 00:43:26 -0700570LOCAL_CLANG := true
571LOCAL_CFLAGS := $(ue_common_cflags)
572LOCAL_CPPFLAGS := $(ue_common_cppflags)
573LOCAL_LDFLAGS := $(ue_common_ldflags)
Alex Deymob09305e2015-12-02 16:09:13 -0300574LOCAL_C_INCLUDES := $(ue_common_c_includes)
Alex Deymoc372ab62015-10-29 00:43:26 -0700575LOCAL_STATIC_LIBRARIES := \
Alex Deymob09305e2015-12-02 16:09:13 -0300576 libpayload_consumer \
Alex Deymoc372ab62015-10-29 00:43:26 -0700577 libpayload_generator \
Alex Deymob09305e2015-12-02 16:09:13 -0300578 $(ue_libpayload_consumer_exported_static_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700579 $(ue_libpayload_generator_exported_static_libraries)
580LOCAL_SHARED_LIBRARIES := \
581 $(ue_common_shared_libraries) \
Alex Deymob09305e2015-12-02 16:09:13 -0300582 $(ue_libpayload_consumer_exported_shared_libraries) \
Alex Deymoc372ab62015-10-29 00:43:26 -0700583 $(ue_libpayload_generator_exported_shared_libraries)
Alex Deymo05e0e382015-12-07 20:18:16 -0800584LOCAL_SRC_FILES := $(ue_delta_generator_src_files)
585include $(BUILD_HOST_EXECUTABLE)
586endif # HOST_OS == linux
587
588# Build for the target.
589include $(CLEAR_VARS)
590LOCAL_MODULE := delta_generator
591LOCAL_MODULE_CLASS := EXECUTABLES
592LOCAL_CPP_EXTENSION := .cc
Alex Deymo05e0e382015-12-07 20:18:16 -0800593LOCAL_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 libpayload_generator \
601 $(ue_libpayload_consumer_exported_static_libraries:-host=) \
602 $(ue_libpayload_generator_exported_static_libraries:-host=)
603LOCAL_SHARED_LIBRARIES := \
604 $(ue_common_shared_libraries) \
605 $(ue_libpayload_consumer_exported_shared_libraries:-host=) \
606 $(ue_libpayload_generator_exported_shared_libraries:-host=)
607LOCAL_SRC_FILES := $(ue_delta_generator_src_files)
Alex Deymod5561a52015-09-03 23:17:52 -0700608include $(BUILD_EXECUTABLE)
609
Christopher Wiley16daa082015-10-01 17:18:40 -0700610# libupdate_engine_client
611# ========================================================
612include $(CLEAR_VARS)
613LOCAL_MODULE := libupdate_engine_client
Christopher Wiley16daa082015-10-01 17:18:40 -0700614LOCAL_CFLAGS := \
615 -Wall \
616 -Werror \
Casey Dahlina93cd532016-01-14 16:55:11 -0800617 -Wno-unused-parameter \
Alex Deymo71d7c212016-01-22 11:54:20 -0800618 -DUSE_DBUS=$(local_use_dbus) \
Alex Deymo78a954f2016-01-21 20:32:40 -0800619 -DUSE_BINDER=$(local_use_binder)
Christopher Wiley16daa082015-10-01 17:18:40 -0700620LOCAL_CLANG := true
621LOCAL_CPP_EXTENSION := .cc
Alex Deymo71d7c212016-01-22 11:54:20 -0800622# TODO(deymo): Remove "external/cros/system_api/dbus" when dbus is not used.
Christopher Wiley16daa082015-10-01 17:18:40 -0700623LOCAL_C_INCLUDES := \
624 $(LOCAL_PATH)/client_library/include \
625 external/cros/system_api/dbus \
626 system \
627 external/gtest/include
628LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/client_library/include
629LOCAL_SHARED_LIBRARIES := \
630 libchrome \
Alex Deymo71d7c212016-01-22 11:54:20 -0800631 libbrillo
Christopher Wiley16daa082015-10-01 17:18:40 -0700632LOCAL_SRC_FILES := \
633 client_library/client.cc \
Christopher Wiley16daa082015-10-01 17:18:40 -0700634 update_status_utils.cc
Casey Dahlina93cd532016-01-14 16:55:11 -0800635
Alex Deymo71d7c212016-01-22 11:54:20 -0800636# We can only compile support for one IPC mechanism. If both "binder" and "dbus"
637# are defined, we prefer binder.
Alex Deymo78a954f2016-01-21 20:32:40 -0800638ifeq ($(local_use_binder),1)
Casey Dahlina93cd532016-01-14 16:55:11 -0800639LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder_bindings
Casey Dahlina93cd532016-01-14 16:55:11 -0800640LOCAL_SHARED_LIBRARIES += \
641 libbinder \
Casey Dahlin40892492016-01-25 16:55:28 -0800642 libbrillo-binder \
Casey Dahlina93cd532016-01-14 16:55:11 -0800643 libutils
Alex Deymo71d7c212016-01-22 11:54:20 -0800644LOCAL_SRC_FILES += \
645 binder_bindings/android/brillo/IUpdateEngine.aidl \
646 binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl \
647 client_library/client_binder.cc \
648 parcelable_update_engine_status.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800649else # local_use_binder != 1
Alex Deymo71d7c212016-01-22 11:54:20 -0800650LOCAL_STATIC_LIBRARIES := \
651 update_engine_client-dbus-proxies
652LOCAL_SHARED_LIBRARIES += \
653 libchrome-dbus \
654 libbrillo-dbus
655LOCAL_SRC_FILES += \
656 client_library/client_dbus.cc
Alex Deymo78a954f2016-01-21 20:32:40 -0800657endif # local_use_binder == 1
Casey Dahlina93cd532016-01-14 16:55:11 -0800658
Christopher Wiley16daa082015-10-01 17:18:40 -0700659include $(BUILD_SHARED_LIBRARY)
660
Alex Deymof7ead812015-10-23 17:37:27 -0700661# Weave schema files
662# ========================================================
663include $(CLEAR_VARS)
664LOCAL_MODULE := updater.json
665LOCAL_MODULE_CLASS := ETC
666LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/weaved/traits
667LOCAL_SRC_FILES := weaved/traits/$(LOCAL_MODULE)
668include $(BUILD_PREBUILT)
669
Gaurav Shah263614f2015-09-24 14:20:38 -0700670# Update payload signing public key.
671# ========================================================
Alex Deymo50e24f42016-01-27 20:48:54 -0800672ifdef BRILLO
Gaurav Shah263614f2015-09-24 14:20:38 -0700673include $(CLEAR_VARS)
674LOCAL_MODULE := brillo-update-payload-key
675LOCAL_MODULE_CLASS := ETC
676LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/update_engine
677LOCAL_MODULE_STEM := update-payload-key.pub.pem
678LOCAL_SRC_FILES := update_payload_key/brillo-update-payload-key.pub.pem
679LOCAL_BUILT_MODULE_STEM := update_payload_key/brillo-update-payload-key.pub.pem
680include $(BUILD_PREBUILT)
Alex Deymo50e24f42016-01-27 20:48:54 -0800681endif # BRILLO
Tao Bao042f8a12016-01-07 16:52:14 -0800682
683# Brillo update payload generation script
684# ========================================================
685ifeq ($(HOST_OS),linux)
686include $(CLEAR_VARS)
687LOCAL_SRC_FILES := scripts/brillo_update_payload
688LOCAL_MODULE := brillo_update_payload
689LOCAL_MODULE_CLASS := EXECUTABLES
690LOCAL_IS_HOST_MODULE := true
691LOCAL_MODULE_TAGS := optional
692LOCAL_REQUIRED_MODULES := \
693 delta_generator \
694 shflags
695include $(BUILD_PREBUILT)
696endif # HOST_OS == linux