LOCAL_PATH := $(call my-dir)
-SUBDIRS := common
+# Import mesa_dri_common_INCLUDES.
+include $(LOCAL_PATH)/common/Makefile.sources
+#-----------------------------------------------
+# Variables common to all DRI drivers
+
+MESA_DRI_CFLAGS := \
+ -DHAVE_ANDROID_PLATFORM
+
+MESA_DRI_C_INCLUDES := \
+ $(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary \
+ external/expat/lib
+
+MESA_DRI_WHOLE_STATIC_LIBRARIES := \
+ libmesa_glsl \
+ libmesa_compiler \
+ libmesa_nir \
+ libmesa_megadriver_stub \
+ libmesa_dri_common \
+ libmesa_dricore \
+ libmesa_util
+
+MESA_DRI_SHARED_LIBRARIES := \
+ libcutils \
+ libdl \
+ libglapi \
+ liblog \
+ libz
+
+# If Android version >=8 MESA should static link libexpat else should dynamic link
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27; echo $$?), 0)
+MESA_DRI_WHOLE_STATIC_LIBRARIES += \
+ libexpat
+else
+MESA_DRI_SHARED_LIBRARIES += \
+ libexpat
+endif
+
+#-----------------------------------------------
+# Build drivers and libmesa_dri_common
+
+SUBDIRS := common i915 i965
include $(foreach d, $(SUBDIRS), $(LOCAL_PATH)/$(d)/Android.mk)