1DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS)))
2
3intel_drivers := i915 i965 i915g ilo
4radeon_drivers := r300g r600g radeonsi
5rockchip_drivers := rockchip
6nouveau_drivers := nouveau
7vmwgfx_drivers := vmwgfx
8tegra_drivers := tegra
9
10valid_drivers := \
11	$(intel_drivers) \
12	$(radeon_drivers) \
13	$(rockchip_drivers) \
14	$(nouveau_drivers) \
15	$(vmwgfx_drivers) \
16	$(tegra_drivers)
17
18# warn about invalid drivers
19invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS))
20ifneq ($(invalid_drivers),)
21$(warning invalid GPU drivers: $(invalid_drivers))
22# tidy up
23DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS))
24endif
25
26LOCAL_PATH := $(call my-dir)
27
28include $(CLEAR_VARS)
29include $(LOCAL_PATH)/Makefile.sources
30
31LOCAL_SRC_FILES := $(LIBKMS_FILES)
32
33ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),)
34LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES)
35endif
36
37ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),)
38LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES)
39endif
40
41ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),)
42LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES)
43endif
44
45ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),)
46LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES)
47endif
48
49LOCAL_MODULE := libkms
50LOCAL_SHARED_LIBRARIES := libdrm
51
52LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm
53
54LOCAL_COPY_HEADERS_TO := libdrm
55LOCAL_COPY_HEADERS := $(LIBKMS_H_FILES)
56
57include $(BUILD_SHARED_LIBRARY)
58