Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
Sean hoyt | c387622 | 2018-07-15 06:16:09 +0200 | [diff] [blame] | 2 | include $(CLEAR_VARS) |
| 3 | |
| 4 | LOCAL_CFLAGS := -fno-strict-aliasing -Wno-implicit-fallthrough |
| 5 | |
| 6 | LOCAL_SRC_FILES := \ |
| 7 | gui.cpp \ |
| 8 | resources.cpp \ |
| 9 | pages.cpp \ |
| 10 | text.cpp \ |
| 11 | image.cpp \ |
| 12 | action.cpp \ |
| 13 | console.cpp \ |
| 14 | fill.cpp \ |
| 15 | button.cpp \ |
| 16 | checkbox.cpp \ |
| 17 | fileselector.cpp \ |
| 18 | progressbar.cpp \ |
| 19 | animation.cpp \ |
| 20 | object.cpp \ |
| 21 | slider.cpp \ |
| 22 | slidervalue.cpp \ |
| 23 | listbox.cpp \ |
| 24 | keyboard.cpp \ |
| 25 | input.cpp \ |
| 26 | blanktimer.cpp \ |
| 27 | partitionlist.cpp \ |
| 28 | mousecursor.cpp \ |
| 29 | scrolllist.cpp \ |
| 30 | patternpassword.cpp \ |
| 31 | textbox.cpp \ |
| 32 | terminal.cpp \ |
| 33 | twmsg.cpp |
| 34 | |
| 35 | ifneq ($(TW_DELAY_TOUCH_INIT_MS),) |
| 36 | LOCAL_CFLAGS += -DTW_DELAY_TOUCH_INIT_MS=$(TW_DELAY_TOUCH_INIT_MS) |
| 37 | endif |
| 38 | |
| 39 | ifneq ($(TWRP_CUSTOM_KEYBOARD),) |
| 40 | LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD) |
| 41 | else |
| 42 | LOCAL_SRC_FILES += hardwarekeyboard.cpp |
| 43 | endif |
| 44 | |
| 45 | LOCAL_SHARED_LIBRARIES += libminuitwrp libc libstdc++ libaosprecovery libselinux |
| 46 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/../otautil/include |
| 47 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/../twrpinstall/include |
| 48 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0) |
| 49 | LOCAL_SHARED_LIBRARIES += libziparchive |
| 50 | LOCAL_STATIC_LIBRARIES += libotautil libtwrpinstall |
| 51 | ifneq ($(TW_INCLUDE_CRYPTO),) |
| 52 | LOCAL_C_INCLUDES += bootable/recovery/crypto/fscrypt |
| 53 | endif |
| 54 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 28; echo $$?),0) |
| 55 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/../install/include \ |
| 56 | system/core/libziparchive/include/ \ |
| 57 | $(LOCAL_PATH)/../recovery_ui/include \ |
| 58 | $(LOCAL_PATH)/../fuse_sideload/include |
| 59 | LOCAL_CFLAGS += -D_USE_SYSTEM_ZIPARCHIVE |
| 60 | else |
| 61 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/../install28/ \ |
| 62 | $(LOCAL_PATH)/../fuse_sideload28/ |
| 63 | LOCAL_CFLAGS += -DUSE_28_INSTALL -DUSE_OTAUTIL_ZIPARCHIVE |
| 64 | endif |
| 65 | else |
| 66 | LOCAL_SHARED_LIBRARIES += libminzip |
| 67 | LOCAL_CFLAGS += -DUSE_MINZIP |
| 68 | endif |
| 69 | ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) |
| 70 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -le 28; echo $$?),0) |
| 71 | LOCAL_C_INCLUDES += system/extras/ext4_utils \ |
| 72 | system/extras/ext4_utils/include \ |
| 73 | $(LOCAL_PATH)/../crypto/ext4crypt |
| 74 | LOCAL_SHARED_LIBRARIES += libext4_utils |
| 75 | endif |
| 76 | endif |
| 77 | |
| 78 | LOCAL_MODULE := libguitwrp |
| 79 | |
| 80 | #TWRP_EVENT_LOGGING := true |
| 81 | ifeq ($(TWRP_EVENT_LOGGING), true) |
| 82 | LOCAL_CFLAGS += -D_EVENT_LOGGING |
| 83 | endif |
| 84 | ifneq ($(TW_USE_KEY_CODE_TOUCH_SYNC),) |
| 85 | LOCAL_CFLAGS += -DTW_USE_KEY_CODE_TOUCH_SYNC=$(TW_USE_KEY_CODE_TOUCH_SYNC) |
| 86 | endif |
| 87 | ifneq ($(TW_OZIP_DECRYPT_KEY),) |
| 88 | LOCAL_CFLAGS += -DTW_OZIP_DECRYPT_KEY=\"$(TW_OZIP_DECRYPT_KEY)\" |
| 89 | else |
| 90 | LOCAL_CFLAGS += -DTW_OZIP_DECRYPT_KEY=0 |
| 91 | endif |
| 92 | ifneq ($(TW_NO_SCREEN_BLANK),) |
| 93 | LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK |
| 94 | endif |
| 95 | ifneq ($(TW_NO_SCREEN_TIMEOUT),) |
| 96 | LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT |
| 97 | endif |
| 98 | ifeq ($(TW_OEM_BUILD), true) |
| 99 | LOCAL_CFLAGS += -DTW_OEM_BUILD |
| 100 | endif |
| 101 | ifneq ($(TW_X_OFFSET),) |
| 102 | LOCAL_CFLAGS += -DTW_X_OFFSET=$(TW_X_OFFSET) |
| 103 | endif |
| 104 | ifneq ($(TW_Y_OFFSET),) |
| 105 | LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET) |
| 106 | endif |
| 107 | ifneq ($(TW_W_OFFSET),) |
| 108 | LOCAL_CFLAGS += -DTW_W_OFFSET=$(TW_W_OFFSET) |
| 109 | endif |
| 110 | ifneq ($(TW_H_OFFSET),) |
| 111 | LOCAL_CFLAGS += -DTW_H_OFFSET=$(TW_H_OFFSET) |
| 112 | endif |
| 113 | ifeq ($(TW_ROUND_SCREEN), true) |
| 114 | LOCAL_CFLAGS += -DTW_ROUND_SCREEN |
| 115 | endif |
| 116 | ifeq ($(TW_EXCLUDE_NANO), true) |
| 117 | LOCAL_CFLAGS += -DTW_EXCLUDE_NANO |
| 118 | endif |
| 119 | ifeq ($(AB_OTA_UPDATER),true) |
| 120 | LOCAL_CFLAGS += -DAB_OTA_UPDATER=1 |
| 121 | endif |
| 122 | ifeq ($(TW_SCREEN_BLANK_ON_BOOT), true) |
| 123 | LOCAL_CFLAGS += -DTW_SCREEN_BLANK_ON_BOOT |
| 124 | endif |
| 125 | |
| 126 | LOCAL_C_INCLUDES += \ |
| 127 | bionic \ |
| 128 | system/core/base/include \ |
| 129 | system/core/include \ |
| 130 | system/core/libpixelflinger/include \ |
| 131 | external/freetype/include |
| 132 | |
| 133 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) |
| 134 | LOCAL_C_INCLUDES += external/stlport/stlport |
| 135 | LOCAL_CFLAGS += -DUSE_FUSE_SIDELOAD22 |
| 136 | endif |
| 137 | |
| 138 | LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\" |
| 139 | |
| 140 | include $(BUILD_STATIC_LIBRARY) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 141 | |
| 142 | # Transfer in the resources for the device |
| 143 | include $(CLEAR_VARS) |
| 144 | LOCAL_MODULE := twrp |
bigbiff | d58ba18 | 2020-03-23 10:02:29 -0400 | [diff] [blame] | 145 | LOCAL_MODULE_TAGS := optional |
bigbiff | 673c7ae | 2020-12-02 19:44:56 -0500 | [diff] [blame] | 146 | LOCAL_MODULE_CLASS := DATA |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 147 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 148 | |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 149 | # The extra blank line before *** is intentional to ensure it ends up on its own line |
| 150 | define TW_THEME_WARNING_MSG |
| 151 | |
| 152 | **************************************************************************** |
| 153 | Could not find ui.xml for TW_THEME: $(TW_THEME) |
| 154 | Set TARGET_SCREEN_WIDTH and TARGET_SCREEN_HEIGHT to automatically select |
| 155 | an appropriate theme, or set TW_THEME to one of the following: |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 156 | $(notdir $(wildcard $(LOCAL_PATH)/theme/*_*)) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 157 | **************************************************************************** |
| 158 | endef |
| 159 | define TW_CUSTOM_THEME_WARNING_MSG |
| 160 | |
| 161 | **************************************************************************** |
| 162 | Could not find ui.xml for TW_CUSTOM_THEME: $(TW_CUSTOM_THEME) |
Matt Mower | 0c00571 | 2017-02-12 13:10:08 -0600 | [diff] [blame] | 163 | Expected to find custom theme's ui.xml at: |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 164 | $(TWRP_THEME_LOC)/ui.xml |
| 165 | Please fix this or set TW_THEME to one of the following: |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 166 | $(notdir $(wildcard $(LOCAL_PATH)/theme/*_*)) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 167 | **************************************************************************** |
| 168 | endef |
| 169 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 170 | TWRP_RES := $(LOCAL_PATH)/theme/common/fonts |
| 171 | TWRP_RES += $(LOCAL_PATH)/theme/common/languages |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 172 | ifeq ($(TW_EXTRA_LANGUAGES),true) |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 173 | TWRP_RES += $(LOCAL_PATH)/theme/extra-languages/fonts |
| 174 | TWRP_RES += $(LOCAL_PATH)/theme/extra-languages/languages |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 175 | endif |
| 176 | |
Ethan Yonker | 1ecaca7 | 2014-04-14 09:27:15 -0500 | [diff] [blame] | 177 | ifeq ($(TW_CUSTOM_THEME),) |
Ethan Yonker | 591b920 | 2015-03-11 11:17:15 -0500 | [diff] [blame] | 178 | ifeq ($(TW_THEME),) |
niks255 | d73903c | 2017-01-15 17:39:48 +0600 | [diff] [blame] | 179 | ifeq ($(DEVICE_RESOLUTION),) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 180 | GUI_WIDTH := $(TARGET_SCREEN_WIDTH) |
| 181 | GUI_HEIGHT := $(TARGET_SCREEN_HEIGHT) |
| 182 | else |
| 183 | SPLIT_DEVICE_RESOLUTION := $(subst x, ,$(DEVICE_RESOLUTION)) |
| 184 | GUI_WIDTH := $(word 1, $(SPLIT_DEVICE_RESOLUTION)) |
| 185 | GUI_HEIGHT := $(word 2, $(SPLIT_DEVICE_RESOLUTION)) |
niks255 | d73903c | 2017-01-15 17:39:48 +0600 | [diff] [blame] | 186 | endif |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 187 | |
| 188 | # Minimum resolution of 100x100 |
| 189 | # This also ensures GUI_WIDTH and GUI_HEIGHT are numbers |
| 190 | ifeq ($(shell test $(GUI_WIDTH) -ge 100; echo $$?),0) |
| 191 | ifeq ($(shell test $(GUI_HEIGHT) -ge 100; echo $$?),0) |
| 192 | ifeq ($(shell test $(GUI_WIDTH) -gt $(GUI_HEIGHT); echo $$?),0) |
| 193 | ifeq ($(shell test $(GUI_WIDTH) -ge 1280; echo $$?),0) |
| 194 | TW_THEME := landscape_hdpi |
| 195 | else |
| 196 | TW_THEME := landscape_mdpi |
| 197 | endif |
| 198 | else ifeq ($(shell test $(GUI_WIDTH) -lt $(GUI_HEIGHT); echo $$?),0) |
| 199 | ifeq ($(shell test $(GUI_WIDTH) -ge 720; echo $$?),0) |
| 200 | TW_THEME := portrait_hdpi |
| 201 | else |
| 202 | TW_THEME := portrait_mdpi |
| 203 | endif |
| 204 | else ifeq ($(shell test $(GUI_WIDTH) -eq $(GUI_HEIGHT); echo $$?),0) |
| 205 | # watch_hdpi does not yet exist |
| 206 | TW_THEME := watch_mdpi |
| 207 | endif |
| 208 | endif |
Ethan Yonker | 591b920 | 2015-03-11 11:17:15 -0500 | [diff] [blame] | 209 | endif |
| 210 | endif |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 211 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 212 | TWRP_THEME_LOC := $(LOCAL_PATH)/theme/$(TW_THEME) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 213 | ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),) |
| 214 | $(warning $(TW_THEME_WARNING_MSG)) |
| 215 | $(error Theme selection failed; exiting) |
| 216 | endif |
| 217 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 218 | TWRP_RES += $(LOCAL_PATH)/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 219 | # for future copying of used include xmls and fonts: |
| 220 | # UI_XML := $(TWRP_THEME_LOC)/ui.xml |
| 221 | # TWRP_INCLUDE_XMLS := $(shell xmllint --xpath '/recovery/include/xmlfile/@name' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq) |
| 222 | # TWRP_FONTS_TTF := $(shell xmllint --xpath '/recovery/resources/font/@filename' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)niq) |
| 223 | else |
| 224 | TWRP_THEME_LOC := $(TW_CUSTOM_THEME) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 225 | ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),) |
| 226 | $(warning $(TW_CUSTOM_THEME_WARNING_MSG)) |
| 227 | $(error Theme selection failed; exiting) |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 228 | endif |
that | d16b2ce | 2015-07-27 20:39:19 +0200 | [diff] [blame] | 229 | endif |
Vojtech Bocek | 76ee903 | 2014-09-07 15:01:56 +0200 | [diff] [blame] | 230 | |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 231 | TWRP_RES += $(TW_ADDITIONAL_RES) |
| 232 | |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 233 | TWRP_RES_GEN := $(intermediates)/twrp |
Ethan Yonker | 5c93369 | 2014-04-04 11:26:32 -0500 | [diff] [blame] | 234 | $(TWRP_RES_GEN): |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 235 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
that | d16b2ce | 2015-07-27 20:39:19 +0200 | [diff] [blame] | 236 | cp -fr $(TWRP_RES) $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 237 | cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 238 | |
| 239 | LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN) |
bigbiff | 673c7ae | 2020-12-02 19:44:56 -0500 | [diff] [blame] | 240 | #LOCAL_SRC_FILES := twrp |
| 241 | LOCAL_SRC_FILES := $(TWRP_RES_GEN) |
| 242 | $(warning LOCAL_SRC_FILES: $(LOCAL_SRC_FILES)) |
Dees_Troy | 7d15c25 | 2012-09-05 20:47:21 -0400 | [diff] [blame] | 243 | include $(BUILD_PREBUILT) |