blob: 3d25913917f3e56ce80be02a220589ee97112661 [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
Tao Bao0c7839a2016-10-10 15:48:37 -070077LOCAL_EXPORT_C_INCLUDE_DIRS := \
78 $(LOCAL_PATH)/include
Stephen Smalley779701d2012-02-09 14:13:23 -050079
Tao Bao0c7839a2016-10-10 15:48:37 -070080LOCAL_STATIC_LIBRARIES := \
81 $(updater_common_static_libraries)
sndnvaps7dde36d2016-10-04 18:09:37 +080082
Tao Bao0c7839a2016-10-10 15:48:37 -070083include $(BUILD_STATIC_LIBRARY)
Ethan Yonker34ae4832016-08-24 15:32:18 -050084
Tao Bao0c7839a2016-10-10 15:48:37 -070085# updater (static executable)
86# ===============================
87include $(CLEAR_VARS)
Michael Rungeb278c252014-11-21 00:12:28 -080088
Tao Bao0c7839a2016-10-10 15:48:37 -070089LOCAL_MODULE := updater
90
91LOCAL_SRC_FILES := \
92 updater.cpp
93
94LOCAL_C_INCLUDES := \
95 $(LOCAL_PATH)/.. \
96 $(LOCAL_PATH)/include
97
98LOCAL_CFLAGS := \
Tianjie Xuc89d1e72017-08-28 14:15:07 -070099 -Wall \
Tao Bao0c7839a2016-10-10 15:48:37 -0700100 -Werror
101
102LOCAL_STATIC_LIBRARIES := \
103 libupdater \
104 $(TARGET_RECOVERY_UPDATER_LIBS) \
105 $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS) \
106 $(updater_common_static_libraries)
Doug Zongker9931f7f2009-06-10 14:11:53 -0700107
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700108# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function
109# named "Register_<libname>()". Here we emit a little C function that
110# gets #included by updater.c. It calls all those registration
111# functions.
112
113# Devices can also add libraries to TARGET_RECOVERY_UPDATER_EXTRA_LIBS.
114# These libs are also linked in with updater, but we don't try to call
115# any sort of registration function for these. Use this variable for
116# any subsidiary static libraries required for your registered
117# extension libs.
118
Dan Willemsenedec27a2017-03-21 16:41:14 -0700119LOCAL_MODULE_CLASS := EXECUTABLES
120inc := $(call local-generated-sources-dir)/register.inc
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700121
122$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS)
Dan Willemsenedec27a2017-03-21 16:41:14 -0700123$(inc) :
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700124 $(hide) mkdir -p $(dir $@)
125 $(hide) echo "" > $@
Michael Ward6242a8b2011-07-14 15:06:12 -0700126 $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@;)
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700127 $(hide) echo "void RegisterDeviceExtensions() {" >> $@
Michael Ward6242a8b2011-07-14 15:06:12 -0700128 $(hide) $(foreach lib,$(libs),echo " Register_$(lib)();" >> $@;)
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700129 $(hide) echo "}" >> $@
130
Dan Willemsenedec27a2017-03-21 16:41:14 -0700131LOCAL_GENERATED_SOURCES := $(inc)
Doug Zongker2b0fdc62009-06-19 11:22:06 -0700132
Ying Wangeef790d2012-06-11 14:53:08 -0700133inc :=
Doug Zongker9931f7f2009-06-10 14:11:53 -0700134
135LOCAL_FORCE_STATIC_EXECUTABLE := true
136
137include $(BUILD_EXECUTABLE)