blob: b6955455ac5246af842e9b4a87cda65b5244e39b [file] [log] [blame]
Doug Zongker9931f7f2009-06-10 14:11:53 -07001# Copyright 2009 The Android Open Source Project
Tao Baoba9a42a2015-06-23 23:23:33 -07002#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Doug Zongker9931f7f2009-06-10 14:11:53 -070014
15LOCAL_PATH := $(call my-dir)
16
Ethan Yonker8373cfe2017-09-08 06:50:54 -050017ifneq ($(wildcard external/e2fsprogs/misc/tune2fs.h),)
18 tune2fs_static_libraries := \
19 libext2_com_err \
20 libext2_blkid \
21 libext2_quota \
22 libext2_uuid \
23 libext2_e2p \
24 libext2fs
25 LOCAL_CFLAGS += -DHAVE_LIBTUNE2FS
26else
27 tune2fs_static_libraries :=
28endif
Doug Zongker9931f7f2009-06-10 14:11:53 -070029
Tao Bao0c7839a2016-10-10 15:48:37 -070030updater_common_static_libraries := \
31 libapplypatch \
Sen Jiang25c56972016-05-10 15:23:25 -070032 libbspatch \
Tao Bao0c7839a2016-10-10 15:48:37 -070033 libedify \
Tianjie Xu8cf5c8f2016-09-08 20:10:11 -070034 libziparchive \
35 libotautil \
Tao Baobedf5fc2016-11-18 12:01:26 -080036 libbootloader_message \
Tianjie Xu8cf5c8f2016-09-08 20:10:11 -070037 libutils \
Tao Bao0c7839a2016-10-10 15:48:37 -070038 libmounts \
39 libotafault \
Alex Deymo31653662017-01-11 14:02:13 -080040 libext4_utils \
Tao Bao0c7839a2016-10-10 15:48:37 -070041 libfec \
42 libfec_rs \
Tao Baobedf5fc2016-11-18 12:01:26 -080043 libfs_mgr \
Tao Bao0c7839a2016-10-10 15:48:37 -070044 liblog \
45 libselinux \
Alex Deymo67f3aa82017-01-11 14:38:20 -080046 libsparse \
Tao Bao0c7839a2016-10-10 15:48:37 -070047 libsquashfs_utils \
48 libbz \
49 libz \
50 libbase \
51 libcrypto \
52 libcrypto_utils \
53 libcutils \
Tao Baod80a9982016-03-03 11:43:47 -080054 libtune2fs \
Tianjie Xu107a34f2017-06-29 17:04:21 -070055 libbrotli \
Tao Baod80a9982016-03-03 11:43:47 -080056 $(tune2fs_static_libraries)
Sami Tolvanen0a7b4732015-06-25 10:25:36 +010057
Tao Bao0c7839a2016-10-10 15:48:37 -070058# libupdater (static library)
59# ===============================
Doug Zongker9931f7f2009-06-10 14:11:53 -070060include $(CLEAR_VARS)
61
Tao Bao0c7839a2016-10-10 15:48:37 -070062LOCAL_MODULE := libupdater
Doug Zongkerad3db092009-06-26 13:38:55 -070063
Tao Bao0c7839a2016-10-10 15:48:37 -070064LOCAL_SRC_FILES := \
65 install.cpp \
66 blockimg.cpp
Doug Zongker8edb00c2009-06-11 17:21:44 -070067
Tao Bao0c7839a2016-10-10 15:48:37 -070068LOCAL_C_INCLUDES := \
69 $(LOCAL_PATH)/.. \
70 $(LOCAL_PATH)/include \
71 external/e2fsprogs/misc
Doug Zongker9931f7f2009-06-10 14:11:53 -070072
Tao Bao0c7839a2016-10-10 15:48:37 -070073LOCAL_CFLAGS := \
Tianjie Xuc89d1e72017-08-28 14:15:07 -070074 -Wall \
Tao Bao0c7839a2016-10-10 15:48:37 -070075 -Werror
Doug Zongker9931f7f2009-06-10 14:11:53 -070076
andi340ef64922015-05-09 10:48:52 -070077ifeq ($(BOARD_SUPPRESS_EMMC_WIPE),true)
78 LOCAL_CFLAGS += -DSUPPRESS_EMMC_WIPE
79endif
80
Tao Bao0c7839a2016-10-10 15:48:37 -070081LOCAL_EXPORT_C_INCLUDE_DIRS := \
82 $(LOCAL_PATH)/include
Stephen Smalley779701d2012-02-09 14:13:23 -050083
Tao Bao0c7839a2016-10-10 15:48:37 -070084LOCAL_STATIC_LIBRARIES := \
85 $(updater_common_static_libraries)
sndnvaps7dde36d2016-10-04 18:09:37 +080086
Tao Bao0c7839a2016-10-10 15:48:37 -070087include $(BUILD_STATIC_LIBRARY)
Ethan Yonker34ae4832016-08-24 15:32:18 -050088
Tao Bao0c7839a2016-10-10 15:48:37 -070089# updater (static executable)
90# ===============================
91include $(CLEAR_VARS)
Michael Rungeb278c252014-11-21 00:12:28 -080092
Tao Bao0c7839a2016-10-10 15:48:37 -070093LOCAL_MODULE := updater
94
95LOCAL_SRC_FILES := \
96 updater.cpp
97
98LOCAL_C_INCLUDES := \
99 $(LOCAL_PATH)/.. \
100 $(LOCAL_PATH)/include
101
102LOCAL_CFLAGS := \
Tianjie Xuc89d1e72017-08-28 14:15:07 -0700103 -Wall \
Tao Bao0c7839a2016-10-10 15:48:37 -0700104 -Werror
105
106LOCAL_STATIC_LIBRARIES := \
107 libupdater \
108 $(TARGET_RECOVERY_UPDATER_LIBS) \
109 $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS) \
110 $(updater_common_static_libraries)
Doug Zongker9931f7f2009-06-10 14:11:53 -0700111
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700112# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function
113# named "Register_<libname>()". Here we emit a little C function that
114# gets #included by updater.c. It calls all those registration
115# functions.
116
117# Devices can also add libraries to TARGET_RECOVERY_UPDATER_EXTRA_LIBS.
118# These libs are also linked in with updater, but we don't try to call
119# any sort of registration function for these. Use this variable for
120# any subsidiary static libraries required for your registered
121# extension libs.
122
Dan Willemsenedec27a2017-03-21 16:41:14 -0700123LOCAL_MODULE_CLASS := EXECUTABLES
124inc := $(call local-generated-sources-dir)/register.inc
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700125
126$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS)
Dan Willemsenedec27a2017-03-21 16:41:14 -0700127$(inc) :
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700128 $(hide) mkdir -p $(dir $@)
129 $(hide) echo "" > $@
Michael Ward6242a8b2011-07-14 15:06:12 -0700130 $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@;)
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700131 $(hide) echo "void RegisterDeviceExtensions() {" >> $@
Michael Ward6242a8b2011-07-14 15:06:12 -0700132 $(hide) $(foreach lib,$(libs),echo " Register_$(lib)();" >> $@;)
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700133 $(hide) echo "}" >> $@
134
Dan Willemsenedec27a2017-03-21 16:41:14 -0700135LOCAL_GENERATED_SOURCES := $(inc)
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700136
Ying Wangeef790d2012-06-11 14:53:08 -0700137inc :=
Doug Zongker9931f7f2009-06-10 14:11:53 -0700138
139LOCAL_FORCE_STATIC_EXECUTABLE := true
140
141include $(BUILD_EXECUTABLE)