• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Mesa 3-D graphics library
2#
3# Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
4# Copyright (C) 2010-2011 LunarG Inc.
5#
6# Permission is hereby granted, free of charge, to any person obtaining a
7# copy of this software and associated documentation files (the "Software"),
8# to deal in the Software without restriction, including without limitation
9# the rights to use, copy, modify, merge, publish, distribute, sublicense,
10# and/or sell copies of the Software, and to permit persons to whom the
11# Software is furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included
14# in all copies or substantial portions of the Software.
15#
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22# DEALINGS IN THE SOFTWARE.
23
24# BOARD_GPU_DRIVERS should be defined.  The valid values are
25#
26#   classic drivers: i915 i965
27#   gallium drivers: swrast freedreno i915g nouveau pl111 r300g r600g radeonsi vc4 virgl vmwgfx etnaviv imx
28#
29# The main target is libGLES_mesa.  For each classic driver enabled, a DRI
30# module will also be built.  DRI modules will be loaded by libGLES_mesa.
31
32ifneq ($(BOARD_USE_CUSTOMIZED_MESA), true)
33ifneq ($(BOARD_GPU_DRIVERS),)
34
35MESA_TOP := $(call my-dir)
36
37MESA_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
38ifneq ($(filter 2 4, $(MESA_ANDROID_MAJOR_VERSION)),)
39$(error "Android 4.4 and earlier not supported")
40endif
41
42MESA_DRI_MODULE_REL_PATH := dri
43MESA_DRI_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(MESA_DRI_MODULE_REL_PATH)
44MESA_DRI_MODULE_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/$(MESA_DRI_MODULE_REL_PATH)
45MESA_DRI_LDFLAGS := -Wl,--build-id=sha1
46
47MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
48MESA_PYTHON2 := python
49
50# Lists to convert driver names to boolean variables
51# in form of <driver name>.<boolean make variable>
52classic_drivers := i915.HAVE_I915_DRI i965.HAVE_I965_DRI
53gallium_drivers := \
54	swrast.HAVE_GALLIUM_SOFTPIPE \
55	freedreno.HAVE_GALLIUM_FREEDRENO \
56	i915g.HAVE_GALLIUM_I915 \
57	nouveau.HAVE_GALLIUM_NOUVEAU \
58	pl111.HAVE_GALLIUM_PL111 \
59	r300g.HAVE_GALLIUM_R300 \
60	r600g.HAVE_GALLIUM_R600 \
61	radeonsi.HAVE_GALLIUM_RADEONSI \
62	vmwgfx.HAVE_GALLIUM_VMWGFX \
63	vc4.HAVE_GALLIUM_VC4 \
64	virgl.HAVE_GALLIUM_VIRGL \
65	etnaviv.HAVE_GALLIUM_ETNAVIV \
66	imx.HAVE_GALLIUM_IMX
67
68ifeq ($(BOARD_GPU_DRIVERS),all)
69MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers)))
70MESA_BUILD_GALLIUM := $(filter HAVE_%, $(subst ., , $(gallium_drivers)))
71else
72# Warn if we have any invalid driver names
73$(foreach d, $(BOARD_GPU_DRIVERS), \
74	$(if $(findstring $(d).,$(classic_drivers) $(gallium_drivers)), \
75		, \
76		$(warning invalid GPU driver: $(d)) \
77	) \
78)
79MESA_BUILD_CLASSIC := $(strip $(foreach d, $(BOARD_GPU_DRIVERS), $(patsubst $(d).%,%, $(filter $(d).%, $(classic_drivers)))))
80MESA_BUILD_GALLIUM := $(strip $(foreach d, $(BOARD_GPU_DRIVERS), $(patsubst $(d).%,%, $(filter $(d).%, $(gallium_drivers)))))
81endif
82ifeq ($(filter x86%,$(TARGET_ARCH)),)
83	MESA_BUILD_CLASSIC :=
84endif
85
86$(foreach d, $(MESA_BUILD_CLASSIC) $(MESA_BUILD_GALLIUM), $(eval $(d) := true))
87
88# host and target must be the same arch to generate matypes.h
89ifeq ($(TARGET_ARCH),$(HOST_ARCH))
90MESA_ENABLE_ASM := true
91else
92MESA_ENABLE_ASM := false
93endif
94
95ifneq ($(filter true, $(HAVE_GALLIUM_RADEONSI)),)
96MESA_ENABLE_LLVM := true
97endif
98
99define mesa-build-with-llvm
100  $(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5), \
101    $(warning Unsupported LLVM version in Android $(MESA_ANDROID_MAJOR_VERSION)),) \
102  $(if $(filter 6,$(MESA_ANDROID_MAJOR_VERSION)), \
103    $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 -DMESA_LLVM_VERSION_PATCH=0)) \
104  $(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
105    $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_PATCH=0)) \
106  $(if $(filter 8,$(MESA_ANDROID_MAJOR_VERSION)), \
107    $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)) \
108  $(if $(filter P,$(MESA_ANDROID_MAJOR_VERSION)), \
109    $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)) \
110  $(eval LOCAL_SHARED_LIBRARIES += libLLVM)
111endef
112
113# add subdirectories
114SUBDIRS := \
115	src/gbm \
116	src/loader \
117	src/mapi \
118	src/compiler \
119	src/mesa \
120	src/util \
121	src/egl \
122	src/amd \
123	src/broadcom \
124	src/intel \
125	src/mesa/drivers/dri \
126	src/vulkan
127
128INC_DIRS := $(call all-named-subdir-makefiles,$(SUBDIRS))
129INC_DIRS += $(call all-named-subdir-makefiles,src/gallium)
130include $(INC_DIRS)
131
132endif # BOARD_GPU_DRIVERS != ""
133endif # BOARD_USE_CUSTOMIZED_MESA != true
134