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 | |
Doug Zongker | 56c5105 | 2010-07-01 09:18:44 -0700 | [diff] [blame] | 22 | ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) |
| 23 | LOCAL_CFLAGS += -DUSE_EXT4 |
| 24 | LOCAL_C_INCLUDES += system/extras/ext4_utils |
| 25 | LOCAL_STATIC_LIBRARIES += libext4_utils libz |
| 26 | endif |
| 27 | |
Steve Kondik | 4123b58 | 2010-11-14 03:18:40 -0500 | [diff] [blame] | 28 | LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils |
Koushik Dutta | b5a36a0 | 2010-09-13 14:33:15 -0700 | [diff] [blame] | 29 | |
Doug Zongker | 56c5105 | 2010-07-01 09:18:44 -0700 | [diff] [blame] | 30 | LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS) |
Doug Zongker | 2b0fdc6 | 2009-06-19 11:22:06 -0700 | [diff] [blame] | 31 | LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz |
Doug Zongker | 8edb00c | 2009-06-11 17:21:44 -0700 | [diff] [blame] | 32 | LOCAL_STATIC_LIBRARIES += libmincrypt libbz |
Hristo Bojinov | db314d6 | 2010-08-02 10:29:49 -0700 | [diff] [blame] | 33 | LOCAL_STATIC_LIBRARIES += libminelf |
Doug Zongker | 9931f7f | 2009-06-10 14:11:53 -0700 | [diff] [blame] | 34 | LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc |
| 35 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. |
| 36 | |
Doug Zongker | 2b0fdc6 | 2009-06-19 11:22:06 -0700 | [diff] [blame] | 37 | # 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 | |
| 48 | inc := $(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 | |
| 56 | junk := $(shell mkdir -p $(dir $(inc));\ |
| 57 | echo $(TARGET_RECOVERY_UPDATER_LIBS) > $(inc).temp;\ |
Ying Wang | b7b7b37 | 2011-05-24 16:08:38 -0700 | [diff] [blame] | 58 | diff -q $(inc).temp $(inc).list 2>/dev/null || cp -f $(inc).temp $(inc).list) |
Doug Zongker | 2b0fdc6 | 2009-06-19 11:22:06 -0700 | [diff] [blame] | 59 | |
| 60 | $(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS) |
| 61 | $(inc) : $(inc).list |
| 62 | $(hide) mkdir -p $(dir $@) |
| 63 | $(hide) echo "" > $@ |
Michael Ward | 6242a8b | 2011-07-14 15:06:12 -0700 | [diff] [blame] | 64 | $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@;) |
Doug Zongker | 2b0fdc6 | 2009-06-19 11:22:06 -0700 | [diff] [blame] | 65 | $(hide) echo "void RegisterDeviceExtensions() {" >> $@ |
Michael Ward | 6242a8b | 2011-07-14 15:06:12 -0700 | [diff] [blame] | 66 | $(hide) $(foreach lib,$(libs),echo " Register_$(lib)();" >> $@;) |
Doug Zongker | 2b0fdc6 | 2009-06-19 11:22:06 -0700 | [diff] [blame] | 67 | $(hide) echo "}" >> $@ |
| 68 | |
| 69 | $(call intermediates-dir-for,EXECUTABLES,updater)/updater.o : $(inc) |
| 70 | LOCAL_C_INCLUDES += $(dir $(inc)) |
| 71 | |
Doug Zongker | 9931f7f | 2009-06-10 14:11:53 -0700 | [diff] [blame] | 72 | LOCAL_MODULE := updater |
| 73 | |
| 74 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
| 75 | |
Koushik Dutta | 0df56f4 | 2011-11-16 16:00:35 -0800 | [diff] [blame^] | 76 | include $(BUILD_EXECUTABLE) |