Doug Zongker | 9931f7f | 2009-06-10 14:11:53 -0700 | [diff] [blame] | 1 | # Copyright 2009 The Android Open Source Project |
| 2 | |
| 3 | LOCAL_PATH := $(call my-dir) |
| 4 | |
| 5 | updater_src_files := \ |
| 6 | install.c \ |
Koushik Dutta | 1b86754 | 2010-11-10 23:52:09 -0800 | [diff] [blame] | 7 | ../mounts.c \ |
Doug Zongker | 9931f7f | 2009-06-10 14:11:53 -0700 | [diff] [blame] | 8 | updater.c |
| 9 | |
| 10 | # |
Doug Zongker | ad3db09 | 2009-06-26 13:38:55 -0700 | [diff] [blame] | 11 | # Build a statically-linked binary to include in OTA packages |
Doug Zongker | 9931f7f | 2009-06-10 14:11:53 -0700 | [diff] [blame] | 12 | # |
| 13 | include $(CLEAR_VARS) |
| 14 | |
Doug Zongker | ad3db09 | 2009-06-26 13:38:55 -0700 | [diff] [blame] | 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.) |
| 18 | LOCAL_MODULE_TAGS := eng |
| 19 | |
Doug Zongker | 9931f7f | 2009-06-10 14:11:53 -0700 | [diff] [blame] | 20 | LOCAL_SRC_FILES := $(updater_src_files) |
| 21 | |
Steve Kondik | 4123b58 | 2010-11-14 03:18:40 -0500 | [diff] [blame^] | 22 | LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils |
Koushik Dutta | b5a36a0 | 2010-09-13 14:33:15 -0700 | [diff] [blame] | 23 | |
Koushik Dutta | e5678e9 | 2010-09-13 13:25:11 -0700 | [diff] [blame] | 24 | LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS) |
Koushik Dutta | 1b86754 | 2010-11-10 23:52:09 -0800 | [diff] [blame] | 25 | LOCAL_STATIC_LIBRARIES += libapplypatch libedify libminzip libz |
Doug Zongker | 8edb00c | 2009-06-11 17:21:44 -0700 | [diff] [blame] | 26 | LOCAL_STATIC_LIBRARIES += libmincrypt libbz |
Doug Zongker | 9931f7f | 2009-06-10 14:11:53 -0700 | [diff] [blame] | 27 | LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc |
| 28 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. |
| 29 | |
Doug Zongker | 2b0fdc6 | 2009-06-19 11:22:06 -0700 | [diff] [blame] | 30 | # 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 | |
| 41 | inc := $(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 | |
| 49 | junk := $(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) |
| 63 | LOCAL_C_INCLUDES += $(dir $(inc)) |
| 64 | |
Doug Zongker | 9931f7f | 2009-06-10 14:11:53 -0700 | [diff] [blame] | 65 | LOCAL_MODULE := updater |
| 66 | |
| 67 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 68 | |
| 69 | include $(BUILD_EXECUTABLE) |
Koushik Dutta | ada3f3b | 2010-05-01 21:30:55 -0700 | [diff] [blame] | 70 | |
| 71 | |
| 72 | file := $(PRODUCT_OUT)/utilities/update-binary |
| 73 | ALL_PREBUILT += $(file) |
| 74 | $(file) : $(TARGET_OUT)/bin/updater | $(ACP) |
| 75 | $(transform-prebuilt-to-target) |