blob: 51b296d1013bcceccbef4af78f50385801137e93 [file] [log] [blame]
Dees_Troy51a0e822012-09-05 15:24:24 -04001LOCAL_PATH := $(call my-dir)
2include $(CLEAR_VARS)
3
Motorhead1991c7f2e122014-06-12 15:57:36 -07004LOCAL_CFLAGS := -fno-strict-aliasing
5
Dees_Troy51a0e822012-09-05 15:24:24 -04006LOCAL_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 \
Vojtech Bocekede51c52014-02-07 23:58:09 +010020 object.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040021 slider.cpp \
Vojtech Bocek85932342013-04-01 22:11:33 +020022 slidervalue.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040023 listbox.cpp \
24 keyboard.cpp \
bigbiff bigbiff8a68c312013-02-10 14:28:30 -050025 input.cpp \
26 blanktimer.cpp \
Vojtech Bocek1fc30fc2014-01-29 18:37:19 +010027 partitionlist.cpp \
Ethan Yonker0a3a98f2015-02-05 00:48:28 +010028 mousecursor.cpp \
Vojtech Bocek7e11ac52015-03-05 23:21:49 +010029 scrolllist.cpp \
Ethan Yonker44925ad2015-07-22 12:33:59 -050030 patternpassword.cpp \
Ethan Yonker74db1572015-10-28 12:44:49 -050031 textbox.cpp \
that1964d192016-01-07 00:41:03 +010032 terminal.cpp \
Ethan Yonker74db1572015-10-28 12:44:49 -050033 twmsg.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040034
35ifneq ($(TWRP_CUSTOM_KEYBOARD),)
Ethan Yonker591b9202015-03-11 11:17:15 -050036 LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD)
Dees_Troy51a0e822012-09-05 15:24:24 -040037else
Ethan Yonker591b9202015-03-11 11:17:15 -050038 LOCAL_SRC_FILES += hardwarekeyboard.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040039endif
40
Ethan Yonker34ae4832016-08-24 15:32:18 -050041LOCAL_SHARED_LIBRARIES += libminuitwrp libc libstdc++ libminzip libaosprecovery libselinux
Dees_Troy2673cec2013-04-02 20:22:16 +000042LOCAL_MODULE := libguitwrp
Dees_Troy51a0e822012-09-05 15:24:24 -040043
Dees_Troy51a0e822012-09-05 15:24:24 -040044#TWRP_EVENT_LOGGING := true
45ifeq ($(TWRP_EVENT_LOGGING), true)
Ethan Yonker30fa3352015-03-09 13:57:21 -050046 LOCAL_CFLAGS += -D_EVENT_LOGGING
47endif
48ifneq ($(TW_USE_KEY_CODE_TOUCH_SYNC),)
49 LOCAL_CFLAGS += -DTW_USE_KEY_CODE_TOUCH_SYNC=$(TW_USE_KEY_CODE_TOUCH_SYNC)
Dees_Troy51a0e822012-09-05 15:24:24 -040050endif
51
bigbiff bigbiff87940362013-03-09 09:58:50 -050052ifneq ($(TW_NO_SCREEN_BLANK),)
Ethan Yonker591b9202015-03-11 11:17:15 -050053 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
bigbiff bigbiff87940362013-03-09 09:58:50 -050054endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070055ifneq ($(TW_NO_SCREEN_TIMEOUT),)
Ethan Yonker591b9202015-03-11 11:17:15 -050056 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070057endif
Dees Troyb7ae0982013-09-10 20:47:35 +000058ifeq ($(HAVE_SELINUX), true)
Ethan Yonker30fa3352015-03-09 13:57:21 -050059 LOCAL_CFLAGS += -DHAVE_SELINUX
Dees Troyb7ae0982013-09-10 20:47:35 +000060endif
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040061ifeq ($(TW_OEM_BUILD), true)
Ethan Yonker83e82572014-04-04 10:59:28 -050062 LOCAL_CFLAGS += -DTW_OEM_BUILD
63endif
Ethan Yonker751a85e2014-12-12 16:59:10 -060064ifneq ($(TW_X_OFFSET),)
Ethan Yonker591b9202015-03-11 11:17:15 -050065 LOCAL_CFLAGS += -DTW_X_OFFSET=$(TW_X_OFFSET)
Ethan Yonker751a85e2014-12-12 16:59:10 -060066endif
67ifneq ($(TW_Y_OFFSET),)
Ethan Yonker591b9202015-03-11 11:17:15 -050068 LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET)
Ethan Yonker751a85e2014-12-12 16:59:10 -060069endif
James Christopher Adduonodcd1e442016-11-06 13:17:34 -050070ifneq ($(TW_W_OFFSET),)
71 LOCAL_CFLAGS += -DTW_W_OFFSET=$(TW_W_OFFSET)
72endif
73ifneq ($(TW_H_OFFSET),)
74 LOCAL_CFLAGS += -DTW_H_OFFSET=$(TW_H_OFFSET)
75endif
Ethan Yonker63e414f2015-02-06 15:44:39 -060076ifeq ($(TW_ROUND_SCREEN), true)
Ethan Yonker591b9202015-03-11 11:17:15 -050077 LOCAL_CFLAGS += -DTW_ROUND_SCREEN
bigbiff bigbiff163d4742013-11-16 13:25:27 -050078endif
79
Xing0af1ac12015-11-27 11:19:37 -080080LOCAL_C_INCLUDES += bionic system/core/libpixelflinger/include
81ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
82 LOCAL_C_INCLUDES += external/stlport/stlport
83endif
84
Dees Troy3454ade2015-01-20 19:21:04 +000085LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
Dees_Troy51a0e822012-09-05 15:24:24 -040086
87include $(BUILD_STATIC_LIBRARY)
88
89# Transfer in the resources for the device
90include $(CLEAR_VARS)
91LOCAL_MODULE := twrp
92LOCAL_MODULE_TAGS := eng
93LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +000094LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -040095
Ethan Yonker1ecaca72014-04-14 09:27:15 -050096ifeq ($(TW_CUSTOM_THEME),)
Ethan Yonker591b9202015-03-11 11:17:15 -050097 ifeq ($(TW_THEME),)
niks255d73903c2017-01-15 17:39:48 +060098 ifeq ($(DEVICE_RESOLUTION),)
99 DEVICE_RESOLUTION := $(TARGET_SCREEN_WIDTH)x$(TARGET_SCREEN_HEIGHT)
100 endif
Ethan Yonker591b9202015-03-11 11:17:15 -0500101 # This converts the old DEVICE_RESOLUTION flag to the new TW_THEME flag
102 PORTRAIT_MDPI := 320x480 480x800 480x854 540x960
103 PORTRAIT_HDPI := 720x1280 800x1280 1080x1920 1200x1920 1440x2560 1600x2560
104 WATCH_MDPI := 240x240 280x280 320x320
105 LANDSCAPE_MDPI := 800x480 1024x600 1024x768
106 LANDSCAPE_HDPI := 1280x800 1920x1200 2560x1600
107 ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT_MDPI)),)
108 TW_THEME := portrait_mdpi
109 else ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT_HDPI)),)
110 TW_THEME := portrait_hdpi
111 else ifneq ($(filter $(DEVICE_RESOLUTION), $(WATCH_MDPI)),)
112 TW_THEME := watch_mdpi
113 else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE_MDPI)),)
114 TW_THEME := landscape_mdpi
115 else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE_HDPI)),)
116 TW_THEME := landscape_hdpi
117 endif
118 endif
bigbiffce8f83c2015-12-12 18:30:21 -0500119
that55f2bda2016-08-23 22:01:28 +0200120TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/theme/$(TW_THEME)
121TWRP_RES := $(commands_recovery_local_path)/gui/theme/common/fonts
122TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/languages
123TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml
Xueferb6e5fd92016-01-27 00:01:44 +0800124ifeq ($(TW_EXTRA_LANGUAGES),true)
125 TWRP_RES += $(commands_recovery_local_path)/gui/theme/extra-languages/fonts
126 TWRP_RES += $(commands_recovery_local_path)/gui/theme/extra-languages/languages
127endif
thatd16b2ce2015-07-27 20:39:19 +0200128# for future copying of used include xmls and fonts:
129# UI_XML := $(TWRP_THEME_LOC)/ui.xml
130# TWRP_INCLUDE_XMLS := $(shell xmllint --xpath '/recovery/include/xmlfile/@name' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)
Ethan Yonker88037f42015-10-04 22:09:08 -0500131# TWRP_FONTS_TTF := $(shell xmllint --xpath '/recovery/resources/font/@filename' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)niq)
thatd16b2ce2015-07-27 20:39:19 +0200132ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),)
133 $(warning ****************************************************************************)
134 $(warning * TW_THEME is not valid: '$(TW_THEME)')
135 $(warning * Please choose an appropriate TW_THEME or create a new one for your device.)
136 $(warning * Available themes:)
137 $(warning * $(notdir $(wildcard $(commands_recovery_local_path)/gui/theme/*_*)))
138 $(warning ****************************************************************************)
139 $(error stopping)
140endif
141else
Ethan Yonker591b9202015-03-11 11:17:15 -0500142 TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
Ethan Yonker1ecaca72014-04-14 09:27:15 -0500143endif
Xueferebc4cfa2016-01-24 13:13:36 +0800144TWRP_RES += $(TW_ADDITIONAL_RES)
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200145
Dees_Troy51a0e822012-09-05 15:24:24 -0400146TWRP_RES_GEN := $(intermediates)/twrp
Ethan Yonker5c933692014-04-04 11:26:32 -0500147ifneq ($(TW_USE_TOOLBOX), true)
Ethan Yonker591b9202015-03-11 11:17:15 -0500148 TWRP_SH_TARGET := /sbin/busybox
Ethan Yonker5c933692014-04-04 11:26:32 -0500149else
Ethan Yonker591b9202015-03-11 11:17:15 -0500150 TWRP_SH_TARGET := /sbin/mksh
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500151endif
152
Ethan Yonker5c933692014-04-04 11:26:32 -0500153$(TWRP_RES_GEN):
Dees Troy3454ade2015-01-20 19:21:04 +0000154 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
thatd16b2ce2015-07-27 20:39:19 +0200155 cp -fr $(TWRP_RES) $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees Troy3454ade2015-01-20 19:21:04 +0000156 cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Ethan Yonker5c933692014-04-04 11:26:32 -0500157 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin/
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600158ifneq ($(TW_USE_TOOLBOX), true)
Ethan Yonker0a8a7ce2016-11-07 22:00:06 -0600159ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500160 ln -sf $(TWRP_SH_TARGET) $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600161endif
Ethan Yonker0a8a7ce2016-11-07 22:00:06 -0600162endif
Ethan Yonker5c933692014-04-04 11:26:32 -0500163 ln -sf /sbin/pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip
164 ln -sf /sbin/unpigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gunzip
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500165
Dees_Troy51a0e822012-09-05 15:24:24 -0400166
167LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN)
168LOCAL_SRC_FILES := twrp $(TWRP_RES_GEN)
Dees_Troy7d15c252012-09-05 20:47:21 -0400169include $(BUILD_PREBUILT)