blob: c15c2b78bacf19f129122ed5c52fd71617b949cc [file] [log] [blame]
Chia-I Wuc9b21d92011-08-17 11:07:01 +08001# 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#
Chia-I Wu64492982011-08-31 12:31:02 +080026# classic drivers: i915 i965
Robert Fossf1404672019-10-22 19:31:52 +020027# gallium drivers: swrast freedreno i915g nouveau kmsro r300g r600g radeonsi vc4 virgl vmwgfx etnaviv iris lima panfrost
Chia-I Wuc9b21d92011-08-17 11:07:01 +080028#
Chia-I Wu099faee2011-08-19 17:11:34 +080029# 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.
Chia-I Wuc9b21d92011-08-17 11:07:01 +080031
32MESA_TOP := $(call my-dir)
Chad Versace56c6cdc2012-12-20 14:14:51 -080033
34MESA_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
Rob Herringd5a93652017-05-23 14:41:22 -050035ifneq ($(filter 2 4, $(MESA_ANDROID_MAJOR_VERSION)),)
36$(error "Android 4.4 and earlier not supported")
37endif
Chad Versace56c6cdc2012-12-20 14:14:51 -080038
Rob Herring8949edf2016-02-24 12:56:28 -060039MESA_DRI_MODULE_REL_PATH := dri
40MESA_DRI_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(MESA_DRI_MODULE_REL_PATH)
41MESA_DRI_MODULE_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/$(MESA_DRI_MODULE_REL_PATH)
Jordan Justenccb70052017-10-18 15:04:37 -070042MESA_DRI_LDFLAGS := -Wl,--build-id=sha1
Rob Herring8949edf2016-02-24 12:56:28 -060043
Chia-I Wuc9b21d92011-08-17 11:07:01 +080044MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
45MESA_PYTHON2 := python
Martin Fuzzeycad400a2020-02-06 19:08:10 +010046MESA_PYTHON3 := python3
Chia-I Wuc9b21d92011-08-17 11:07:01 +080047
Rob Herring3f097392017-05-03 14:35:20 -050048# Lists to convert driver names to boolean variables
49# in form of <driver name>.<boolean make variable>
50classic_drivers := i915.HAVE_I915_DRI i965.HAVE_I965_DRI
51gallium_drivers := \
52 swrast.HAVE_GALLIUM_SOFTPIPE \
53 freedreno.HAVE_GALLIUM_FREEDRENO \
54 i915g.HAVE_GALLIUM_I915 \
55 nouveau.HAVE_GALLIUM_NOUVEAU \
Eric Anholted65aee2018-10-23 12:33:09 -070056 kmsro.HAVE_GALLIUM_KMSRO \
Rob Herring3f097392017-05-03 14:35:20 -050057 r300g.HAVE_GALLIUM_R300 \
58 r600g.HAVE_GALLIUM_R600 \
59 radeonsi.HAVE_GALLIUM_RADEONSI \
60 vmwgfx.HAVE_GALLIUM_VMWGFX \
61 vc4.HAVE_GALLIUM_VC4 \
Rob Herring77c44672017-07-04 13:28:38 +020062 virgl.HAVE_GALLIUM_VIRGL \
Tapani Pälli96bb3282018-12-03 14:15:13 +020063 etnaviv.HAVE_GALLIUM_ETNAVIV \
Icenowy Zheng3e91c7d2019-04-15 12:32:43 +080064 iris.HAVE_GALLIUM_IRIS \
Robert Fossf1404672019-10-22 19:31:52 +020065 lima.HAVE_GALLIUM_LIMA \
66 panfrost.HAVE_GALLIUM_PANFROST
Chia-I Wuc9b21d92011-08-17 11:07:01 +080067
Rob Herring4c0c3712017-05-03 14:35:21 -050068ifeq ($(BOARD_GPU_DRIVERS),all)
69MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers)))
70MESA_BUILD_GALLIUM := $(filter HAVE_%, $(subst ., , $(gallium_drivers)))
71else
Rob Herring3f097392017-05-03 14:35:20 -050072# 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)))))
Rob Herring4c0c3712017-05-03 14:35:21 -050081endif
Rob Herring137b32b2017-10-11 17:46:10 -050082ifeq ($(filter x86%,$(TARGET_ARCH)),)
83 MESA_BUILD_CLASSIC :=
84endif
85
Rob Herring3f097392017-05-03 14:35:20 -050086$(foreach d, $(MESA_BUILD_CLASSIC) $(MESA_BUILD_GALLIUM), $(eval $(d) := true))
Chia-I Wuc9b21d92011-08-17 11:07:01 +080087
Rob Herring3f097392017-05-03 14:35:20 -050088ifneq ($(filter true, $(HAVE_GALLIUM_RADEONSI)),)
89MESA_ENABLE_LLVM := true
Chia-I Wuc9b21d92011-08-17 11:07:01 +080090endif
91
Rob Herring26aee6f2017-05-03 14:35:24 -050092define mesa-build-with-llvm
Adam Jackson96b59262019-09-06 09:50:32 +020093 $(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5 6 7), \
Rob Herring26aee6f2017-05-03 14:35:24 -050094 $(warning Unsupported LLVM version in Android $(MESA_ANDROID_MAJOR_VERSION)),) \
John Stultz3976c862019-09-12 20:02:18 +000095 $(eval LOCAL_CFLAGS += -DLLVM_AVAILABLE -DMESA_LLVM_VERSION_STRING=\"3.9\") \
Rob Herring4734bfc2017-08-15 16:37:41 -050096 $(eval LOCAL_SHARED_LIBRARIES += libLLVM)
Rob Herring26aee6f2017-05-03 14:35:24 -050097endef
98
Chia-I Wu4d3d6f72011-11-26 11:06:02 +080099# add subdirectories
Chia-I Wu2a77dc02011-08-17 11:24:11 +0800100SUBDIRS := \
Martin Fuzzeyd1925fe2020-01-17 17:37:03 +0100101 src/etnaviv \
Amit Pundir88105372019-04-30 13:06:19 +0530102 src/freedreno \
Rob Herringbdfa6352016-05-03 21:02:42 -0500103 src/gbm \
Emil Velikov8c2e7fd2014-01-10 23:36:16 +0000104 src/loader \
Chia-I Wuee41fc82011-08-17 12:10:12 +0800105 src/mapi \
Emil Velikov1a882fd2016-01-18 10:47:13 +0200106 src/compiler \
Chia-I Wuee40f182011-08-17 11:31:36 +0800107 src/mesa \
Tomasz Figad703abf2014-09-27 16:19:59 +0200108 src/util \
Emil Velikov1040a862015-07-14 00:28:10 +0100109 src/egl \
Mauro Rossi6b9d7e62016-09-13 01:15:16 +0200110 src/amd \
Eric Anholt7f80a9f2016-10-26 10:14:37 -0700111 src/broadcom \
Mauro Rossicd18bbe2016-08-27 17:19:34 +0200112 src/intel \
Mauro Rossi3f2cb692017-02-28 01:24:41 +0100113 src/mesa/drivers/dri \
Roman Stratiienko26a01a62019-08-06 10:14:50 +0300114 src/vulkan \
115 src/panfrost \
Chia-I Wu099faee2011-08-19 17:11:34 +0800116
Rob Herringdbbf7a82016-04-28 14:02:01 -0500117INC_DIRS := $(call all-named-subdir-makefiles,$(SUBDIRS))
Rob Herringdbbf7a82016-04-28 14:02:01 -0500118INC_DIRS += $(call all-named-subdir-makefiles,src/gallium)
Rob Herringdbbf7a82016-04-28 14:02:01 -0500119include $(INC_DIRS)