blob: 5c43e1c66c02bff40bbda635c6f03585bbce8ead [file] [log] [blame]
Doug Zongker9931f7f2009-06-10 14:11:53 -07001# Copyright 2009 The Android Open Source Project
2
3LOCAL_PATH := $(call my-dir)
4
5updater_src_files := \
6 install.c \
Koushik Dutta1b867542010-11-10 23:52:09 -08007 ../mounts.c \
Doug Zongker9931f7f2009-06-10 14:11:53 -07008 updater.c
9
10#
Doug Zongkerad3db092009-06-26 13:38:55 -070011# Build a statically-linked binary to include in OTA packages
Doug Zongker9931f7f2009-06-10 14:11:53 -070012#
13include $(CLEAR_VARS)
14
Doug Zongkerad3db092009-06-26 13:38:55 -070015# 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
Doug Zongker9931f7f2009-06-10 14:11:53 -070020LOCAL_SRC_FILES := $(updater_src_files)
21
Doug Zongker56c51052010-07-01 09:18:44 -070022ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
23LOCAL_CFLAGS += -DUSE_EXT4
24LOCAL_C_INCLUDES += system/extras/ext4_utils
25LOCAL_STATIC_LIBRARIES += libext4_utils libz
26endif
27
Steve Kondik4123b582010-11-14 03:18:40 -050028LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils
Koushik Duttab5a36a02010-09-13 14:33:15 -070029
Doug Zongker56c51052010-07-01 09:18:44 -070030LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
Doug Zongker2b0fdc62009-06-19 11:22:06 -070031LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz
Doug Zongker8edb00c2009-06-11 17:21:44 -070032LOCAL_STATIC_LIBRARIES += libmincrypt libbz
Doug Zongker9931f7f2009-06-10 14:11:53 -070033LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc
34LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
35
Doug Zongker2b0fdc62009-06-19 11:22:06 -070036# 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
Doug Zongker9931f7f2009-06-10 14:11:53 -070071LOCAL_MODULE := updater
72
73LOCAL_FORCE_STATIC_EXECUTABLE := true
74
75include $(BUILD_EXECUTABLE)
Koushik Duttaada3f3b2010-05-01 21:30:55 -070076
77
78file := $(PRODUCT_OUT)/utilities/update-binary
79ALL_PREBUILT += $(file)
80$(file) : $(TARGET_OUT)/bin/updater | $(ACP)
81 $(transform-prebuilt-to-target)