blob: 788e1cbf426b80455837a42e4558a76c550f02ba [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
soulr34448d9d472021-05-26 09:16:01 +054520ifeq ($(TW_USE_SAMSUNG_HAPTICS),true)
21 LOCAL_CFLAGS += -DTW_USE_SAMSUNG_HAPTICS=1
22endif
23
Dees_Troy86382ca2013-01-15 16:54:59 +000024ifneq ($(TW_BOARD_CUSTOM_GRAPHICS),)
Ethan Yonkerfbb43532015-12-28 21:54:50 +010025 $(warning ****************************************************************************)
26 $(warning * TW_BOARD_CUSTOM_GRAPHICS support has been deprecated in TWRP. *)
27 $(warning ****************************************************************************)
28 $(error stopping)
Dees_Troy86382ca2013-01-15 16:54:59 +000029endif
Dees_Troy51a0e822012-09-05 15:24:24 -040030
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060031ifeq ($(TW_TARGET_USES_QCOM_BSP), true)
32 LOCAL_CFLAGS += -DMSM_BSP
Ethan Yonkerb386f712017-01-20 14:30:28 -060033 LOCAL_SRC_FILES += graphics_overlay.cpp
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060034 ifeq ($(TARGET_PREBUILT_KERNEL),)
Ethan Yonkerabf1fb02019-04-24 16:09:07 -050035 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
36 LOCAL_REQUIRED_MODULES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
37 else
38 LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
39 endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060040 LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
41 else
Kra1o50024e382014-12-17 01:49:00 +010042 ifeq ($(TARGET_CUSTOM_KERNEL_HEADERS),)
Greg Wallace62c188c2016-01-27 18:12:05 -050043 LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minuitwrp/include
Kra1o50024e382014-12-17 01:49:00 +010044 else
45 LOCAL_C_INCLUDES += $(TARGET_CUSTOM_KERNEL_HEADERS)
46 endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060047 endif
48else
Greg Wallace62c188c2016-01-27 18:12:05 -050049 LOCAL_C_INCLUDES += $(commands_recovery_local_path)/minuitwrp/include
Ethan Yonkerfbb43532015-12-28 21:54:50 +010050 # The header files required for adf graphics can cause compile errors
51 # with adf graphics.
Ethan Yonker2f685272018-10-19 08:06:03 -050052 ifneq ($(wildcard system/core/adf/Android.*),)
Ethan Yonkerfbb43532015-12-28 21:54:50 +010053 LOCAL_CFLAGS += -DHAS_ADF
54 LOCAL_SRC_FILES += graphics_adf.cpp
55 LOCAL_WHOLE_STATIC_LIBRARIES += libadf
56 endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -060057endif
58
Kra1o5de50c5f2015-04-23 21:46:36 +020059ifeq ($(TW_NEW_ION_HEAP), true)
60 LOCAL_CFLAGS += -DNEW_ION_HEAP
61endif
62
lambdadroidd842fe12018-09-26 22:30:16 +020063ifneq ($(wildcard external/libdrm/Android.*),)
Ethan Yonkerfbb43532015-12-28 21:54:50 +010064 LOCAL_CFLAGS += -DHAS_DRM
65 LOCAL_SRC_FILES += graphics_drm.cpp
Ethan Yonker3eb70ed2018-01-04 08:59:36 -060066 ifneq ($(wildcard external/libdrm/Android.common.mk),)
67 LOCAL_WHOLE_STATIC_LIBRARIES += libdrm_platform
68 else
69 LOCAL_WHOLE_STATIC_LIBRARIES += libdrm
70 endif
Ethan Yonkerfbb43532015-12-28 21:54:50 +010071endif
72
Dees_Troy2673cec2013-04-02 20:22:16 +000073LOCAL_C_INCLUDES += \
74 external/libpng \
75 external/zlib \
Dees_Troy930bf012013-08-10 22:19:03 +000076 system/core/include \
Ethan Yonkerfbb43532015-12-28 21:54:50 +010077 external/freetype/include \
bigbiff1f9e4842020-10-31 11:33:15 -040078 external/libcxx/include \
79 $(LOCAL_PATH)/../twrpinstall/include
Dees_Troy51a0e822012-09-05 15:24:24 -040080
Greg Wallaceace76232016-01-27 17:15:51 -050081ifneq ($(TW_INCLUDE_JPEG),)
82 LOCAL_C_INCLUDES += \
83 external/jpeg
84 LOCAL_CFLAGS += -DTW_INCLUDE_JPEG
85endif
Ethan Yonkere95c4862016-01-27 10:57:26 -060086
Dees_Troy51a0e822012-09-05 15:24:24 -040087ifeq ($(RECOVERY_TOUCHSCREEN_SWAP_XY), true)
88LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_SWAP_XY
89endif
90
91ifeq ($(RECOVERY_TOUCHSCREEN_FLIP_X), true)
92LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_FLIP_X
93endif
94
95ifeq ($(RECOVERY_TOUCHSCREEN_FLIP_Y), true)
96LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_FLIP_Y
97endif
98
Ethan Yonker31f855b2016-01-28 22:31:48 -060099ifeq ($(RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH), true)
100LOCAL_CFLAGS += -DRECOVERY_GRAPHICS_FORCE_USE_LINELENGTH
Dees_Troy51a0e822012-09-05 15:24:24 -0400101endif
102
Ethan Yonker4a71d4f2016-07-29 17:42:36 -0500103ifeq ($(RECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER), true)
104LOCAL_CFLAGS += -DRECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER
Kra1o5c9556cc2015-06-24 12:19:09 +0200105endif
106
Dees_Troy51a0e822012-09-05 15:24:24 -0400107#Remove the # from the line below to enable event logging
108#TWRP_EVENT_LOGGING := true
109ifeq ($(TWRP_EVENT_LOGGING), true)
110LOCAL_CFLAGS += -D_EVENT_LOGGING
111endif
112
Ethan Yonker31f855b2016-01-28 22:31:48 -0600113ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGBA_8888)
114 $(warning ****************************************************************************)
115 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGBA_8888 not implemented yet *)
116 $(warning ****************************************************************************)
117 $(error stopping)
Kra1o577568592015-10-14 18:09:54 +0200118 LOCAL_CFLAGS += -DRECOVERY_RGBA
119endif
Ethan Yonker31f855b2016-01-28 22:31:48 -0600120ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGBX_8888)
121 $(warning ****************************************************************************)
122 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGBX_8888 not implemented yet *)
123 $(warning ****************************************************************************)
124 $(error stopping)
125 LOCAL_CFLAGS += -DRECOVERY_RGBX
126endif
127ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),BGRA_8888)
128 $(warning ****************************************************************************)
129 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := BGRA_8888 not implemented yet *)
130 $(warning ****************************************************************************)
131 $(error stopping)
132 LOCAL_CFLAGS += -DRECOVERY_BGRA
133endif
134ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGB_565)
135 LOCAL_CFLAGS += -DRECOVERY_FORCE_RGB_565
136endif
137
138# This used to compare against values in double-quotes (which are just
139# ordinary characters in this context). Strip double-quotes from the
140# value so that either will work.
141
142ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),ABGR_8888)
143 LOCAL_CFLAGS += -DRECOVERY_ABGR
144endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -0600145ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
146 LOCAL_CFLAGS += -DRECOVERY_RGBX
147endif
148ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),BGRA_8888)
149 LOCAL_CFLAGS += -DRECOVERY_BGRA
150endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -0600151
Ethan Yonkerfbb43532015-12-28 21:54:50 +0100152ifneq ($(TARGET_RECOVERY_OVERSCAN_PERCENT),)
153 LOCAL_CFLAGS += -DOVERSCAN_PERCENT=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
154else
155 LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
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)