blob: d1c01e088735238d0a6de2456a882862cfac097f [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
Ethan Yonker31f855b2016-01-28 22:31:48 -0600109ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGBA_8888)
110 $(warning ****************************************************************************)
111 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGBA_8888 not implemented yet *)
112 $(warning ****************************************************************************)
113 $(error stopping)
Kra1o577568592015-10-14 18:09:54 +0200114 LOCAL_CFLAGS += -DRECOVERY_RGBA
115endif
Ethan Yonker31f855b2016-01-28 22:31:48 -0600116ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGBX_8888)
117 $(warning ****************************************************************************)
118 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGBX_8888 not implemented yet *)
119 $(warning ****************************************************************************)
120 $(error stopping)
121 LOCAL_CFLAGS += -DRECOVERY_RGBX
122endif
123ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),BGRA_8888)
124 $(warning ****************************************************************************)
125 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := BGRA_8888 not implemented yet *)
126 $(warning ****************************************************************************)
127 $(error stopping)
128 LOCAL_CFLAGS += -DRECOVERY_BGRA
129endif
130ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGB_565)
131 LOCAL_CFLAGS += -DRECOVERY_FORCE_RGB_565
132endif
133
134# This used to compare against values in double-quotes (which are just
135# ordinary characters in this context). Strip double-quotes from the
136# value so that either will work.
137
138ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),ABGR_8888)
139 LOCAL_CFLAGS += -DRECOVERY_ABGR
140endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -0600141ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
142 LOCAL_CFLAGS += -DRECOVERY_RGBX
143endif
144ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),BGRA_8888)
145 LOCAL_CFLAGS += -DRECOVERY_BGRA
146endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -0600147
Ethan Yonkerfbb43532015-12-28 21:54:50 +0100148ifneq ($(TARGET_RECOVERY_OVERSCAN_PERCENT),)
149 LOCAL_CFLAGS += -DOVERSCAN_PERCENT=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
150else
151 LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
152endif
xNUTxcd56f8c2014-07-23 01:30:20 +0200153ifeq ($(TW_SCREEN_BLANK_ON_BOOT), true)
154 LOCAL_CFLAGS += -DTW_SCREEN_BLANK_ON_BOOT
155endif
Muhammad Fahad Baig0ac22932016-04-07 09:19:33 +0100156ifeq ($(TW_FBIOPAN), true)
157 LOCAL_CFLAGS += -DTW_FBIOPAN
158endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400159
Vladimir Olteand32b7eb2018-07-03 00:04:03 +0300160ifneq ($(TW_ROTATION),)
161 ifeq (,$(filter 0 90 180 270, $(TW_ROTATION)))
162 $(error TW_ROTATION must be set to 0, 90, 180 or 270. Currently set to $(TW_ROTATION))
163 endif
164 LOCAL_CFLAGS += -DTW_ROTATION=$(TW_ROTATION)
165else
166 # Support for old flag
167 ifeq ($(BOARD_HAS_FLIPPED_SCREEN), true)
168 LOCAL_CFLAGS += -DTW_ROTATION=180
169 else
170 LOCAL_CFLAGS += -DTW_ROTATION=0
171 endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400172endif
173
Ibrahim Awwal2e9cb012014-01-04 12:38:26 -0800174ifeq ($(TW_IGNORE_MAJOR_AXIS_0), true)
175LOCAL_CFLAGS += -DTW_IGNORE_MAJOR_AXIS_0
176endif
177
Ethan Yonker32f68a32014-12-29 08:13:23 -0600178ifeq ($(TW_IGNORE_MT_POSITION_0), true)
179LOCAL_CFLAGS += -DTW_IGNORE_MT_POSITION_0
180endif
181
Ethan Yonkerd6821a12015-08-26 15:29:23 -0500182ifeq ($(TW_IGNORE_ABS_MT_TRACKING_ID), true)
183LOCAL_CFLAGS += -DTW_IGNORE_ABS_MT_TRACKING_ID
184endif
185
Ethan Yonker5742a402014-08-12 14:52:49 -0500186ifneq ($(TW_INPUT_BLACKLIST),)
187 LOCAL_CFLAGS += -DTW_INPUT_BLACKLIST=$(TW_INPUT_BLACKLIST)
188endif
189
Flemmardf4674612014-01-10 09:14:44 +0100190ifneq ($(TW_WHITELIST_INPUT),)
191 LOCAL_CFLAGS += -DWHITELIST_INPUT=$(TW_WHITELIST_INPUT)
192endif
193
LameMonster824ef96a62020-06-04 13:31:12 +0200194ifeq ($(TW_HAPTICS_TSPDRV), true)
195 LOCAL_SRC_FILES += tspdrv.cpp
196 LOCAL_CFLAGS += -DTW_HAPTICS_TSPDRV
197endif
198
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200199ifeq ($(TW_DISABLE_TTF), true)
Ethan Yonker88037f42015-10-04 22:09:08 -0500200 $(warning ****************************************************************************)
201 $(warning * TW_DISABLE_TTF support has been deprecated in TWRP. *)
202 $(warning ****************************************************************************)
203 $(error stopping)
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200204endif
205
Ethan Yonkerfbb43532015-12-28 21:54:50 +0100206LOCAL_CLANG := true
207
Dees Troy3454ade2015-01-20 19:21:04 +0000208LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
Dees Troy9a4d7402019-03-21 14:17:28 -0400209LOCAL_SHARED_LIBRARIES += libft2 libz libc libcutils libpng libutils libc++
Greg Wallaceace76232016-01-27 17:15:51 -0500210ifneq ($(TW_INCLUDE_JPEG),)
211 LOCAL_SHARED_LIBRARIES += libjpeg
212endif
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500213LOCAL_STATIC_LIBRARIES += libpixelflinger_twrp
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500214ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
215LOCAL_SHARED_LIBRARIES += libcutils liblog libutils
216endif
bigbiffd58ba182020-03-23 10:02:29 -0400217LOCAL_MODULE_TAGS := optional
Dees_Troy51a0e822012-09-05 15:24:24 -0400218LOCAL_MODULE := libminuitwrp
219
Dees_Troy930bf012013-08-10 22:19:03 +0000220include $(BUILD_SHARED_LIBRARY)