From 55c75cad80479f35928f20fba7dcfbc3aec9994e Mon Sep 17 00:00:00 2001 From: Matt Mower Date: Sun, 31 Aug 2014 11:30:15 -0500 Subject: 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 --- Android.mk | 16 ++++++++++++++-- applypatch/Android.mk | 9 ++++++--- bmlutils/Android.mk | 2 +- crypto/crypttools/Android.mk | 2 +- crypto/fs_mgr/Android.mk | 4 +++- crypto/jb/Android.mk | 5 ++++- crypto/scrypt/Scrypt-config.mk | 4 ++-- exfat/exfat-fuse/Android.mk | 4 ++-- exfat/mkfs/Android.mk | 4 ++-- flashutils/Android.mk | 4 ++-- gui/Android.mk | 4 ++-- libmincrypt/Android.mk | 2 +- minelf/Android.mk | 2 +- minui/Android.mk | 8 ++++---- minuitwrp/Android.mk | 4 ++-- mtdutils/Android.mk | 4 ++-- openaes/Android.mk | 12 ++++++------ 17 files changed, 55 insertions(+), 35 deletions(-) diff --git a/Android.mk b/Android.mk index ea6bb57c9..089485a15 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 @@ include $(CLEAR_VARS) 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 @@ include $(CLEAR_VARS) 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 @@ endif 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 61d904ec6..a146dfa82 100644 --- a/applypatch/Android.mk +++ b/applypatch/Android.mk @@ -18,7 +18,10 @@ include $(CLEAR_VARS) 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 @@ include $(CLEAR_VARS) 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_SRC_FILES := main.c 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 e20ce373d..7c6676b38 100644 --- a/bmlutils/Android.mk +++ b/bmlutils/Android.mk @@ -11,7 +11,7 @@ $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \ ) 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 a2f8dfed5..fc62583c4 100644 --- a/crypto/crypttools/Android.mk +++ b/crypto/crypttools/Android.mk @@ -10,6 +10,6 @@ LOCAL_STATIC_LIBRARIES += libfs_mgrtwrp libc libcutils 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 4196710af..8dd9d4ca2 100644 --- a/crypto/fs_mgr/Android.mk +++ b/crypto/fs_mgr/Android.mk @@ -10,7 +10,9 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 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 dc458fd14..03840873a 100644 --- a/crypto/jb/Android.mk +++ b/crypto/jb/Android.mk @@ -7,7 +7,10 @@ LOCAL_MODULE_TAGS := eng 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 bdaeccf30..c0b00d873 100644 --- a/crypto/scrypt/Scrypt-config.mk +++ b/crypto/scrypt/Scrypt-config.mk @@ -77,7 +77,7 @@ target_arch := unknown_arch 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 @@ host_arch := unknown_arch 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 f6ec20a85..f31c7b162 100644 --- a/exfat/exfat-fuse/Android.mk +++ b/exfat/exfat-fuse/Android.mk @@ -9,8 +9,8 @@ LOCAL_MODULE_TAGS := optional 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 8c48c77cb..fff04bd7b 100644 --- a/exfat/mkfs/Android.mk +++ b/exfat/mkfs/Android.mk @@ -8,8 +8,8 @@ LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin 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 33f32d6b0..7ad313be3 100644 --- a/flashutils/Android.mk +++ b/flashutils/Android.mk @@ -6,7 +6,7 @@ include $(CLEAR_VARS) 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 @@ include $(CLEAR_VARS) 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 3e499abe3..113fa5387 100644 --- a/gui/Android.mk +++ b/gui/Android.mk @@ -74,9 +74,9 @@ $(warning ********************************************************************** $(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 c111f4b1a..1c213245c 100644 --- a/libmincrypt/Android.mk +++ b/libmincrypt/Android.mk @@ -4,7 +4,7 @@ LOCAL_PATH := $(call my-dir) 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 0f41ff528..10818eae4 100644 --- a/minelf/Android.mk +++ b/minelf/Android.mk @@ -18,7 +18,7 @@ include $(CLEAR_VARS) 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 e8c1b9ccf..54eb06166 100644 --- a/minui/Android.mk +++ b/minui/Android.mk @@ -18,10 +18,10 @@ ifeq ($(TW_TARGET_USES_QCOM_BSP), true) 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 @@ ifeq ($(TW_TARGET_USES_QCOM_BSP), true) 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 fad451f7e..ba81f2723 100644 --- a/minuitwrp/Android.mk +++ b/minuitwrp/Android.mk @@ -16,10 +16,10 @@ ifeq ($(TW_TARGET_USES_QCOM_BSP), true) 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 6843fa94e..cdde25f31 100644 --- a/mtdutils/Android.mk +++ b/mtdutils/Android.mk @@ -37,7 +37,7 @@ include $(BUILD_SHARED_LIBRARY) 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_CLASS := UTILITY_EXECUTABLES 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 360cf6ccc..336ebddeb 100644 --- a/openaes/Android.mk +++ b/openaes/Android.mk @@ -5,8 +5,8 @@ ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true) # 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 @@ ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true) 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 @@ ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true) 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) -- cgit v1.2.3