blob: 914854c27d633cddd850ddf1dcca3720ffe740cd [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
Tomeu Vizoso79827f52017-07-04 13:28:39 +020027# gallium drivers: swrast freedreno i915g nouveau pl111 r300g r600g radeonsi vc4 virgl vmwgfx etnaviv imx
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
46
Rob Herring3f097392017-05-03 14:35:20 -050047# Lists to convert driver names to boolean variables
48# in form of <driver name>.<boolean make variable>
49classic_drivers := i915.HAVE_I915_DRI i965.HAVE_I965_DRI
50gallium_drivers := \
51 swrast.HAVE_GALLIUM_SOFTPIPE \
52 freedreno.HAVE_GALLIUM_FREEDRENO \
53 i915g.HAVE_GALLIUM_I915 \
54 nouveau.HAVE_GALLIUM_NOUVEAU \
Eric Anholt7029ec02017-05-08 15:57:21 -070055 pl111.HAVE_GALLIUM_PL111 \
Rob Herring3f097392017-05-03 14:35:20 -050056 r300g.HAVE_GALLIUM_R300 \
57 r600g.HAVE_GALLIUM_R600 \
58 radeonsi.HAVE_GALLIUM_RADEONSI \
59 vmwgfx.HAVE_GALLIUM_VMWGFX \
60 vc4.HAVE_GALLIUM_VC4 \
Rob Herring77c44672017-07-04 13:28:38 +020061 virgl.HAVE_GALLIUM_VIRGL \
Tomeu Vizoso79827f52017-07-04 13:28:39 +020062 etnaviv.HAVE_GALLIUM_ETNAVIV \
63 imx.HAVE_GALLIUM_IMX
Chia-I Wuc9b21d92011-08-17 11:07:01 +080064
Rob Herring4c0c3712017-05-03 14:35:21 -050065ifeq ($(BOARD_GPU_DRIVERS),all)
66MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers)))
67MESA_BUILD_GALLIUM := $(filter HAVE_%, $(subst ., , $(gallium_drivers)))
68else
Rob Herring3f097392017-05-03 14:35:20 -050069# Warn if we have any invalid driver names
70$(foreach d, $(BOARD_GPU_DRIVERS), \
71 $(if $(findstring $(d).,$(classic_drivers) $(gallium_drivers)), \
72 , \
73 $(warning invalid GPU driver: $(d)) \
74 ) \
75)
76MESA_BUILD_CLASSIC := $(strip $(foreach d, $(BOARD_GPU_DRIVERS), $(patsubst $(d).%,%, $(filter $(d).%, $(classic_drivers)))))
77MESA_BUILD_GALLIUM := $(strip $(foreach d, $(BOARD_GPU_DRIVERS), $(patsubst $(d).%,%, $(filter $(d).%, $(gallium_drivers)))))
Rob Herring4c0c3712017-05-03 14:35:21 -050078endif
Rob Herring137b32b2017-10-11 17:46:10 -050079ifeq ($(filter x86%,$(TARGET_ARCH)),)
80 MESA_BUILD_CLASSIC :=
81endif
82
Rob Herring3f097392017-05-03 14:35:20 -050083$(foreach d, $(MESA_BUILD_CLASSIC) $(MESA_BUILD_GALLIUM), $(eval $(d) := true))
Chia-I Wuc9b21d92011-08-17 11:07:01 +080084
85# host and target must be the same arch to generate matypes.h
86ifeq ($(TARGET_ARCH),$(HOST_ARCH))
87MESA_ENABLE_ASM := true
88else
89MESA_ENABLE_ASM := false
90endif
91
Rob Herring3f097392017-05-03 14:35:20 -050092ifneq ($(filter true, $(HAVE_GALLIUM_RADEONSI)),)
93MESA_ENABLE_LLVM := true
Chia-I Wuc9b21d92011-08-17 11:07:01 +080094endif
95
Rob Herring26aee6f2017-05-03 14:35:24 -050096define mesa-build-with-llvm
97 $(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5), \
98 $(warning Unsupported LLVM version in Android $(MESA_ANDROID_MAJOR_VERSION)),) \
99 $(if $(filter 6,$(MESA_ANDROID_MAJOR_VERSION)), \
Rob Herring4734bfc2017-08-15 16:37:41 -0500100 $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0307 -DMESA_LLVM_VERSION_PATCH=0)) \
Rob Herring26aee6f2017-05-03 14:35:24 -0500101 $(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
Rob Herring4734bfc2017-08-15 16:37:41 -0500102 $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308 -DMESA_LLVM_VERSION_PATCH=0)) \
Rob Herring7db0bf82017-08-23 12:20:52 -0500103 $(if $(filter 8,$(MESA_ANDROID_MAJOR_VERSION)), \
Rob Herring4734bfc2017-08-15 16:37:41 -0500104 $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)) \
Rob Herring0ba2d262017-09-07 15:31:26 -0500105 $(if $(filter P,$(MESA_ANDROID_MAJOR_VERSION)), \
106 $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309 -DMESA_LLVM_VERSION_PATCH=0)) \
Rob Herring4734bfc2017-08-15 16:37:41 -0500107 $(eval LOCAL_SHARED_LIBRARIES += libLLVM)
Rob Herring26aee6f2017-05-03 14:35:24 -0500108endef
109
Chia-I Wu4d3d6f72011-11-26 11:06:02 +0800110# add subdirectories
Chia-I Wu2a77dc02011-08-17 11:24:11 +0800111SUBDIRS := \
Rob Herringbdfa6352016-05-03 21:02:42 -0500112 src/gbm \
Emil Velikov8c2e7fd2014-01-10 23:36:16 +0000113 src/loader \
Chia-I Wuee41fc82011-08-17 12:10:12 +0800114 src/mapi \
Emil Velikov1a882fd2016-01-18 10:47:13 +0200115 src/compiler \
Chia-I Wuee40f182011-08-17 11:31:36 +0800116 src/mesa \
Tomasz Figad703abf2014-09-27 16:19:59 +0200117 src/util \
Emil Velikov1040a862015-07-14 00:28:10 +0100118 src/egl \
Mauro Rossi6b9d7e62016-09-13 01:15:16 +0200119 src/amd \
Eric Anholt7f80a9f2016-10-26 10:14:37 -0700120 src/broadcom \
Mauro Rossicd18bbe2016-08-27 17:19:34 +0200121 src/intel \
Mauro Rossi3f2cb692017-02-28 01:24:41 +0100122 src/mesa/drivers/dri \
123 src/vulkan
Chia-I Wu099faee2011-08-19 17:11:34 +0800124
Rob Herringdbbf7a82016-04-28 14:02:01 -0500125INC_DIRS := $(call all-named-subdir-makefiles,$(SUBDIRS))
Rob Herringdbbf7a82016-04-28 14:02:01 -0500126INC_DIRS += $(call all-named-subdir-makefiles,src/gallium)
Rob Herringdbbf7a82016-04-28 14:02:01 -0500127include $(INC_DIRS)