blob: 5c43e1c66c02bff40bbda635c6f03585bbce8ead [file] [log] [blame]
preludedrew38058dc2011-01-29 23:30:44 -07001# Copyright 2009 The Android Open Source Project
2
3LOCAL_PATH := $(call my-dir)
4
5updater_src_files := \
6 install.c \
7 ../mounts.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_C_INCLUDES += system/extras/ext4_utils
25LOCAL_STATIC_LIBRARIES += libext4_utils libz
26endif
27
28LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils
29
30LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
31LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz
32LOCAL_STATIC_LIBRARIES += libmincrypt libbz
33LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc
34LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
35
36# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function
37# named "Register_<libname>()". Here we emit a little C function that
38# gets #included by updater.c. It calls all those registration
39# functions.
40
41# Devices can also add libraries to TARGET_RECOVERY_UPDATER_EXTRA_LIBS.
42# These libs are also linked in with updater, but we don't try to call
43# any sort of registration function for these. Use this variable for
44# any subsidiary static libraries required for your registered
45# extension libs.
46
47inc := $(call intermediates-dir-for,PACKAGING,updater_extensions)/register.inc
48
49# During the first pass of reading the makefiles, we dump the list of
50# extension libs to a temp file, then copy that to the ".list" file if
51# it is different than the existing .list (if any). The register.inc
52# file then uses the .list as a prerequisite, so it is only rebuilt
53# (and updater.o recompiled) when the list of extension libs changes.
54
55junk := $(shell mkdir -p $(dir $(inc));\
56 echo $(TARGET_RECOVERY_UPDATER_LIBS) > $(inc).temp;\
57 diff -q $(inc).temp $(inc).list || cp -f $(inc).temp $(inc).list)
58
59$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS)
60$(inc) : $(inc).list
61 $(hide) mkdir -p $(dir $@)
62 $(hide) echo "" > $@
63 $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@)
64 $(hide) echo "void RegisterDeviceExtensions() {" >> $@
65 $(hide) $(foreach lib,$(libs),echo " Register_$(lib)();" >> $@)
66 $(hide) echo "}" >> $@
67
68$(call intermediates-dir-for,EXECUTABLES,updater)/updater.o : $(inc)
69LOCAL_C_INCLUDES += $(dir $(inc))
70
71LOCAL_MODULE := updater
72
73LOCAL_FORCE_STATIC_EXECUTABLE := true
74
75include $(BUILD_EXECUTABLE)
76
77
78file := $(PRODUCT_OUT)/utilities/update-binary
79ALL_PREBUILT += $(file)
80$(file) : $(TARGET_OUT)/bin/updater | $(ACP)
81 $(transform-prebuilt-to-target)