blob: b0e58116c046a66662e3ddc9a577535c6f867a0d [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 \
7 updater.c
8
9#
Doug Zongkerad3db092009-06-26 13:38:55 -070010# Build a statically-linked binary to include in OTA packages
Doug Zongker9931f7f2009-06-10 14:11:53 -070011#
12include $(CLEAR_VARS)
13
Doug Zongkerad3db092009-06-26 13:38:55 -070014# Build only in eng, so we don't end up with a copy of this in /system
15# on user builds. (TODO: find a better way to build device binaries
16# needed only for OTA packages.)
17LOCAL_MODULE_TAGS := eng
18
Doug Zongker9931f7f2009-06-10 14:11:53 -070019LOCAL_SRC_FILES := $(updater_src_files)
20
Koushik Duttab5a36a02010-09-13 14:33:15 -070021ifdef BOARD_USES_BMLUTILS
22 LOCAL_CFLAGS += -DBOARD_USES_BMLUTILS
23 LOCAL_STATIC_LIBRARIES += libbmlutils
24endif
25
Koushik Duttae5678e92010-09-13 13:25:11 -070026LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
Doug Zongker2b0fdc62009-06-19 11:22:06 -070027LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz
Doug Zongker8edb00c2009-06-11 17:21:44 -070028LOCAL_STATIC_LIBRARIES += libmincrypt libbz
Doug Zongker9931f7f2009-06-10 14:11:53 -070029LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc
30LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
31
Doug Zongker2b0fdc62009-06-19 11:22:06 -070032# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function
33# named "Register_<libname>()". Here we emit a little C function that
34# gets #included by updater.c. It calls all those registration
35# functions.
36
37# Devices can also add libraries to TARGET_RECOVERY_UPDATER_EXTRA_LIBS.
38# These libs are also linked in with updater, but we don't try to call
39# any sort of registration function for these. Use this variable for
40# any subsidiary static libraries required for your registered
41# extension libs.
42
43inc := $(call intermediates-dir-for,PACKAGING,updater_extensions)/register.inc
44
45# During the first pass of reading the makefiles, we dump the list of
46# extension libs to a temp file, then copy that to the ".list" file if
47# it is different than the existing .list (if any). The register.inc
48# file then uses the .list as a prerequisite, so it is only rebuilt
49# (and updater.o recompiled) when the list of extension libs changes.
50
51junk := $(shell mkdir -p $(dir $(inc));\
52 echo $(TARGET_RECOVERY_UPDATER_LIBS) > $(inc).temp;\
53 diff -q $(inc).temp $(inc).list || cp -f $(inc).temp $(inc).list)
54
55$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS)
56$(inc) : $(inc).list
57 $(hide) mkdir -p $(dir $@)
58 $(hide) echo "" > $@
59 $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@)
60 $(hide) echo "void RegisterDeviceExtensions() {" >> $@
61 $(hide) $(foreach lib,$(libs),echo " Register_$(lib)();" >> $@)
62 $(hide) echo "}" >> $@
63
64$(call intermediates-dir-for,EXECUTABLES,updater)/updater.o : $(inc)
65LOCAL_C_INCLUDES += $(dir $(inc))
66
Doug Zongker9931f7f2009-06-10 14:11:53 -070067LOCAL_MODULE := updater
68
69LOCAL_FORCE_STATIC_EXECUTABLE := true
70
71include $(BUILD_EXECUTABLE)
Koushik Duttaada3f3b2010-05-01 21:30:55 -070072
73
74file := $(PRODUCT_OUT)/utilities/update-binary
75ALL_PREBUILT += $(file)
76$(file) : $(TARGET_OUT)/bin/updater | $(ACP)
77 $(transform-prebuilt-to-target)