blob: a5c9ebc5fa20ca7328cb5d7c3edc2e014af7af63 [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
Chia-I Wu534df792011-08-22 11:21:31 +080027# gallium drivers: swrast i915g nouveau r300g r600g vmwgfx
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)
33MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
34MESA_PYTHON2 := python
35
36DRM_TOP := external/drm
37DRM_GRALLOC_TOP := hardware/drm_gralloc
38
Chia-I Wu64492982011-08-31 12:31:02 +080039classic_drivers := i915 i965
Chia-I Wu534df792011-08-22 11:21:31 +080040gallium_drivers := swrast i915g nouveau r300g r600g vmwgfx
Chia-I Wuc9b21d92011-08-17 11:07:01 +080041
Chia-I Wu09b5f1f2011-08-25 21:36:19 +080042MESA_GPU_DRIVERS := $(strip $(BOARD_GPU_DRIVERS))
Chia-I Wuc9b21d92011-08-17 11:07:01 +080043
44# warn about invalid drivers
45invalid_drivers := $(filter-out \
46 $(classic_drivers) $(gallium_drivers), $(MESA_GPU_DRIVERS))
47ifneq ($(invalid_drivers),)
48$(warning invalid GPU drivers: $(invalid_drivers))
49# tidy up
50MESA_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(MESA_GPU_DRIVERS))
51endif
52
53# host and target must be the same arch to generate matypes.h
54ifeq ($(TARGET_ARCH),$(HOST_ARCH))
55MESA_ENABLE_ASM := true
56else
57MESA_ENABLE_ASM := false
58endif
59
60ifneq ($(filter $(classic_drivers), $(MESA_GPU_DRIVERS)),)
61MESA_BUILD_CLASSIC := true
62else
63MESA_BUILD_CLASSIC := false
64endif
65
66ifneq ($(filter $(gallium_drivers), $(MESA_GPU_DRIVERS)),)
67MESA_BUILD_GALLIUM := true
68else
69MESA_BUILD_GALLIUM := false
70endif
71
72ifneq ($(strip $(MESA_GPU_DRIVERS)),)
73
Chia-I Wu2a77dc02011-08-17 11:24:11 +080074SUBDIRS := \
Chia-I Wuee41fc82011-08-17 12:10:12 +080075 src/mapi \
Chia-I Wub81b82d2011-08-17 11:56:43 +080076 src/glsl \
Chia-I Wuee40f182011-08-17 11:31:36 +080077 src/mesa \
Chia-I Wu2a77dc02011-08-17 11:24:11 +080078 src/egl/main
Chia-I Wu688db6e2011-08-17 11:38:00 +080079
Chia-I Wu099faee2011-08-19 17:11:34 +080080ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
Chad Versace34349d42011-08-26 16:00:33 -070081SUBDIRS += \
82 src/egl/drivers/dri2 \
83 src/mesa/drivers/dri
Chia-I Wu099faee2011-08-19 17:11:34 +080084endif
85
Chia-I Wu688db6e2011-08-17 11:38:00 +080086ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
87SUBDIRS += src/gallium
88endif
89
Chia-I Wuc9b21d92011-08-17 11:07:01 +080090# ---------------------------------------
91# Build libGLES_mesa
92# ---------------------------------------
93
94LOCAL_PATH := $(MESA_TOP)
95
96include $(CLEAR_VARS)
97
98LOCAL_SRC_FILES :=
99LOCAL_CFLAGS :=
100LOCAL_C_INCLUDES :=
101
Chia-I Wu327de222011-08-17 12:19:23 +0800102LOCAL_STATIC_LIBRARIES :=
103LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_egl
104
105LOCAL_SHARED_LIBRARIES := \
106 libglapi \
Chia-I Wu327de222011-08-17 12:19:23 +0800107 libdl \
108 libhardware \
109 liblog \
110 libcutils
111
Chia-I Wu09b5f1f2011-08-25 21:36:19 +0800112# hardware drivers require DRM
113ifneq ($(MESA_GPU_DRIVERS),swrast)
114LOCAL_SHARED_LIBRARIES += libdrm
115endif
116
Chia-I Wu099faee2011-08-19 17:11:34 +0800117ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
118LOCAL_STATIC_LIBRARIES += libmesa_egl_dri2
119endif
120
Chia-I Wu327de222011-08-17 12:19:23 +0800121ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
122
123gallium_DRIVERS :=
124
125# swrast
126gallium_DRIVERS += libmesa_pipe_softpipe libmesa_winsys_sw_android
127
Chia-I Wu99be9682011-08-22 11:04:46 +0800128# i915g
129ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
130gallium_DRIVERS += libmesa_winsys_i915 libmesa_pipe_i915
131LOCAL_SHARED_LIBRARIES += libdrm_intel
132endif
133
Chia-I Wu534df792011-08-22 11:21:31 +0800134# nouveau
135ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),)
136gallium_DRIVERS += \
137 libmesa_winsys_nouveau \
138 libmesa_pipe_nvc0 \
139 libmesa_pipe_nv50 \
140 libmesa_pipe_nvfx \
141 libmesa_pipe_nouveau
142LOCAL_SHARED_LIBRARIES += libdrm_nouveau
143endif
144
Chia-I Wuc696d652011-08-22 10:45:29 +0800145# r300g/r600g
146ifneq ($(filter r300g r600g, $(MESA_GPU_DRIVERS)),)
Chia-I Wu7b1972d2011-08-19 14:35:45 +0800147gallium_DRIVERS += libmesa_winsys_radeon
Chia-I Wuc696d652011-08-22 10:45:29 +0800148ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),)
149gallium_DRIVERS += libmesa_pipe_r300
150endif
151ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),)
Chia-I Wu7b1972d2011-08-19 14:35:45 +0800152gallium_DRIVERS += libmesa_pipe_r600 libmesa_winsys_r600
153endif
Chia-I Wuc696d652011-08-22 10:45:29 +0800154endif
Chia-I Wu7b1972d2011-08-19 14:35:45 +0800155
Chia-I Wu04dbb372011-08-22 11:14:33 +0800156# vmwgfx
157ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
158gallium_DRIVERS += libmesa_winsys_svga libmesa_pipe_svga
159endif
160
Chia-I Wu327de222011-08-17 12:19:23 +0800161#
162# Notes about the order here:
163#
164# * libmesa_st_egl depends on libmesa_winsys_sw_android in $(gallium_DRIVERS)
Chia-I Wuc696d652011-08-22 10:45:29 +0800165# * libmesa_pipe_r300 in $(gallium_DRIVERS) depends on libmesa_st_mesa and
166# libmesa_glsl
Chia-I Wu327de222011-08-17 12:19:23 +0800167# * libmesa_st_mesa depends on libmesa_glsl
168# * libmesa_glsl depends on libmesa_glsl_utils
169#
170LOCAL_STATIC_LIBRARIES := \
171 libmesa_egl_gallium \
172 libmesa_st_egl \
173 $(gallium_DRIVERS) \
174 libmesa_st_mesa \
175 libmesa_glsl \
176 libmesa_glsl_utils \
177 libmesa_gallium \
178 $(LOCAL_STATIC_LIBRARIES)
179
180endif # MESA_BUILD_GALLIUM
181
Chia-I Wuc9b21d92011-08-17 11:07:01 +0800182LOCAL_MODULE := libGLES_mesa
183LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
184
185include $(MESA_COMMON_MK)
186include $(BUILD_SHARED_LIBRARY)
187
Chia-I Wu688db6e2011-08-17 11:38:00 +0800188mkfiles := $(patsubst %,$(MESA_TOP)/%/Android.mk,$(SUBDIRS))
Chia-I Wu2a77dc02011-08-17 11:24:11 +0800189include $(mkfiles)
Chia-I Wu688db6e2011-08-17 11:38:00 +0800190
Chia-I Wuc9b21d92011-08-17 11:07:01 +0800191endif # MESA_GPU_DRIVERS