blob: 86c4bb7b9516c0bbe7fc5ac2ec682b0189dbfc1b [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
Hristo Bojinovdb314d62010-08-02 10:29:49 -070033LOCAL_STATIC_LIBRARIES += libminelf
Doug Zongker9931f7f2009-06-10 14:11:53 -070034LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc
35LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
36
Doug Zongker2b0fdc62009-06-19 11:22:06 -070037# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function
38# named "Register_<libname>()". Here we emit a little C function that
39# gets #included by updater.c. It calls all those registration
40# functions.
41
42# Devices can also add libraries to TARGET_RECOVERY_UPDATER_EXTRA_LIBS.
43# These libs are also linked in with updater, but we don't try to call
44# any sort of registration function for these. Use this variable for
45# any subsidiary static libraries required for your registered
46# extension libs.
47
48inc := $(call intermediates-dir-for,PACKAGING,updater_extensions)/register.inc
49
50# During the first pass of reading the makefiles, we dump the list of
51# extension libs to a temp file, then copy that to the ".list" file if
52# it is different than the existing .list (if any). The register.inc
53# file then uses the .list as a prerequisite, so it is only rebuilt
54# (and updater.o recompiled) when the list of extension libs changes.
55
56junk := $(shell mkdir -p $(dir $(inc));\
57 echo $(TARGET_RECOVERY_UPDATER_LIBS) > $(inc).temp;\
Ying Wangb7b7b372011-05-24 16:08:38 -070058 diff -q $(inc).temp $(inc).list 2>/dev/null || cp -f $(inc).temp $(inc).list)
Doug Zongker2b0fdc62009-06-19 11:22:06 -070059
60$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS)
61$(inc) : $(inc).list
62 $(hide) mkdir -p $(dir $@)
63 $(hide) echo "" > $@
Michael Ward6242a8b2011-07-14 15:06:12 -070064 $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@;)
Doug Zongker2b0fdc62009-06-19 11:22:06 -070065 $(hide) echo "void RegisterDeviceExtensions() {" >> $@
Michael Ward6242a8b2011-07-14 15:06:12 -070066 $(hide) $(foreach lib,$(libs),echo " Register_$(lib)();" >> $@;)
Doug Zongker2b0fdc62009-06-19 11:22:06 -070067 $(hide) echo "}" >> $@
68
69$(call intermediates-dir-for,EXECUTABLES,updater)/updater.o : $(inc)
70LOCAL_C_INCLUDES += $(dir $(inc))
71
Doug Zongker9931f7f2009-06-10 14:11:53 -070072LOCAL_MODULE := updater
73
74LOCAL_FORCE_STATIC_EXECUTABLE := true
75
Koushik Dutta0df56f42011-11-16 16:00:35 -080076include $(BUILD_EXECUTABLE)