1# Copyright 2009 The Android Open Source Project 2 3LOCAL_PATH := $(call my-dir) 4 5updater_src_files := \ 6 install.c \ 7 blockimg.c \ 8 updater.c 9 10# 11# Build a statically-linked binary to include in OTA packages 12# 13include $(CLEAR_VARS) 14 15# Build only in eng, so we don't end up with a copy of this in /system 16# on user builds. (TODO: find a better way to build device binaries 17# needed only for OTA packages.) 18LOCAL_MODULE_TAGS := eng 19 20LOCAL_SRC_FILES := $(updater_src_files) 21 22ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) 23LOCAL_CFLAGS += -DUSE_EXT4 24LOCAL_CFLAGS += -Wno-unused-parameter 25LOCAL_C_INCLUDES += system/extras/ext4_utils 26LOCAL_STATIC_LIBRARIES += \ 27 libext4_utils_static \ 28 libsparse_static \ 29 libz 30endif 31 32LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS) 33LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz 34LOCAL_STATIC_LIBRARIES += libmincrypt libbz 35LOCAL_STATIC_LIBRARIES += libcutils liblog libstdc++ libc 36LOCAL_STATIC_LIBRARIES += libselinux 37tune2fs_static_libraries := \ 38 libext2_com_err \ 39 libext2_blkid \ 40 libext2_quota \ 41 libext2_uuid_static \ 42 libext2_e2p \ 43 libext2fs 44LOCAL_STATIC_LIBRARIES += libtune2fs $(tune2fs_static_libraries) 45 46LOCAL_C_INCLUDES += external/e2fsprogs/misc 47LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. 48 49# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function 50# named "Register_<libname>()". Here we emit a little C function that 51# gets #included by updater.c. It calls all those registration 52# functions. 53 54# Devices can also add libraries to TARGET_RECOVERY_UPDATER_EXTRA_LIBS. 55# These libs are also linked in with updater, but we don't try to call 56# any sort of registration function for these. Use this variable for 57# any subsidiary static libraries required for your registered 58# extension libs. 59 60inc := $(call intermediates-dir-for,PACKAGING,updater_extensions)/register.inc 61 62# Encode the value of TARGET_RECOVERY_UPDATER_LIBS into the filename of the dependency. 63# So if TARGET_RECOVERY_UPDATER_LIBS is changed, a new dependency file will be generated. 64# Note that we have to remove any existing depency files before creating new one, 65# so no obsolete dependecy file gets used if you switch back to an old value. 66inc_dep_file := $(inc).dep.$(subst $(space),-,$(sort $(TARGET_RECOVERY_UPDATER_LIBS))) 67$(inc_dep_file): stem := $(inc).dep 68$(inc_dep_file) : 69 $(hide) mkdir -p $(dir $@) 70 $(hide) rm -f $(stem).* 71 $(hide) touch $@ 72 73$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS) 74$(inc) : $(inc_dep_file) 75 $(hide) mkdir -p $(dir $@) 76 $(hide) echo "" > $@ 77 $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@;) 78 $(hide) echo "void RegisterDeviceExtensions() {" >> $@ 79 $(hide) $(foreach lib,$(libs),echo " Register_$(lib)();" >> $@;) 80 $(hide) echo "}" >> $@ 81 82$(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater.o : $(inc) 83LOCAL_C_INCLUDES += $(dir $(inc)) 84 85inc := 86inc_dep_file := 87 88LOCAL_MODULE := updater 89 90LOCAL_FORCE_STATIC_EXECUTABLE := true 91 92include $(BUILD_EXECUTABLE) 93