blob: c8440828337ded09232cf25deafc233b6c5bf1ec [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 Faraz909daa92020-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 \
74 external/libcxx/include
Dees_Troy51a0e822012-09-05 15:24:24 -040075
Greg Wallaceace76232016-01-27 17:15:51 -050076ifneq ($(TW_INCLUDE_JPEG),)
77 LOCAL_C_INCLUDES += \
78 external/jpeg
79 LOCAL_CFLAGS += -DTW_INCLUDE_JPEG
80endif
Ethan Yonkere95c4862016-01-27 10:57:26 -060081
Dees_Troy51a0e822012-09-05 15:24:24 -040082ifeq ($(RECOVERY_TOUCHSCREEN_SWAP_XY), true)
83LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_SWAP_XY
84endif
85
86ifeq ($(RECOVERY_TOUCHSCREEN_FLIP_X), true)
87LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_FLIP_X
88endif
89
90ifeq ($(RECOVERY_TOUCHSCREEN_FLIP_Y), true)
91LOCAL_CFLAGS += -DRECOVERY_TOUCHSCREEN_FLIP_Y
92endif
93
Ethan Yonker31f855b2016-01-28 22:31:48 -060094ifeq ($(RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH), true)
95LOCAL_CFLAGS += -DRECOVERY_GRAPHICS_FORCE_USE_LINELENGTH
Dees_Troy51a0e822012-09-05 15:24:24 -040096endif
97
Ethan Yonker4a71d4f2016-07-29 17:42:36 -050098ifeq ($(RECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER), true)
99LOCAL_CFLAGS += -DRECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER
Kra1o5c9556cc2015-06-24 12:19:09 +0200100endif
101
Dees_Troy51a0e822012-09-05 15:24:24 -0400102#Remove the # from the line below to enable event logging
103#TWRP_EVENT_LOGGING := true
104ifeq ($(TWRP_EVENT_LOGGING), true)
105LOCAL_CFLAGS += -D_EVENT_LOGGING
106endif
107
Ethan Yonker31f855b2016-01-28 22:31:48 -0600108ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGBA_8888)
109 $(warning ****************************************************************************)
110 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGBA_8888 not implemented yet *)
111 $(warning ****************************************************************************)
112 $(error stopping)
Kra1o577568592015-10-14 18:09:54 +0200113 LOCAL_CFLAGS += -DRECOVERY_RGBA
114endif
Ethan Yonker31f855b2016-01-28 22:31:48 -0600115ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGBX_8888)
116 $(warning ****************************************************************************)
117 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGBX_8888 not implemented yet *)
118 $(warning ****************************************************************************)
119 $(error stopping)
120 LOCAL_CFLAGS += -DRECOVERY_RGBX
121endif
122ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),BGRA_8888)
123 $(warning ****************************************************************************)
124 $(warning * TARGET_RECOVERY_FORCE_PIXEL_FORMAT := BGRA_8888 not implemented yet *)
125 $(warning ****************************************************************************)
126 $(error stopping)
127 LOCAL_CFLAGS += -DRECOVERY_BGRA
128endif
129ifeq ($(subst ",,$(TARGET_RECOVERY_FORCE_PIXEL_FORMAT)),RGB_565)
130 LOCAL_CFLAGS += -DRECOVERY_FORCE_RGB_565
131endif
132
133# This used to compare against values in double-quotes (which are just
134# ordinary characters in this context). Strip double-quotes from the
135# value so that either will work.
136
137ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),ABGR_8888)
138 LOCAL_CFLAGS += -DRECOVERY_ABGR
139endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -0600140ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),RGBX_8888)
141 LOCAL_CFLAGS += -DRECOVERY_RGBX
142endif
143ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),BGRA_8888)
144 LOCAL_CFLAGS += -DRECOVERY_BGRA
145endif
Ethan Yonker4ee5ad72014-02-18 18:41:17 -0600146
Ethan Yonkerfbb43532015-12-28 21:54:50 +0100147ifneq ($(TARGET_RECOVERY_OVERSCAN_PERCENT),)
148 LOCAL_CFLAGS += -DOVERSCAN_PERCENT=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
149else
150 LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
151endif
Muhammad Fahad Baig0ac22932016-04-07 09:19:33 +0100152ifeq ($(TW_FBIOPAN), true)
153 LOCAL_CFLAGS += -DTW_FBIOPAN
154endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400155
Vladimir Olteand32b7eb2018-07-03 00:04:03 +0300156ifneq ($(TW_ROTATION),)
157 ifeq (,$(filter 0 90 180 270, $(TW_ROTATION)))
158 $(error TW_ROTATION must be set to 0, 90, 180 or 270. Currently set to $(TW_ROTATION))
159 endif
160 LOCAL_CFLAGS += -DTW_ROTATION=$(TW_ROTATION)
161else
162 # Support for old flag
163 ifeq ($(BOARD_HAS_FLIPPED_SCREEN), true)
164 LOCAL_CFLAGS += -DTW_ROTATION=180
165 else
166 LOCAL_CFLAGS += -DTW_ROTATION=0
167 endif
Dees_Troy51a0e822012-09-05 15:24:24 -0400168endif
169
Ibrahim Awwal2e9cb012014-01-04 12:38:26 -0800170ifeq ($(TW_IGNORE_MAJOR_AXIS_0), true)
171LOCAL_CFLAGS += -DTW_IGNORE_MAJOR_AXIS_0
172endif
173
Ethan Yonker32f68a32014-12-29 08:13:23 -0600174ifeq ($(TW_IGNORE_MT_POSITION_0), true)
175LOCAL_CFLAGS += -DTW_IGNORE_MT_POSITION_0
176endif
177
Ethan Yonkerd6821a12015-08-26 15:29:23 -0500178ifeq ($(TW_IGNORE_ABS_MT_TRACKING_ID), true)
179LOCAL_CFLAGS += -DTW_IGNORE_ABS_MT_TRACKING_ID
180endif
181
Ethan Yonker5742a402014-08-12 14:52:49 -0500182ifneq ($(TW_INPUT_BLACKLIST),)
183 LOCAL_CFLAGS += -DTW_INPUT_BLACKLIST=$(TW_INPUT_BLACKLIST)
184endif
185
Flemmardf4674612014-01-10 09:14:44 +0100186ifneq ($(TW_WHITELIST_INPUT),)
187 LOCAL_CFLAGS += -DWHITELIST_INPUT=$(TW_WHITELIST_INPUT)
188endif
189
LameMonster82314cbd52020-06-04 13:31:12 +0200190ifeq ($(TW_HAPTICS_TSPDRV), true)
191 LOCAL_SRC_FILES += tspdrv.cpp
192 LOCAL_CFLAGS += -DTW_HAPTICS_TSPDRV
193endif
194
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200195ifeq ($(TW_DISABLE_TTF), true)
Ethan Yonker88037f42015-10-04 22:09:08 -0500196 $(warning ****************************************************************************)
197 $(warning * TW_DISABLE_TTF support has been deprecated in TWRP. *)
198 $(warning ****************************************************************************)
199 $(error stopping)
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200200endif
201
Ethan Yonkerfbb43532015-12-28 21:54:50 +0100202LOCAL_CLANG := true
203
Dees Troy3454ade2015-01-20 19:21:04 +0000204LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
Dees Troy9a4d7402019-03-21 14:17:28 -0400205LOCAL_SHARED_LIBRARIES += libft2 libz libc libcutils libpng libutils libc++
Greg Wallaceace76232016-01-27 17:15:51 -0500206ifneq ($(TW_INCLUDE_JPEG),)
207 LOCAL_SHARED_LIBRARIES += libjpeg
208endif
Ethan Yonkerc798c9c2015-10-09 11:15:26 -0500209LOCAL_STATIC_LIBRARIES += libpixelflinger_twrp
Ethan Yonker8373cfe2017-09-08 06:50:54 -0500210ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
211LOCAL_SHARED_LIBRARIES += libcutils liblog libutils
212endif
Dees_Troy2673cec2013-04-02 20:22:16 +0000213LOCAL_MODULE_TAGS := eng
Dees_Troy51a0e822012-09-05 15:24:24 -0400214LOCAL_MODULE := libminuitwrp
215
Dees_Troy930bf012013-08-10 22:19:03 +0000216include $(BUILD_SHARED_LIBRARY)