Remove dependence on build hax in makefiles
Update makefiles to no longer rely on INTERNAL_RECOVERY_FILES. Define
LOCAL_ADDITIONAL_DEPENDENCIES instead.
Set LOCAL_LDFLAGS to properly link recovery executable.
Change-Id: I4542104c69399b5a19674b9772ab89c3709efa72
diff --git a/Android.mk b/Android.mk
index 5ec184e..9555461 100644
--- a/Android.mk
+++ b/Android.mk
@@ -316,6 +316,68 @@
LOCAL_CFLAGS += -DHAVE_CAPABILITIES
endif
+LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker
+
+LOCAL_ADDITIONAL_DEPENDENCIES := \
+ busybox_symlinks \
+ dosfsck \
+ dosfslabel \
+ dump_image \
+ erase_image \
+ flash_image \
+ fix_permissions.sh \
+ fsck_msdos_symlink \
+ mkdosfs \
+ mke2fs.conf \
+ mkexfatfs \
+ pigz \
+ teamwin \
+ toolbox_symlinks \
+ twrp \
+ unpigz_symlink \
+ updater
+
+ifeq ($(BOARD_HAS_NO_REAL_SDCARD),)
+ LOCAL_ADDITIONAL_DEPENDENCIES += parted
+endif
+ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += openaes ../openaes/LICENSE
+endif
+ifeq ($(TW_INCLUDE_DUMLOCK), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += \
+ htcdumlock htcdumlocksys flash_imagesys dump_imagesys libbmlutils.so \
+ libflashutils.so libmmcutils.so libmtdutils.so HTCDumlock.apk
+endif
+ifneq ($(TW_EXCLUDE_SUPERSU), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += \
+ su install-recovery.sh 99SuperSUDaemon Superuser.apk
+endif
+ifneq ($(TW_NO_EXFAT_FUSE), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += exfat-fuse
+endif
+ifeq ($(TW_INCLUDE_CRYPTO), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += cryptfs cryptsettings
+endif
+ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += getfooter
+endif
+ifeq ($(TW_INCLUDE_FB2PNG), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += fb2png
+endif
+ifneq ($(TW_OEM_BUILD),true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += orscmd
+endif
+ifeq ($(BOARD_USES_BML_OVER_MTD),true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += bml_over_mtd
+endif
+ifeq ($(TW_INCLUDE_INJECTTWRP), true)
+ LOCAL_ADDITIONAL_DEPENDENCIES += injecttwrp
+endif
+# Allow devices to specify device-specific recovery dependencies
+ifneq ($(TARGET_RECOVERY_DEVICE_MODULES),)
+ LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_RECOVERY_DEVICE_MODULES)
+endif
+
include $(BUILD_EXECUTABLE)
ifneq ($(TW_USE_TOOLBOX), true)
@@ -341,8 +403,13 @@
@rm -rf $@
$(hide) ln -sf $(BUSYBOX_BINARY) $@
-ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS)
-endif
+include $(CLEAR_VARS)
+LOCAL_MODULE := busybox_symlinks
+LOCAL_MODULE_TAGS := optional
+LOCAL_ADDITIONAL_DEPENDENCIES := $(RECOVERY_BUSYBOX_SYMLINKS)
+include $(BUILD_PHONY_PACKAGE)
+RECOVERY_BUSYBOX_SYMLINKS :=
+endif # !TW_USE_TOOLBOX
include $(CLEAR_VARS)
LOCAL_MODULE := verifier_test
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index 98981a6..04ddfd8 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -38,6 +38,7 @@
LOCAL_SRC_FILES := main.c
LOCAL_MODULE := applypatch
+LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES += $(commands_recovery_local_path)
LOCAL_STATIC_LIBRARIES += libapplypatch libmtdutils libmincrypttwrp libbz libminelf
LOCAL_SHARED_LIBRARIES += libz libcutils libstdc++ libc
@@ -49,7 +50,7 @@
LOCAL_SRC_FILES := main.c
LOCAL_MODULE := applypatch_static
LOCAL_FORCE_STATIC_EXECUTABLE := true
-LOCAL_MODULE_TAGS := eng
+LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES += $(commands_recovery_local_path)
LOCAL_STATIC_LIBRARIES += libapplypatch libmtdutils libmincrypttwrp libbz libminelf
LOCAL_STATIC_LIBRARIES += libz libcutils libstdc++ libc
diff --git a/crypto/scrypt/tests/Android.mk b/crypto/scrypt/tests/Android.mk
index b25e1c4..a4562de 100644
--- a/crypto/scrypt/tests/Android.mk
+++ b/crypto/scrypt/tests/Android.mk
@@ -3,8 +3,6 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
LOCAL_SRC_FILES:= \
scrypt_test.cpp
diff --git a/dosfstools/Android.mk b/dosfstools/Android.mk
index 62297f3..7c8592d 100644
--- a/dosfstools/Android.mk
+++ b/dosfstools/Android.mk
@@ -23,14 +23,12 @@
@rm -rf $@
$(hide) ln -sf $(DOSFSCK_BINARY) $@
-ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
-
-# We need this so that the installed files could be picked up based on the
-# local module name
-ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
- $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
-
-
+include $(CLEAR_VARS)
+LOCAL_MODULE := fsck_msdos_symlink
+LOCAL_MODULE_TAGS := optional
+LOCAL_ADDITIONAL_DEPENDENCIES := $(SYMLINKS)
+include $(BUILD_PHONY_PACKAGE)
+SYMLINKS :=
include $(CLEAR_VARS)
LOCAL_SRC_FILES := src/boot.c src/check.c src/common.c src/fat.c \
diff --git a/exfat/exfat-fuse/Android.mk b/exfat/exfat-fuse/Android.mk
index f31c7b1..251e087 100644
--- a/exfat/exfat-fuse/Android.mk
+++ b/exfat/exfat-fuse/Android.mk
@@ -15,8 +15,3 @@
LOCAL_STATIC_LIBRARIES += libfusetwrp
include $(BUILD_EXECUTABLE)
-
-# We need this so that the installed files could be picked up based on the
-# local module name
-ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
- $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
diff --git a/exfat/mkfs/Android.mk b/exfat/mkfs/Android.mk
index fff04bd..a0c601f 100644
--- a/exfat/mkfs/Android.mk
+++ b/exfat/mkfs/Android.mk
@@ -14,8 +14,3 @@
LOCAL_STATIC_LIBRARIES += libfusetwrp
include $(BUILD_EXECUTABLE)
-
-# We need this so that the installed files could be picked up based on the
-# local module name
-ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
- $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
diff --git a/flashutils/Android.mk b/flashutils/Android.mk
index 7ad313b..3209cb0 100644
--- a/flashutils/Android.mk
+++ b/flashutils/Android.mk
@@ -21,32 +21,6 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := flash_image.c
-LOCAL_MODULE := flash_image
-LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_LIBRARIES := libflashutils libmtdutils libmmcutils libbmlutils libcrecovery
-LOCAL_SHARED_LIBRARIES := libcutils libc
-include $(BUILD_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := dump_image.c
-LOCAL_MODULE := dump_image
-LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_LIBRARIES := libflashutils libmtdutils libmmcutils libbmlutils libcrecovery
-LOCAL_SHARED_LIBRARIES := libcutils libc
-include $(BUILD_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := erase_image.c
-LOCAL_MODULE := erase_image
-LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_LIBRARIES := libflashutils libmtdutils libmmcutils libbmlutils libcrecovery
-LOCAL_SHARED_LIBRARIES := libcutils libc
-include $(BUILD_EXECUTABLE)
-
-ALL_DEFAULT_INSTALLED_MODULES += $(addprefix $(TARGET_OUT)/bin/, flash_image dump_image erase_image)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := flash_image.c
LOCAL_MODULE := libflash_image
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS += -Dmain=flash_image_main
diff --git a/pigz/Android.mk b/pigz/Android.mk
index 6ff50b8..7a5a4ee 100644
--- a/pigz/Android.mk
+++ b/pigz/Android.mk
@@ -24,9 +24,9 @@
@rm -rf $@
$(hide) ln -sf $(PIGZ_BINARY) $@
-ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
-
-# We need this so that the installed files could be picked up based on the
-# local module name
-ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
- $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
+include $(CLEAR_VARS)
+LOCAL_MODULE := unpigz_symlink
+LOCAL_MODULE_TAGS := optional
+LOCAL_ADDITIONAL_DEPENDENCIES := $(SYMLINKS)
+include $(BUILD_PHONY_PACKAGE)
+SYMLINKS :=
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 07962c5..12d6024 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -133,7 +133,6 @@
$(GEN): $(RELINK)
$(GEN): $(RELINK_SOURCE_FILES) $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
$(RELINK) $(TARGET_RECOVERY_ROOT_OUT)/sbin $(RELINK_SOURCE_FILES)
- $(RELINK) $(call intermediates-dir-for,EXECUTABLES,recovery) $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
LOCAL_GENERATED_SOURCES := $(GEN)
LOCAL_SRC_FILES := teamwin $(GEN)
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index 053660a..8a96c81 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -141,9 +141,9 @@
@rm -rf $@
$(hide) ln -sf $(TOOLBOX_BINARY) $@
-ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
-
-# We need this so that the installed files could be picked up based on the
-# local module name
-ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
- $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)
+include $(CLEAR_VARS)
+LOCAL_MODULE := toolbox_symlinks
+LOCAL_MODULE_TAGS := optional
+LOCAL_ADDITIONAL_DEPENDENCIES := $(SYMLINKS)
+include $(BUILD_PHONY_PACKAGE)
+SYMLINKS :=