blob: 66883a4fa86c16c0a69f9cc6cdd944974b8ae713 [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 \
31 textbox.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040032
33ifneq ($(TWRP_CUSTOM_KEYBOARD),)
Ethan Yonker591b9202015-03-11 11:17:15 -050034 LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD)
Dees_Troy51a0e822012-09-05 15:24:24 -040035else
Ethan Yonker591b9202015-03-11 11:17:15 -050036 LOCAL_SRC_FILES += hardwarekeyboard.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040037endif
38
Ethan Yonker4b94cfd2014-12-11 10:00:45 -060039LOCAL_SHARED_LIBRARIES += libminuitwrp libc libstdc++ libminzip libaosprecovery
Dees_Troy2673cec2013-04-02 20:22:16 +000040LOCAL_MODULE := libguitwrp
Dees_Troy51a0e822012-09-05 15:24:24 -040041
Dees_Troy51a0e822012-09-05 15:24:24 -040042#TWRP_EVENT_LOGGING := true
43ifeq ($(TWRP_EVENT_LOGGING), true)
Ethan Yonker30fa3352015-03-09 13:57:21 -050044 LOCAL_CFLAGS += -D_EVENT_LOGGING
45endif
46ifneq ($(TW_USE_KEY_CODE_TOUCH_SYNC),)
47 LOCAL_CFLAGS += -DTW_USE_KEY_CODE_TOUCH_SYNC=$(TW_USE_KEY_CODE_TOUCH_SYNC)
Dees_Troy51a0e822012-09-05 15:24:24 -040048endif
49
bigbiff bigbiff87940362013-03-09 09:58:50 -050050ifneq ($(TW_NO_SCREEN_BLANK),)
Ethan Yonker591b9202015-03-11 11:17:15 -050051 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
bigbiff bigbiff87940362013-03-09 09:58:50 -050052endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070053ifneq ($(TW_NO_SCREEN_TIMEOUT),)
Ethan Yonker591b9202015-03-11 11:17:15 -050054 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070055endif
Dees Troyb7ae0982013-09-10 20:47:35 +000056ifeq ($(HAVE_SELINUX), true)
Ethan Yonker30fa3352015-03-09 13:57:21 -050057 LOCAL_CFLAGS += -DHAVE_SELINUX
Dees Troyb7ae0982013-09-10 20:47:35 +000058endif
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040059ifeq ($(TW_OEM_BUILD), true)
Ethan Yonker83e82572014-04-04 10:59:28 -050060 LOCAL_CFLAGS += -DTW_OEM_BUILD
61endif
Ethan Yonker751a85e2014-12-12 16:59:10 -060062ifneq ($(TW_X_OFFSET),)
Ethan Yonker591b9202015-03-11 11:17:15 -050063 LOCAL_CFLAGS += -DTW_X_OFFSET=$(TW_X_OFFSET)
Ethan Yonker751a85e2014-12-12 16:59:10 -060064endif
65ifneq ($(TW_Y_OFFSET),)
Ethan Yonker591b9202015-03-11 11:17:15 -050066 LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET)
Ethan Yonker751a85e2014-12-12 16:59:10 -060067endif
Ethan Yonker63e414f2015-02-06 15:44:39 -060068ifeq ($(TW_ROUND_SCREEN), true)
Ethan Yonker591b9202015-03-11 11:17:15 -050069 LOCAL_CFLAGS += -DTW_ROUND_SCREEN
bigbiff bigbiff163d4742013-11-16 13:25:27 -050070endif
71
Ethan Yonkerc798c9c2015-10-09 11:15:26 -050072LOCAL_C_INCLUDES += bionic external/stlport/stlport system/core/libpixelflinger/include
Dees Troy3454ade2015-01-20 19:21:04 +000073LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
Dees_Troy51a0e822012-09-05 15:24:24 -040074
75include $(BUILD_STATIC_LIBRARY)
76
77# Transfer in the resources for the device
78include $(CLEAR_VARS)
79LOCAL_MODULE := twrp
80LOCAL_MODULE_TAGS := eng
81LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +000082LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
thatd16b2ce2015-07-27 20:39:19 +020083TWRP_RES := $(commands_recovery_local_path)/gui/devices/common/res/*
84# enable this to use new themes:
z31s1g28f0a922015-11-07 18:50:22 +010085TWRP_NEW_THEME := true
Dees_Troy51a0e822012-09-05 15:24:24 -040086
Ethan Yonker1ecaca72014-04-14 09:27:15 -050087ifeq ($(TW_CUSTOM_THEME),)
Ethan Yonker591b9202015-03-11 11:17:15 -050088 ifeq ($(TW_THEME),)
89 # This converts the old DEVICE_RESOLUTION flag to the new TW_THEME flag
90 PORTRAIT_MDPI := 320x480 480x800 480x854 540x960
91 PORTRAIT_HDPI := 720x1280 800x1280 1080x1920 1200x1920 1440x2560 1600x2560
92 WATCH_MDPI := 240x240 280x280 320x320
93 LANDSCAPE_MDPI := 800x480 1024x600 1024x768
94 LANDSCAPE_HDPI := 1280x800 1920x1200 2560x1600
95 ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT_MDPI)),)
96 TW_THEME := portrait_mdpi
97 else ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT_HDPI)),)
98 TW_THEME := portrait_hdpi
99 else ifneq ($(filter $(DEVICE_RESOLUTION), $(WATCH_MDPI)),)
100 TW_THEME := watch_mdpi
101 else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE_MDPI)),)
102 TW_THEME := landscape_mdpi
103 else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE_HDPI)),)
104 TW_THEME := landscape_hdpi
105 endif
106 endif
thatd16b2ce2015-07-27 20:39:19 +0200107ifeq ($(TWRP_NEW_THEME),true)
108 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/theme/$(TW_THEME)
109 TWRP_RES := $(commands_recovery_local_path)/gui/theme/common/fonts
110 TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml
111# for future copying of used include xmls and fonts:
112# UI_XML := $(TWRP_THEME_LOC)/ui.xml
113# 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 -0500114# 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 +0200115ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),)
116 $(warning ****************************************************************************)
117 $(warning * TW_THEME is not valid: '$(TW_THEME)')
118 $(warning * Please choose an appropriate TW_THEME or create a new one for your device.)
119 $(warning * Available themes:)
120 $(warning * $(notdir $(wildcard $(commands_recovery_local_path)/gui/theme/*_*)))
121 $(warning ****************************************************************************)
122 $(error stopping)
123endif
124else
125 TWRP_RES += $(commands_recovery_local_path)/gui/devices/$(word 1,$(subst _, ,$(TW_THEME)))/res/*
Ethan Yonker591b9202015-03-11 11:17:15 -0500126 ifeq ($(TW_THEME), portrait_mdpi)
127 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/480x800/res
Ethan Yonker591b9202015-03-11 11:17:15 -0500128 else ifeq ($(TW_THEME), portrait_hdpi)
129 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/1080x1920/res
Ethan Yonker591b9202015-03-11 11:17:15 -0500130 else ifeq ($(TW_THEME), watch_mdpi)
131 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/320x320/res
Ethan Yonker591b9202015-03-11 11:17:15 -0500132 else ifeq ($(TW_THEME), landscape_mdpi)
133 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/800x480/res
Ethan Yonker591b9202015-03-11 11:17:15 -0500134 else ifeq ($(TW_THEME), landscape_hdpi)
135 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/1920x1200/res
Ethan Yonker591b9202015-03-11 11:17:15 -0500136 else
137 $(warning ****************************************************************************)
138 $(warning * TW_THEME ($(TW_THEME)) is not valid.)
139 $(warning * Please choose an appropriate TW_THEME or create a new one for your device.)
140 $(warning * Valid options are portrait_mdpi portrait_hdpi watch_mdpi)
141 $(warning * landscape_mdpi landscape_hdpi)
142 $(warning ****************************************************************************)
143 $(error stopping)
144 endif
thatd16b2ce2015-07-27 20:39:19 +0200145endif
Ethan Yonker1ecaca72014-04-14 09:27:15 -0500146else
Ethan Yonker591b9202015-03-11 11:17:15 -0500147 TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
Ethan Yonker1ecaca72014-04-14 09:27:15 -0500148endif
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200149
Dees_Troy51a0e822012-09-05 15:24:24 -0400150TWRP_RES_GEN := $(intermediates)/twrp
Ethan Yonker5c933692014-04-04 11:26:32 -0500151ifneq ($(TW_USE_TOOLBOX), true)
Ethan Yonker591b9202015-03-11 11:17:15 -0500152 TWRP_SH_TARGET := /sbin/busybox
Ethan Yonker5c933692014-04-04 11:26:32 -0500153else
Ethan Yonker591b9202015-03-11 11:17:15 -0500154 TWRP_SH_TARGET := /sbin/mksh
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500155endif
156
Ethan Yonker5c933692014-04-04 11:26:32 -0500157$(TWRP_RES_GEN):
Dees Troy3454ade2015-01-20 19:21:04 +0000158 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
thatd16b2ce2015-07-27 20:39:19 +0200159 cp -fr $(TWRP_RES) $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees Troy3454ade2015-01-20 19:21:04 +0000160 cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Ethan Yonker5c933692014-04-04 11:26:32 -0500161 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin/
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600162ifneq ($(TW_USE_TOOLBOX), true)
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500163 ln -sf $(TWRP_SH_TARGET) $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh
Ethan Yonkerbcc502c2014-11-10 11:22:10 -0600164endif
Ethan Yonker5c933692014-04-04 11:26:32 -0500165 ln -sf /sbin/pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip
166 ln -sf /sbin/unpigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gunzip
Ethan Yonker0c9d0492014-04-14 09:10:05 -0500167
Dees_Troy51a0e822012-09-05 15:24:24 -0400168
169LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN)
170LOCAL_SRC_FILES := twrp $(TWRP_RES_GEN)
Dees_Troy7d15c252012-09-05 20:47:21 -0400171include $(BUILD_PREBUILT)