Build block TWRP with RECOVERY_VARIANT
Enable TWRP to reside alongside other recoveries with the naming
convention: bootable/recovery(-flag). If TWRP resides at
bootable/recovery and a device does not specify RECOVERY_VARIANT, then
it will build like normal. If TWRP resides at bootable/recovery-twrp,
then its makefiles will only be parsed if a device specifies
'RECOVERY_VARIANT := twrp'. This prevents TWRP specific makefile
warnings/errors (notably, missing DEVICE_RESOLUTION) when another
recovery is being built.
Change-Id: I8f02fffcd79c309c7123b9428eedc69af02e126e
diff --git a/Android.mk b/Android.mk
index ea6bb57..089485a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -14,6 +14,14 @@
LOCAL_PATH := $(call my-dir)
+ifeq ($(RECOVERY_VARIANT),)
+ifeq ($(LOCAL_PATH),bootable/recovery)
+RECOVERY_VARIANT := twrp
+endif
+endif
+
+ifeq ($(RECOVERY_VARIANT),twrp)
+
include $(CLEAR_VARS)
TARGET_RECOVERY_GUI := true
@@ -321,7 +329,7 @@
LOCAL_MODULE := verifier_test
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_TAGS := tests
-LOCAL_C_INCLUDES := bootable/recovery/libmincrypt/includes
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
LOCAL_SRC_FILES := \
verifier_test.cpp \
verifier.cpp \
@@ -339,7 +347,7 @@
LOCAL_MODULE := libaosprecovery
LOCAL_MODULE_TAGS := eng
LOCAL_MODULES_TAGS = optional
-LOCAL_C_INCLUDES := bootable/recovery/libmincrypt/includes
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
LOCAL_SRC_FILES = adb_install.cpp bootloader.cpp verifier.cpp mtdutils/mtdutils.c legacy_property_service.c
LOCAL_SHARED_LIBRARIES += libc liblog libcutils libmtdutils
LOCAL_STATIC_LIBRARIES += libmincrypttwrp
@@ -418,3 +426,7 @@
ifeq ($(TW_INCLUDE_FB2PNG), true)
include $(commands_recovery_local_path)/fb2png/Android.mk
endif
+
+commands_recovery_local_path :=
+
+endif
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index 61d904e..a146dfa 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -18,7 +18,10 @@
LOCAL_SRC_FILES := applypatch.c bspatch.c freecache.c imgpatch.c utils.c
LOCAL_MODULE := libapplypatch
LOCAL_MODULE_TAGS := eng
-LOCAL_C_INCLUDES += external/bzip2 external/zlib bootable/recovery
+LOCAL_C_INCLUDES += \
+ external/bzip2 \
+ external/zlib \
+ $(commands_recovery_local_path)
LOCAL_STATIC_LIBRARIES += libmtdutils libmincrypttwrp libbz libz
include $(BUILD_STATIC_LIBRARY)
@@ -27,7 +30,7 @@
LOCAL_SRC_FILES := main.c
LOCAL_MODULE := applypatch
-LOCAL_C_INCLUDES += bootable/recovery
+LOCAL_C_INCLUDES += $(commands_recovery_local_path)
LOCAL_STATIC_LIBRARIES += libapplypatch libmtdutils libmincrypttwrp libbz libminelf
LOCAL_SHARED_LIBRARIES += libz libcutils libstdc++ libc
@@ -39,7 +42,7 @@
LOCAL_MODULE := applypatch_static
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_TAGS := eng
-LOCAL_C_INCLUDES += bootable/recovery
+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/bmlutils/Android.mk b/bmlutils/Android.mk
index e20ce37..7c6676b 100644
--- a/bmlutils/Android.mk
+++ b/bmlutils/Android.mk
@@ -11,7 +11,7 @@
)
LOCAL_STATIC_LIBRARIES := libcrecovery
-LOCAL_C_INCLUDES := bootable/recovery/libcrecovery
+LOCAL_C_INCLUDES := $(commands_recovery_local_path)/libcrecovery
LOCAL_SRC_FILES := bmlutils.c
LOCAL_MODULE := libbmlutils
diff --git a/crypto/crypttools/Android.mk b/crypto/crypttools/Android.mk
index a2f8dfe..fc62583 100644
--- a/crypto/crypttools/Android.mk
+++ b/crypto/crypttools/Android.mk
@@ -10,6 +10,6 @@
LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities
LOCAL_FORCE_STATIC_EXECUTABLE := true
-LOCAL_C_INCLUDES := bootable/recovery/crypto/jb/
+LOCAL_C_INCLUDES := $(commands_recovery_local_path)/crypto/jb/
include $(BUILD_EXECUTABLE)
endif
\ No newline at end of file
diff --git a/crypto/fs_mgr/Android.mk b/crypto/fs_mgr/Android.mk
index 4196710..8dd9d4c 100644
--- a/crypto/fs_mgr/Android.mk
+++ b/crypto/fs_mgr/Android.mk
@@ -10,7 +10,9 @@
LOCAL_MODULE:= libfs_mgrtwrp
LOCAL_SHARED_LIBRARIES := libext4_utils
LOCAL_STATIC_LIBRARIES := liblogwraptwrp libmincrypttwrp
-LOCAL_C_INCLUDES += system/extras/ext4_utils bootable/recovery/libmincrypt/includes
+LOCAL_C_INCLUDES += \
+ system/extras/ext4_utils \
+ $(commands_recovery_local_path)/libmincrypt/includes
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_STATIC_LIBRARY)
diff --git a/crypto/jb/Android.mk b/crypto/jb/Android.mk
index dc458fd..0384087 100644
--- a/crypto/jb/Android.mk
+++ b/crypto/jb/Android.mk
@@ -7,7 +7,10 @@
LOCAL_MODULES_TAGS = optional
LOCAL_CFLAGS =
LOCAL_SRC_FILES = cryptfs.c
-LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include bootable/recovery/crypto/scrypt/lib/crypto
+LOCAL_C_INCLUDES += \
+ system/extras/ext4_utils \
+ external/openssl/include \
+ $(commands_recovery_local_path)/crypto/scrypt/lib/crypto
LOCAL_SHARED_LIBRARIES += libc liblog libcutils libcrypto libext4_utils
LOCAL_STATIC_LIBRARIES += libfs_mgrtwrp libscrypttwrp_static liblogwraptwrp libmincrypttwrp
diff --git a/crypto/scrypt/Scrypt-config.mk b/crypto/scrypt/Scrypt-config.mk
index bdaeccf..c0b00d8 100644
--- a/crypto/scrypt/Scrypt-config.mk
+++ b/crypto/scrypt/Scrypt-config.mk
@@ -77,7 +77,7 @@
endif
target_c_flags := $(common_c_flags) $($(target_arch)_c_flags) $(local_c_flags)
-target_c_includes := $(addprefix bootable/recovery/crypto/scrypt/,$(common_c_includes)) $(local_c_includes)
+target_c_includes := $(addprefix $(commands_recovery_local_path)/crypto/scrypt/,$(common_c_includes)) $(local_c_includes)
target_src_files := $(common_src_files) $($(target_arch)_src_files)
target_src_files := $(filter-out $($(target_arch)_exclude_files), $(target_src_files))
@@ -97,7 +97,7 @@
endif
host_c_flags := $(common_c_flags) $($(host_arch)_c_flags) $(local_c_flags)
-host_c_includes := $(addprefix bootable/recovery/crypto/scrypt/,$(common_c_includes)) $(local_c_includes)
+host_c_includes := $(addprefix $(commands_recovery_local_path)/crypto/scrypt/,$(common_c_includes)) $(local_c_includes)
host_src_files := $(common_src_files) $($(host_arch)_src_files)
host_src_files := $(filter-out $($(host_arch)_exclude_files), $(host_src_files))
diff --git a/exfat/exfat-fuse/Android.mk b/exfat/exfat-fuse/Android.mk
index f6ec20a..f31c7b1 100644
--- a/exfat/exfat-fuse/Android.mk
+++ b/exfat/exfat-fuse/Android.mk
@@ -9,8 +9,8 @@
LOCAL_CFLAGS = -D_FILE_OFFSET_BITS=64
LOCAL_SRC_FILES = main.c
LOCAL_C_INCLUDES += $(LOCAL_PATH) \
- bootable/recovery/exfat/libexfat \
- bootable/recovery/fuse/include
+ $(commands_recovery_local_path)/exfat/libexfat \
+ $(commands_recovery_local_path)/fuse/include
LOCAL_SHARED_LIBRARIES += libz libc libexfat libdl
LOCAL_STATIC_LIBRARIES += libfusetwrp
diff --git a/exfat/mkfs/Android.mk b/exfat/mkfs/Android.mk
index 8c48c77..fff04bd 100644
--- a/exfat/mkfs/Android.mk
+++ b/exfat/mkfs/Android.mk
@@ -8,8 +8,8 @@
LOCAL_CFLAGS = -D_FILE_OFFSET_BITS=64
LOCAL_SRC_FILES = cbm.c fat.c main.c mkexfat.c rootdir.c uct.c uctc.c vbr.c
LOCAL_C_INCLUDES += $(LOCAL_PATH) \
- bootable/recovery/exfat/libexfat \
- bootable/recovery/fuse/include
+ $(commands_recovery_local_path)/exfat/libexfat \
+ $(commands_recovery_local_path)/fuse/include
LOCAL_SHARED_LIBRARIES += libz libc libexfat libdl
LOCAL_STATIC_LIBRARIES += libfusetwrp
diff --git a/flashutils/Android.mk b/flashutils/Android.mk
index 33f32d6..7ad313b 100644
--- a/flashutils/Android.mk
+++ b/flashutils/Android.mk
@@ -6,7 +6,7 @@
LOCAL_SRC_FILES := flashutils.c
LOCAL_MODULE := libflashutils
LOCAL_MODULE_TAGS := optional
-LOCAL_C_INCLUDES += bootable/recovery
+LOCAL_C_INCLUDES += $(commands_recovery_local_path)
LOCAL_STATIC_LIBRARIES := libmmcutils libmtdutils libbmlutils libcrecovery
BOARD_RECOVERY_DEFINES := BOARD_BML_BOOT BOARD_BML_RECOVERY
@@ -108,7 +108,7 @@
LOCAL_SRC_FILES := flashutils.c
LOCAL_MODULE := libflashutils
LOCAL_MODULE_TAGS := eng
-LOCAL_C_INCLUDES += bootable/recovery
+LOCAL_C_INCLUDES += $(commands_recovery_local_path)
LOCAL_SHARED_LIBRARIES := libc libmmcutils libbmlutils
LOCAL_STATIC_LIBRARIES := libmtdutils
diff --git a/gui/Android.mk b/gui/Android.mk
index 3e499ab..113fa53 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -74,9 +74,9 @@
$(error stopping)
endif
-ifeq "$(wildcard bootable/recovery/gui/devices/$(DEVICE_RESOLUTION))" ""
+ifeq "$(wildcard $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION))" ""
$(warning ********************************************************************************)
-$(warning * DEVICE_RESOLUTION ($(DEVICE_RESOLUTION)) does NOT EXIST in bootable/recovery/gui/devices )
+$(warning * DEVICE_RESOLUTION ($(DEVICE_RESOLUTION)) does NOT EXIST in $(commands_recovery_local_path)/gui/devices )
$(warning * Please choose an existing theme or create a new one for your device )
$(warning ********************************************************************************)
$(error stopping)
diff --git a/libmincrypt/Android.mk b/libmincrypt/Android.mk
index c111f4b..1c21324 100644
--- a/libmincrypt/Android.mk
+++ b/libmincrypt/Android.mk
@@ -4,7 +4,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE := libmincrypttwrp
-LOCAL_C_INCLUDES := bootable/recovery/libmincrypt/includes
+LOCAL_C_INCLUDES := $(commands_recovery_local_path)/libmincrypt/includes
LOCAL_SRC_FILES := rsa.c sha.c sha256.c
include $(BUILD_STATIC_LIBRARY)
diff --git a/minelf/Android.mk b/minelf/Android.mk
index 0f41ff5..10818ea 100644
--- a/minelf/Android.mk
+++ b/minelf/Android.mk
@@ -18,7 +18,7 @@
LOCAL_SRC_FILES := \
Retouch.c
-LOCAL_C_INCLUDES += bootable/recovery
+LOCAL_C_INCLUDES += $(commands_recovery_local_path)
LOCAL_MODULE := libminelf
diff --git a/minui/Android.mk b/minui/Android.mk
index e8c1b9c..54eb061 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -18,10 +18,10 @@
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
else
- LOCAL_C_INCLUDES += bootable/recovery/minui/include
+ LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minui/include
endif
else
- LOCAL_C_INCLUDES += bootable/recovery/minui/include
+ LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minui/include
endif
LOCAL_STATIC_LIBRARY := libpng
@@ -73,10 +73,10 @@
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
else
- LOCAL_C_INCLUDES += bootable/recovery/minui/include
+ LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minui/include
endif
else
- LOCAL_C_INCLUDES += bootable/recovery/minui/include
+ LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minui/include
endif
LOCAL_C_INCLUDES +=\
diff --git a/minuitwrp/Android.mk b/minuitwrp/Android.mk
index fad451f..ba81f27 100644
--- a/minuitwrp/Android.mk
+++ b/minuitwrp/Android.mk
@@ -16,10 +16,10 @@
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
else
- LOCAL_C_INCLUDES += bootable/recovery/minuitwrp/include
+ LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minuitwrp/include
endif
else
- LOCAL_C_INCLUDES += bootable/recovery/minuitwrp/include
+ LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minuitwrp/include
endif
LOCAL_C_INCLUDES += \
diff --git a/mtdutils/Android.mk b/mtdutils/Android.mk
index 6843fa9..cdde25f 100644
--- a/mtdutils/Android.mk
+++ b/mtdutils/Android.mk
@@ -37,7 +37,7 @@
ifeq ($(BOARD_USES_BML_OVER_MTD),true)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := bml_over_mtd.c
-LOCAL_C_INCLUDES += bootable/recovery/mtdutils
+LOCAL_C_INCLUDES += $(commands_recovery_local_path)/mtdutils
LOCAL_MODULE := libbml_over_mtd
LOCAL_MODULE_TAGS := eng
LOCAL_CFLAGS += -Dmain=bml_over_mtd_main
@@ -51,7 +51,7 @@
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities
LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities
LOCAL_MODULE_STEM := bml_over_mtd
-LOCAL_C_INCLUDES += bootable/recovery/mtdutils
+LOCAL_C_INCLUDES += $(commands_recovery_local_path)/mtdutils
LOCAL_STATIC_LIBRARIES := libmtdutils
LOCAL_SHARED_LIBRARIES := libcutils liblog libc
include $(BUILD_EXECUTABLE)
diff --git a/openaes/Android.mk b/openaes/Android.mk
index 360cf6c..336ebdd 100644
--- a/openaes/Android.mk
+++ b/openaes/Android.mk
@@ -5,8 +5,8 @@
# Build shared binary
LOCAL_SRC_FILES:= src/oaes.c \
LOCAL_C_INCLUDES := \
- bootable/recovery/openaes/src/isaac \
- bootable/recovery/openaes/inc
+ $(commands_recovery_local_path)/openaes/src/isaac \
+ $(commands_recovery_local_path)/openaes/inc
LOCAL_CFLAGS:= -g -c -W
LOCAL_MODULE:=openaes
LOCAL_MODULE_TAGS:= eng
@@ -20,8 +20,8 @@
LOCAL_MODULE := libopenaes
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
- bootable/recovery/openaes/src/isaac \
- bootable/recovery/openaes/inc
+ $(commands_recovery_local_path)/openaes/src/isaac \
+ $(commands_recovery_local_path)/openaes/inc
LOCAL_SRC_FILES = src/oaes_lib.c src/isaac/rand.c
LOCAL_SHARED_LIBRARIES = libc
include $(BUILD_SHARED_LIBRARY)
@@ -31,8 +31,8 @@
LOCAL_MODULE := libopenaes_static
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
- bootable/recovery/openaes/src/isaac \
- bootable/recovery/openaes/inc
+ $(commands_recovery_local_path)/openaes/src/isaac \
+ $(commands_recovery_local_path)/openaes/inc
LOCAL_SRC_FILES = src/oaes_lib.c src/isaac/rand.c
LOCAL_STATIC_LIBRARIES = libc
include $(BUILD_STATIC_LIBRARY)