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 kmsro r300g r600g radeonsi vc4 virgl vmwgfx etnaviv iris lima panfrost tegra 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 32LOCAL_PATH := $(call my-dir) 33 34ifneq ($(BOARD_USE_CUSTOMIZED_MESA), true) 35ifneq ($(BOARD_GPU_DRIVERS),) 36 37MESA_TOP := $(LOCAL_PATH) 38 39ifeq ($(filter $(MESA_TOP),$(PRODUCT_SOONG_NAMESPACES)),) 40 $(error $(MESA_TOP) must be in PRODUCT_SOONG_NAMESPACES) 41endif 42 43MESA_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION))) 44ifneq ($(filter 2 4, $(MESA_ANDROID_MAJOR_VERSION)),) 45$(error "Android 4.4 and earlier not supported") 46endif 47 48MESA_DRI_MODULE_REL_PATH := dri 49MESA_DRI_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(MESA_DRI_MODULE_REL_PATH) 50MESA_DRI_MODULE_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/$(MESA_DRI_MODULE_REL_PATH) 51MESA_DRI_LDFLAGS := -Wl,--build-id=sha1 52 53MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk 54MESA_PYTHON2 := python 55MESA_PYTHON3 := python3 56ifeq ($(filter 5 6 7 8 9 10, $(MESA_ANDROID_MAJOR_VERSION)),) 57MESA_LEX := M4=$(M4) $(LEX) 58else 59MESA_LEX := $(LEX) 60endif 61 62# Lists to convert driver names to boolean variables 63# in form of <driver name>.<boolean make variable> 64classic_drivers := i915.HAVE_I915_DRI i965.HAVE_I965_DRI 65gallium_drivers := \ 66 swrast.HAVE_GALLIUM_SOFTPIPE \ 67 freedreno.HAVE_GALLIUM_FREEDRENO \ 68 i915g.HAVE_GALLIUM_I915 \ 69 nouveau.HAVE_GALLIUM_NOUVEAU \ 70 tegra.HAVE_GALLIUM_TEGRA \ 71 kmsro.HAVE_GALLIUM_KMSRO \ 72 r300g.HAVE_GALLIUM_R300 \ 73 r600g.HAVE_GALLIUM_R600 \ 74 radeonsi.HAVE_GALLIUM_RADEONSI \ 75 vmwgfx.HAVE_GALLIUM_VMWGFX \ 76 vc4.HAVE_GALLIUM_VC4 \ 77 virgl.HAVE_GALLIUM_VIRGL \ 78 etnaviv.HAVE_GALLIUM_ETNAVIV \ 79 iris.HAVE_GALLIUM_IRIS \ 80 lima.HAVE_GALLIUM_LIMA \ 81 panfrost.HAVE_GALLIUM_PANFROST 82 83ifeq ($(BOARD_GPU_DRIVERS),all) 84MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers))) 85MESA_BUILD_GALLIUM := $(filter HAVE_%, $(subst ., , $(gallium_drivers))) 86else 87# Warn if we have any invalid driver names 88$(foreach d, $(BOARD_GPU_DRIVERS), \ 89 $(if $(findstring $(d).,$(classic_drivers) $(gallium_drivers)), \ 90 , \ 91 $(warning invalid GPU driver: $(d)) \ 92 ) \ 93) 94MESA_BUILD_CLASSIC := $(strip $(foreach d, $(BOARD_GPU_DRIVERS), $(patsubst $(d).%,%, $(filter $(d).%, $(classic_drivers))))) 95MESA_BUILD_GALLIUM := $(strip $(foreach d, $(BOARD_GPU_DRIVERS), $(patsubst $(d).%,%, $(filter $(d).%, $(gallium_drivers))))) 96endif 97ifeq ($(filter x86%,$(TARGET_ARCH)),) 98 MESA_BUILD_CLASSIC := 99endif 100 101$(foreach d, $(MESA_BUILD_CLASSIC) $(MESA_BUILD_GALLIUM), $(eval $(d) := true)) 102 103ifneq ($(filter true, $(HAVE_GALLIUM_RADEONSI)),) 104MESA_ENABLE_LLVM := true 105endif 106 107define mesa-build-with-llvm 108 $(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5 6 7), \ 109 $(warning Unsupported LLVM version in Android $(MESA_ANDROID_MAJOR_VERSION)),) \ 110 $(eval LOCAL_CFLAGS += -DLLVM_AVAILABLE -DLLVM_IS_SHARED=1 -DMESA_LLVM_VERSION_STRING=\"3.9\") \ 111 $(eval LOCAL_SHARED_LIBRARIES += libLLVM) 112endef 113 114# add subdirectories 115SUBDIRS := \ 116 src/etnaviv \ 117 src/freedreno \ 118 src/gbm \ 119 src/loader \ 120 src/mapi \ 121 src/compiler \ 122 src/mesa \ 123 src/util \ 124 src/egl \ 125 src/amd \ 126 src/broadcom \ 127 src/intel \ 128 src/mesa/drivers/dri \ 129 src/vulkan \ 130 src/panfrost \ 131 132INC_DIRS := $(call all-named-subdir-makefiles,$(SUBDIRS)) 133INC_DIRS += $(call all-named-subdir-makefiles,src/gallium) 134include $(INC_DIRS) 135 136else 137 ifneq ($(filter $(LOCAL_PATH),$(PRODUCT_SOONG_NAMESPACES)),) 138 $(error $(LOCAL_PATH) in PRODUCT_SOONG_NAMESPACES, but not configured in Make) 139 endif 140endif # BOARD_GPU_DRIVERS != "" 141else 142 ifneq ($(filter $(LOCAL_PATH),$(PRODUCT_SOONG_NAMESPACES)),) 143 $(error $(LOCAL_PATH) in PRODUCT_SOONG_NAMESPACES, but not configured in Make) 144 endif 145endif # BOARD_USE_CUSTOMIZED_MESA != true 146