1# Copyright 2009 The Android Open Source Project 2# 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. 14 15LOCAL_PATH := $(call my-dir) 16 17tune2fs_static_libraries := \ 18 libext2_com_err \ 19 libext2_blkid \ 20 libext2_quota \ 21 libext2_uuid \ 22 libext2_e2p \ 23 libext2fs 24 25updater_common_static_libraries := \ 26 libapplypatch \ 27 libbootloader_message \ 28 libbspatch \ 29 libedify \ 30 libotautil \ 31 libext4_utils \ 32 libdm \ 33 libfec \ 34 libfec_rs \ 35 libavb \ 36 libverity_tree \ 37 liblog \ 38 liblp \ 39 libselinux \ 40 libsparse \ 41 libsquashfs_utils \ 42 libbrotli \ 43 libbz \ 44 libziparchive \ 45 libz \ 46 libbase \ 47 libcrypto_static \ 48 libcrypto_utils \ 49 libcutils \ 50 libutils 51 52 53# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function 54# named "Register_<libname>()". Here we emit a little C function that 55# gets #included by updater.cpp. It calls all those registration 56# functions. 57# $(1): the path to the register.inc file 58# $(2): a list of TARGET_RECOVERY_UPDATER_LIBS 59define generate-register-inc 60 $(hide) mkdir -p $(dir $(1)) 61 $(hide) echo "" > $(1) 62 $(hide) $(foreach lib,$(2),echo "extern void Register_$(lib)(void);" >> $(1);) 63 $(hide) echo "void RegisterDeviceExtensions() {" >> $(1) 64 $(hide) $(foreach lib,$(2),echo " Register_$(lib)();" >> $(1);) 65 $(hide) echo "}" >> $(1) 66endef 67 68 69# updater (static executable) 70# =============================== 71include $(CLEAR_VARS) 72 73LOCAL_MODULE := updater 74LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 75LOCAL_LICENSE_CONDITIONS := notice 76LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE 77 78LOCAL_SRC_FILES := \ 79 updater_main.cpp 80 81LOCAL_C_INCLUDES := \ 82 $(LOCAL_PATH)/include 83 84LOCAL_CFLAGS := \ 85 -Wall \ 86 -Werror 87 88LOCAL_STATIC_LIBRARIES := \ 89 libupdater_device \ 90 libupdater_core \ 91 $(TARGET_RECOVERY_UPDATER_LIBS) \ 92 $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS) \ 93 $(updater_common_static_libraries) \ 94 libfs_mgr \ 95 libtune2fs \ 96 $(tune2fs_static_libraries) 97 98LOCAL_HEADER_LIBRARIES := libgtest_prod_headers 99 100LOCAL_MODULE_CLASS := EXECUTABLES 101inc := $(call local-generated-sources-dir)/register.inc 102 103# Devices can also add libraries to TARGET_RECOVERY_UPDATER_EXTRA_LIBS. 104# These libs are also linked in with updater, but we don't try to call 105# any sort of registration function for these. Use this variable for 106# any subsidiary static libraries required for your registered 107# extension libs. 108$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS) 109$(inc) : 110 $(call generate-register-inc,$@,$(libs)) 111 112LOCAL_GENERATED_SOURCES := $(inc) 113 114inc := 115 116LOCAL_FORCE_STATIC_EXECUTABLE := true 117 118include $(BUILD_EXECUTABLE) 119