1848b8605Smrg# Mesa 3-D graphics library 2848b8605Smrg# 3848b8605Smrg# Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com> 4848b8605Smrg# Copyright (C) 2010-2011 LunarG Inc. 5848b8605Smrg# 6848b8605Smrg# Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg# copy of this software and associated documentation files (the "Software"), 8848b8605Smrg# to deal in the Software without restriction, including without limitation 9848b8605Smrg# the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg# and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg# Software is furnished to do so, subject to the following conditions: 12848b8605Smrg# 13848b8605Smrg# The above copyright notice and this permission notice shall be included 14848b8605Smrg# in all copies or substantial portions of the Software. 15848b8605Smrg# 16848b8605Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17848b8605Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20848b8605Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21848b8605Smrg# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22848b8605Smrg# DEALINGS IN THE SOFTWARE. 23848b8605Smrg 24848b8605Smrgifeq ($(LOCAL_IS_HOST_MODULE),true) 25b8e80941SmrgLOCAL_CFLAGS += -D_GNU_SOURCE 26848b8605Smrgendif 27848b8605Smrg 28848b8605SmrgLOCAL_C_INCLUDES += \ 29b8e80941Smrg $(MESA_TOP)/src \ 30848b8605Smrg $(MESA_TOP)/include 31848b8605Smrg 32b8e80941SmrgMESA_VERSION := $(shell cat $(MESA_TOP)/VERSION) 33848b8605SmrgLOCAL_CFLAGS += \ 34b8e80941Smrg -Wno-error \ 35b8e80941Smrg -Werror=incompatible-pointer-types \ 36b8e80941Smrg -Wno-unused-parameter \ 37b8e80941Smrg -Wno-pointer-arith \ 38b8e80941Smrg -Wno-missing-field-initializers \ 39b8e80941Smrg -Wno-initializer-overrides \ 40b8e80941Smrg -Wno-mismatched-tags \ 41848b8605Smrg -DPACKAGE_VERSION=\"$(MESA_VERSION)\" \ 42b8e80941Smrg -DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\" 43848b8605Smrg 44b8e80941Smrg# XXX: The following __STDC_*_MACROS defines should not be needed. 45b8e80941Smrg# It's likely due to a bug elsewhere, but let's temporarily add them 46b8e80941Smrg# here to fix the radeonsi build. 47848b8605SmrgLOCAL_CFLAGS += \ 48b8e80941Smrg -DANDROID_API_LEVEL=$(PLATFORM_SDK_VERSION) \ 49b8e80941Smrg -DENABLE_SHADER_CACHE \ 50b8e80941Smrg -D__STDC_CONSTANT_MACROS \ 51b8e80941Smrg -D__STDC_LIMIT_MACROS \ 52b8e80941Smrg -DHAVE___BUILTIN_EXPECT \ 53b8e80941Smrg -DHAVE___BUILTIN_FFS \ 54b8e80941Smrg -DHAVE___BUILTIN_FFSLL \ 55b8e80941Smrg -DHAVE_DLFCN_H \ 56b8e80941Smrg -DHAVE_FUNC_ATTRIBUTE_FLATTEN \ 57b8e80941Smrg -DHAVE_FUNC_ATTRIBUTE_UNUSED \ 58b8e80941Smrg -DHAVE_FUNC_ATTRIBUTE_FORMAT \ 59b8e80941Smrg -DHAVE_FUNC_ATTRIBUTE_PACKED \ 60b8e80941Smrg -DHAVE_FUNC_ATTRIBUTE_ALIAS \ 61b8e80941Smrg -DHAVE_FUNC_ATTRIBUTE_NORETURN \ 62b8e80941Smrg -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL \ 63b8e80941Smrg -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT \ 64b8e80941Smrg -DHAVE___BUILTIN_CTZ \ 65b8e80941Smrg -DHAVE___BUILTIN_POPCOUNT \ 66b8e80941Smrg -DHAVE___BUILTIN_POPCOUNTLL \ 67b8e80941Smrg -DHAVE___BUILTIN_CLZ \ 68b8e80941Smrg -DHAVE___BUILTIN_CLZLL \ 69b8e80941Smrg -DHAVE___BUILTIN_UNREACHABLE \ 70848b8605Smrg -DHAVE_PTHREAD=1 \ 71b8e80941Smrg -DHAVE_DLADDR \ 72b8e80941Smrg -DHAVE_DL_ITERATE_PHDR \ 73b8e80941Smrg -DHAVE_LINUX_FUTEX_H \ 74b8e80941Smrg -DHAVE_ENDIAN_H \ 75b8e80941Smrg -DHAVE_ZLIB \ 76b8e80941Smrg -DMAJOR_IN_SYSMACROS \ 77b8e80941Smrg -DVK_USE_PLATFORM_ANDROID_KHR \ 78848b8605Smrg -fvisibility=hidden \ 79b8e80941Smrg -fno-math-errno \ 80b8e80941Smrg -fno-trapping-math \ 81848b8605Smrg -Wno-sign-compare 82848b8605Smrg 83b8e80941SmrgLOCAL_CPPFLAGS += \ 84b8e80941Smrg -D__STDC_CONSTANT_MACROS \ 85b8e80941Smrg -D__STDC_FORMAT_MACROS \ 86b8e80941Smrg -D__STDC_LIMIT_MACROS \ 87b8e80941Smrg -Wno-error=non-virtual-dtor \ 88b8e80941Smrg -Wno-non-virtual-dtor 89b8e80941Smrg 90b8e80941Smrg# mesa requires at least c99 compiler 91b8e80941SmrgLOCAL_CONLYFLAGS += \ 92b8e80941Smrg -std=c99 93b8e80941Smrg 94b8e80941Smrg# c11 timespec_get is part of bionic as well 95b8e80941Smrg# https://android-review.googlesource.com/c/718518 96b8e80941Smrg# This means releases from P and earlier won't need this 97b8e80941Smrgifeq ($(filter 5 6 7 8 9, $(MESA_ANDROID_MAJOR_VERSION)),) 98b8e80941SmrgLOCAL_CFLAGS += -DHAVE_TIMESPEC_GET 99b8e80941Smrgendif 100b8e80941Smrg 101848b8605Smrgifeq ($(strip $(MESA_ENABLE_ASM)),true) 102848b8605Smrgifeq ($(TARGET_ARCH),x86) 103848b8605SmrgLOCAL_CFLAGS += \ 104b8e80941Smrg -DUSE_X86_ASM 105848b8605Smrg 106848b8605Smrgendif 107848b8605Smrgendif 108b8e80941Smrgifeq ($(ARCH_ARM_HAVE_NEON),true) 109b8e80941SmrgLOCAL_CFLAGS_arm += -DUSE_ARM_ASM 110b8e80941Smrgendif 111b8e80941SmrgLOCAL_CFLAGS_arm64 += -DUSE_AARCH64_ASM 112848b8605Smrg 113b8e80941Smrgifneq ($(LOCAL_IS_HOST_MODULE),true) 114b8e80941SmrgLOCAL_CFLAGS += -DHAVE_LIBDRM 115b8e80941SmrgLOCAL_SHARED_LIBRARIES += libdrm 116b8e80941Smrgendif 117b8e80941Smrg 118b8e80941SmrgLOCAL_CFLAGS_32 += -DDEFAULT_DRIVER_DIR=\"/vendor/lib/$(MESA_DRI_MODULE_REL_PATH)\" 119b8e80941SmrgLOCAL_CFLAGS_64 += -DDEFAULT_DRIVER_DIR=\"/vendor/lib64/$(MESA_DRI_MODULE_REL_PATH)\" 120b8e80941SmrgLOCAL_PROPRIETARY_MODULE := true 121848b8605Smrg 122848b8605Smrg# uncomment to keep the debug symbols 123848b8605Smrg#LOCAL_STRIP_MODULE := false 124848b8605Smrg 125848b8605Smrgifeq ($(strip $(LOCAL_MODULE_TAGS)),) 126848b8605SmrgLOCAL_MODULE_TAGS := optional 127848b8605Smrgendif 128b8e80941Smrg 129b8e80941Smrg# Quiet down the build system and remove any .h files from the sources 130b8e80941SmrgLOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES)) 131