blob: e5e58658bae8de1032a06c80b317abe636c2ba46 [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 \
30 patternpassword.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040031
32ifneq ($(TWRP_CUSTOM_KEYBOARD),)
Ethan Yonker591b9202015-03-11 11:17:15 -050033 LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD)
Dees_Troy51a0e822012-09-05 15:24:24 -040034else
Ethan Yonker591b9202015-03-11 11:17:15 -050035 LOCAL_SRC_FILES += hardwarekeyboard.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040036endif
37
Ethan Yonker4b94cfd2014-12-11 10:00:45 -060038LOCAL_SHARED_LIBRARIES += libminuitwrp libc libstdc++ libminzip libaosprecovery
Dees_Troy2673cec2013-04-02 20:22:16 +000039LOCAL_MODULE := libguitwrp
Dees_Troy51a0e822012-09-05 15:24:24 -040040
Dees_Troy51a0e822012-09-05 15:24:24 -040041#TWRP_EVENT_LOGGING := true
42ifeq ($(TWRP_EVENT_LOGGING), true)
Ethan Yonker30fa3352015-03-09 13:57:21 -050043 LOCAL_CFLAGS += -D_EVENT_LOGGING
44endif
45ifneq ($(TW_USE_KEY_CODE_TOUCH_SYNC),)
46 LOCAL_CFLAGS += -DTW_USE_KEY_CODE_TOUCH_SYNC=$(TW_USE_KEY_CODE_TOUCH_SYNC)
Dees_Troy51a0e822012-09-05 15:24:24 -040047endif
48
bigbiff bigbiff87940362013-03-09 09:58:50 -050049ifneq ($(TW_NO_SCREEN_BLANK),)
Ethan Yonker591b9202015-03-11 11:17:15 -050050 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
bigbiff bigbiff87940362013-03-09 09:58:50 -050051endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070052ifneq ($(TW_NO_SCREEN_TIMEOUT),)
Ethan Yonker591b9202015-03-11 11:17:15 -050053 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070054endif
Dees Troyb7ae0982013-09-10 20:47:35 +000055ifeq ($(HAVE_SELINUX), true)
Ethan Yonker30fa3352015-03-09 13:57:21 -050056 LOCAL_CFLAGS += -DHAVE_SELINUX
Dees Troyb7ae0982013-09-10 20:47:35 +000057endif
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040058ifeq ($(TW_OEM_BUILD), true)
Ethan Yonker83e82572014-04-04 10:59:28 -050059 LOCAL_CFLAGS += -DTW_OEM_BUILD
60endif
Vojtech Bocek76ee9032014-09-07 15:01:56 +020061ifeq ($(TW_DISABLE_TTF), true)
62 LOCAL_CFLAGS += -DTW_DISABLE_TTF
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
Ethan Yonker63e414f2015-02-06 15:44:39 -060070ifeq ($(TW_ROUND_SCREEN), true)
Ethan Yonker591b9202015-03-11 11:17:15 -050071 LOCAL_CFLAGS += -DTW_ROUND_SCREEN
bigbiff bigbiff163d4742013-11-16 13:25:27 -050072endif
73
Dees_Troy51a0e822012-09-05 15:24:24 -040074LOCAL_C_INCLUDES += bionic external/stlport/stlport $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION)
Dees Troy3454ade2015-01-20 19:21:04 +000075LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
Dees_Troy51a0e822012-09-05 15:24:24 -040076
77include $(BUILD_STATIC_LIBRARY)
78
79# Transfer in the resources for the device
80include $(CLEAR_VARS)
81LOCAL_MODULE := twrp
82LOCAL_MODULE_TAGS := eng
83LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +000084LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Ethan Yonker1ecaca72014-04-14 09:27:15 -050085TWRP_RES_LOC := $(commands_recovery_local_path)/gui/devices/common/res
Ethan Yonker780cd392014-07-21 15:24:39 -050086TWRP_COMMON_XML := $(hide) echo "No common TWRP XML resources"
Dees_Troy51a0e822012-09-05 15:24:24 -040087
Ethan Yonker1ecaca72014-04-14 09:27:15 -050088ifeq ($(TW_CUSTOM_THEME),)
Ethan Yonker591b9202015-03-11 11:17:15 -050089 ifeq ($(TW_THEME),)
90 # This converts the old DEVICE_RESOLUTION flag to the new TW_THEME flag
91 PORTRAIT_MDPI := 320x480 480x800 480x854 540x960
92 PORTRAIT_HDPI := 720x1280 800x1280 1080x1920 1200x1920 1440x2560 1600x2560
93 WATCH_MDPI := 240x240 280x280 320x320
94 LANDSCAPE_MDPI := 800x480 1024x600 1024x768
95 LANDSCAPE_HDPI := 1280x800 1920x1200 2560x1600
96 ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT_MDPI)),)
97 TW_THEME := portrait_mdpi
98 else ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT_HDPI)),)
99 TW_THEME := portrait_hdpi
100 else ifneq ($(filter $(DEVICE_RESOLUTION), $(WATCH_MDPI)),)
101 TW_THEME := watch_mdpi
102 else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE_MDPI)),)
103 TW_THEME := landscape_mdpi
104 else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE_HDPI)),)
105 TW_THEME := landscape_hdpi
106 endif
107 endif
108 ifeq ($(TW_THEME), portrait_mdpi)
109 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/480x800/res
110 TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/portrait/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
111 else ifeq ($(TW_THEME), portrait_hdpi)
112 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/1080x1920/res
113 TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/portrait/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
114 else ifeq ($(TW_THEME), watch_mdpi)
115 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/320x320/res
116 TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/watch/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
117 else ifeq ($(TW_THEME), landscape_mdpi)
118 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/800x480/res
119 TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/landscape/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
120 else ifeq ($(TW_THEME), landscape_hdpi)
121 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/1920x1200/res
122 TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/landscape/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
123 else
124 $(warning ****************************************************************************)
125 $(warning * TW_THEME ($(TW_THEME)) is not valid.)
126 $(warning * Please choose an appropriate TW_THEME or create a new one for your device.)
127 $(warning * Valid options are portrait_mdpi portrait_hdpi watch_mdpi)
128 $(warning * landscape_mdpi landscape_hdpi)
129 $(warning ****************************************************************************)
130 $(error stopping)
131 endif
Ethan Yonker1ecaca72014-04-14 09:27:15 -0500132else
Ethan Yonker591b9202015-03-11 11:17:15 -0500133 TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
Ethan Yonker1ecaca72014-04-14 09:27:15 -0500134endif
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200135
136ifeq ($(TW_DISABLE_TTF), true)
Ethan Yonker591b9202015-03-11 11:17:15 -0500137 TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)fonts/*.ttf
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200138else
Ethan Yonker591b9202015-03-11 11:17:15 -0500139 TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)fonts/*.dat
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200140endif
141
Dees_Troy51a0e822012-09-05 15:24:24 -0400142TWRP_RES_GEN := $(intermediates)/twrp
Ethan Yonker5c933692014-04-04 11:26:32 -0500143ifneq ($(TW_USE_TOOLBOX), true)
Ethan Yonker591b9202015-03-11 11:17:15 -0500144 TWRP_SH_TARGET := /sbin/busybox
Ethan Yonker5c933692014-04-04 11:26:32 -0500145else
Ethan Yonker591b9202015-03-11 11:17:15 -0500146 TWRP_SH_TARGET := /sbin/mksh
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500147endif
148
Ethan Yonker5c933692014-04-04 11:26:32 -0500149$(TWRP_RES_GEN):
Dees Troy3454ade2015-01-20 19:21:04 +0000150 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
151 cp -fr $(TWRP_RES_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
152 cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Ethan Yonker780cd392014-07-21 15:24:39 -0500153 $(TWRP_COMMON_XML)
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200154 $(TWRP_REMOVE_FONT)
Ethan Yonker5c933692014-04-04 11:26:32 -0500155 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin/
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600156ifneq ($(TW_USE_TOOLBOX), true)
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500157 ln -sf $(TWRP_SH_TARGET) $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600158endif
Ethan Yonker5c933692014-04-04 11:26:32 -0500159 ln -sf /sbin/pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip
160 ln -sf /sbin/unpigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gunzip
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500161
Dees_Troy51a0e822012-09-05 15:24:24 -0400162
163LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN)
164LOCAL_SRC_FILES := twrp $(TWRP_RES_GEN)
Dees_Troy7d15c252012-09-05 20:47:21 -0400165include $(BUILD_PREBUILT)