blob: ae90211a6abdb2d7e2cb46f795d6cb3250cf0bfb [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
Koushik Dutta1b867542010-11-10 23:52:09 -080022LOCAL_STATIC_LIBRARIES += $(BOARD_FLASH_LIBRARY)
Koushik Duttab5a36a02010-09-13 14:33:15 -070023
Koushik Duttae5678e92010-09-13 13:25:11 -070024LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
Koushik Dutta1b867542010-11-10 23:52:09 -080025LOCAL_STATIC_LIBRARIES += libapplypatch libedify libminzip libz
Doug Zongker8edb00c2009-06-11 17:21:44 -070026LOCAL_STATIC_LIBRARIES += libmincrypt libbz
Doug Zongker9931f7f2009-06-10 14:11:53 -070027LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc
28LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
29
Doug Zongker2b0fdc62009-06-19 11:22:06 -070030# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function
31# named "Register_<libname>()". Here we emit a little C function that
32# gets #included by updater.c. It calls all those registration
33# functions.
34
35# Devices can also add libraries to TARGET_RECOVERY_UPDATER_EXTRA_LIBS.
36# These libs are also linked in with updater, but we don't try to call
37# any sort of registration function for these. Use this variable for
38# any subsidiary static libraries required for your registered
39# extension libs.
40
41inc := $(call intermediates-dir-for,PACKAGING,updater_extensions)/register.inc
42
43# During the first pass of reading the makefiles, we dump the list of
44# extension libs to a temp file, then copy that to the ".list" file if
45# it is different than the existing .list (if any). The register.inc
46# file then uses the .list as a prerequisite, so it is only rebuilt
47# (and updater.o recompiled) when the list of extension libs changes.
48
49junk := $(shell mkdir -p $(dir $(inc));\
50 echo $(TARGET_RECOVERY_UPDATER_LIBS) > $(inc).temp;\
51 diff -q $(inc).temp $(inc).list || cp -f $(inc).temp $(inc).list)
52
53$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS)
54$(inc) : $(inc).list
55 $(hide) mkdir -p $(dir $@)
56 $(hide) echo "" > $@
57 $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@)
58 $(hide) echo "void RegisterDeviceExtensions() {" >> $@
59 $(hide) $(foreach lib,$(libs),echo " Register_$(lib)();" >> $@)
60 $(hide) echo "}" >> $@
61
62$(call intermediates-dir-for,EXECUTABLES,updater)/updater.o : $(inc)
63LOCAL_C_INCLUDES += $(dir $(inc))
64
Doug Zongker9931f7f2009-06-10 14:11:53 -070065LOCAL_MODULE := updater
66
67LOCAL_FORCE_STATIC_EXECUTABLE := true
68
69include $(BUILD_EXECUTABLE)
Koushik Duttaada3f3b2010-05-01 21:30:55 -070070
71
72file := $(PRODUCT_OUT)/utilities/update-binary
73ALL_PREBUILT += $(file)
74$(file) : $(TARGET_OUT)/bin/updater | $(ACP)
75 $(transform-prebuilt-to-target)