blob: df0a0398f03fb23377ae2ab30b709d4dbf49c04c [file] [log] [blame]
Dees_Troy51a0e822012-09-05 15:24:24 -04001LOCAL_PATH := $(call my-dir)
Dees_Troy2673cec2013-04-02 20:22:16 +00002
Dees_Troy51a0e822012-09-05 15:24:24 -04003include $(CLEAR_VARS)
4
Ethan Yonkerfbb43532015-12-28 21:54:50 +01005LOCAL_SRC_FILES := \
6 graphics.cpp \
7 graphics_fbdev.cpp \
8 resources.cpp \
Ethan Yonkerfbb43532015-12-28 21:54:50 +01009 truetype.cpp \
10 graphics_utils.cpp \
11 events.cpp
Dees_Troy86382ca2013-01-15 16:54:59 +000012
Mohd Farazbc576cd2020-05-30 21:06:32 +053013ifeq ($(TW_SUPPORT_INPUT_1_2_HAPTICS),true)
14 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
15 LOCAL_SHARED_LIBRARIES += android.hardware.vibrator@1.2 libhidlbase
16 LOCAL_CFLAGS += -DUSE_QTI_HAPTICS
17 endif
18endif
19
Dees_Troy86382ca2013-01-15 16:54:59 +000020ifneq ($(TW_BOARD_CUSTOM_GRAPHICS),)
Ethan Yonkerfbb43532015-12-28 21:54:50 +010021 $(warning ****************************************************************************)
22 $(warning * TW_BOARD_CUSTOM_GRAPHICS support has been deprecated in TWRP. *)
23 $(warning ****************************************************************************)
24 $(error stopping)
Dees_Troy86382ca2013-01-15 16:54:59 +000025endif
Dees_Troy51a0e822012-09-05 15:24:24 -040026
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060027ifeq ($(TW_TARGET_USES_QCOM_BSP), true)
28 LOCAL_CFLAGS += -DMSM_BSP
Ethan Yonkerb386f712017-01-20 14:30:28 -060029 LOCAL_SRC_FILES += graphics_overlay.cpp
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060030 ifeq ($(TARGET_PREBUILT_KERNEL),)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -050031 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
32 LOCAL_REQUIRED_MODULES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
33 else
34 LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
35 endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060036 LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
37 else
Kra1o50024e382014-12-17 01:49:00 +010038 ifeq ($(TARGET_CUSTOM_KERNEL_HEADERS),)
Greg Wallace62c188c2016-01-27 18:12:05 -050039 LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minuitwrp/include
Kra1o50024e382014-12-17 01:49:00 +010040 else
41 LOCAL_C_INCLUDES += $(TARGET_CUSTOM_KERNEL_HEADERS)
42 endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060043 endif
44else
Greg Wallace62c188c2016-01-27 18:12:05 -050045 LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minuitwrp/include
Ethan Yonkerfbb43532015-12-28 21:54:50 +010046 # The header files required for adf graphics can cause compile errors
47 # with adf graphics.
Ethan Yonker2f685272018-10-19 08:06:03 -050048 ifneq ($(wildcard system/core/adf/Android.*),)
Ethan Yonkerfbb43532015-12-28 21:54:50 +010049 LOCAL_CFLAGS += -DHAS_ADF
50 LOCAL_SRC_FILES += graphics_adf.cpp
51 LOCAL_WHOLE_STATIC_LIBRARIES += libadf
52 endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060053endif
54
Kra1o5de50c5f2015-04-23 21:46:36 +020055ifeq ($(TW_NEW_ION_HEAP), true)
56 LOCAL_CFLAGS += -DNEW_ION_HEAP
57endif
58
lambdadroidd842fe12018-09-26 22:30:16 +020059ifneq ($(wildcard external/libdrm/Android.*),)
Ethan Yonkerfbb43532015-12-28 21:54:50 +010060 LOCAL_CFLAGS += -DHAS_DRM
61 LOCAL_SRC_FILES += graphics_drm.cpp
Ethan Yonker3eb70ed2018-01-04 08:59:36 -060062 ifneq ($(wildcard external/libdrm/Android.common.mk),)
63 LOCAL_WHOLE_STATIC_LIBRARIES += libdrm_platform
64 else
65 LOCAL_WHOLE_STATIC_LIBRARIES += libdrm
66 endif
Ethan Yonkerfbb43532015-12-28 21:54:50 +010067endif
68
Dees_Troy2673cec2013-04-02 20:22:16 +000069LOCAL_C_INCLUDES += \
70 external/libpng \
71 external/zlib \
Dees_Troy930bf012013-08-10 22:19:03 +000072 system/core/include \
Ethan Yonkerfbb43532015-12-28 21:54:50 +010073 external/freetype/include \
bigbiff1f9e4842020-10-31 11:33:15 -040074 external/libcxx/include \
75 $(LOCAL_PATH)/../twrpinstall/include
Dees_Troy51a0e822012-09-05 15:24:24 -040076
Greg Wallaceace76232016-01-27 17:15:51 -050077ifneq ($(TW_INCLUDE_JPEG),)
78 LOCAL_C_INCLUDES += \
79 external/jpeg
80 LOCAL_CFLAGS += -DTW_INCLUDE_JPEG
81endif
Ethan Yonkere95c4862016-01-27 10:57:26 -060082
Dees_Troy51a0e822012-09-05 15:24:24 -040083ifeq ($(RECOVERY_TOUCHSCREEN_SWAP_XY), true)
84LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_SWAP_XY
85endif
86
87ifeq ($(RECOVERY_TOUCHSCREEN_FLIP_X), true)
88LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_FLIP_X
89endif
90
91ifeq ($(RECOVERY_TOUCHSCREEN_FLIP_Y), true)
92LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_FLIP_Y
93endif
94
Ethan Yonker31f855b2016-01-28 22:31:48 -060095ifeq ($(RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH), true)
96LOCAL_CFLAGS += -DRECOVERY_GRAPHICS_FORCE_USE_LINELENGTH
Dees_Troy51a0e822012-09-05 15:24:24 -040097endif
98
Ethan Yonker4a71d4f2016-07-29 17:42:36 -050099ifeq ($(RECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER), true)
100LOCAL_CFLAGS += -DRECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER
Kra1o5c9556cc2015-06-24 12:19:09 +0200101endif
102
Dees_Troy51a0e822012-09-05 15:24:24 -0400103#Remove the # from the line below to enable event logging
104#TWRP_EVENT_LOGGING := true
105ifeq ($(TWRP_EVENT_LOGGING), true)
106LOCAL_CFLAGS += -D_EVENT_LOGGING
107endif
108
bigbiff673c7ae2020-12-02 19:44:56 -0500109
Ethan Yonker31f855b2016-01-28 22:31:48 -0600110ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGBA_8888)
111 $(warning ****************************************************************************)
112 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGBA_8888 not implemented yet *)
113 $(warning ****************************************************************************)
114 $(error stopping)
Kra1o577568592015-10-14 18:09:54 +0200115 LOCAL_CFLAGS += -DRECOVERY_RGBA
116endif
Ethan Yonker31f855b2016-01-28 22:31:48 -0600117ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGBX_8888)
118 $(warning ****************************************************************************)
119 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGBX_8888 not implemented yet *)
120 $(warning ****************************************************************************)
121 $(error stopping)
122 LOCAL_CFLAGS += -DRECOVERY_RGBX
123endif
124ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),BGRA_8888)
125 $(warning ****************************************************************************)
126 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := BGRA_8888 not implemented yet *)
127 $(warning ****************************************************************************)
128 $(error stopping)
129 LOCAL_CFLAGS += -DRECOVERY_BGRA
130endif
131ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGB_565)
132 LOCAL_CFLAGS += -DRECOVERY_FORCE_RGB_565
133endif
134
135# This used to compare against values in double-quotes (which are just
136# ordinary characters in this context). Strip double-quotes from the
137# value so that either will work.
138
139ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),ABGR_8888)
140 LOCAL_CFLAGS += -DRECOVERY_ABGR
141endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -0600142ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
143 LOCAL_CFLAGS += -DRECOVERY_RGBX
144endif
145ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),BGRA_8888)
146 LOCAL_CFLAGS += -DRECOVERY_BGRA
147endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -0600148
Ethan Yonkerfbb43532015-12-28 21:54:50 +0100149ifneq ($(TARGET_RECOVERY_OVERSCAN_PERCENT),)
150 LOCAL_CFLAGS += -DOVERSCAN_PERCENT=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
151else
152 LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
153endif
xNUTxcd56f8c2014-07-23 01:30:20 +0200154ifeq ($(TW_SCREEN_BLANK_ON_BOOT), true)
155 LOCAL_CFLAGS += -DTW_SCREEN_BLANK_ON_BOOT
156endif
Muhammad Fahad Baig0ac22932016-04-07 09:19:33 +0100157ifeq ($(TW_FBIOPAN), true)
158 LOCAL_CFLAGS += -DTW_FBIOPAN
159endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400160
Vladimir Olteand32b7eb2018-07-03 00:04:03 +0300161ifneq ($(TW_ROTATION),)
162 ifeq (,$(filter 0 90 180 270, $(TW_ROTATION)))
163 $(error TW_ROTATION must be set to 0, 90, 180 or 270. Currently set to $(TW_ROTATION))
164 endif
165 LOCAL_CFLAGS += -DTW_ROTATION=$(TW_ROTATION)
166else
167 # Support for old flag
168 ifeq ($(BOARD_HAS_FLIPPED_SCREEN), true)
169 LOCAL_CFLAGS += -DTW_ROTATION=180
170 else
171 LOCAL_CFLAGS += -DTW_ROTATION=0
172 endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400173endif
174
Ibrahim Awwal2e9cb012014-01-04 12:38:26 -0800175ifeq ($(TW_IGNORE_MAJOR_AXIS_0), true)
176LOCAL_CFLAGS += -DTW_IGNORE_MAJOR_AXIS_0
177endif
178
Ethan Yonker32f68a32014-12-29 08:13:23 -0600179ifeq ($(TW_IGNORE_MT_POSITION_0), true)
180LOCAL_CFLAGS += -DTW_IGNORE_MT_POSITION_0
181endif
182
Ethan Yonkerd6821a12015-08-26 15:29:23 -0500183ifeq ($(TW_IGNORE_ABS_MT_TRACKING_ID), true)
184LOCAL_CFLAGS += -DTW_IGNORE_ABS_MT_TRACKING_ID
185endif
186
Ethan Yonker5742a402014-08-12 14:52:49 -0500187ifneq ($(TW_INPUT_BLACKLIST),)
188 LOCAL_CFLAGS += -DTW_INPUT_BLACKLIST=$(TW_INPUT_BLACKLIST)
189endif
190
Flemmardf4674612014-01-10 09:14:44 +0100191ifneq ($(TW_WHITELIST_INPUT),)
192 LOCAL_CFLAGS += -DWHITELIST_INPUT=$(TW_WHITELIST_INPUT)
193endif
194
LameMonster824ef96a62020-06-04 13:31:12 +0200195ifeq ($(TW_HAPTICS_TSPDRV), true)
196 LOCAL_SRC_FILES += tspdrv.cpp
197 LOCAL_CFLAGS += -DTW_HAPTICS_TSPDRV
198endif
199
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200200ifeq ($(TW_DISABLE_TTF), true)
Ethan Yonker88037f42015-10-04 22:09:08 -0500201 $(warning ****************************************************************************)
202 $(warning * TW_DISABLE_TTF support has been deprecated in TWRP. *)
203 $(warning ****************************************************************************)
204 $(error stopping)
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200205endif
206
Ethan Yonkerfbb43532015-12-28 21:54:50 +0100207LOCAL_CLANG := true
208
Dees Troy3454ade2015-01-20 19:21:04 +0000209LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
Dees Troy9a4d7402019-03-21 14:17:28 -0400210LOCAL_SHARED_LIBRARIES += libft2 libz libc libcutils libpng libutils libc++
Greg Wallaceace76232016-01-27 17:15:51 -0500211ifneq ($(TW_INCLUDE_JPEG),)
212 LOCAL_SHARED_LIBRARIES += libjpeg
213endif
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500214LOCAL_STATIC_LIBRARIES += libpixelflinger_twrp
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500215ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
216LOCAL_SHARED_LIBRARIES += libcutils liblog libutils
217endif
bigbiffd58ba182020-03-23 10:02:29 -0400218LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400219LOCAL_MODULE := libminuitwrp
220
Dees_Troy930bf012013-08-10 22:19:03 +0000221include $(BUILD_SHARED_LIBRARY)