blob: bc4b74e30aba14af5c72cfc138c88b2ffd792e1a [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#
26# classic drivers:
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
39classic_drivers :=
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)
81SUBDIRS += src/egl/drivers/dri2
82endif
83
Chia-I Wu688db6e2011-08-17 11:38:00 +080084ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
85SUBDIRS += src/gallium
86endif
87
Chia-I Wuc9b21d92011-08-17 11:07:01 +080088# ---------------------------------------
89# Build libGLES_mesa
90# ---------------------------------------
91
92LOCAL_PATH := $(MESA_TOP)
93
94include $(CLEAR_VARS)
95
96LOCAL_SRC_FILES :=
97LOCAL_CFLAGS :=
98LOCAL_C_INCLUDES :=
99
Chia-I Wu327de222011-08-17 12:19:23 +0800100LOCAL_STATIC_LIBRARIES :=
101LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_egl
102
103LOCAL_SHARED_LIBRARIES := \
104 libglapi \
Chia-I Wu327de222011-08-17 12:19:23 +0800105 libdl \
106 libhardware \
107 liblog \
108 libcutils
109
Chia-I Wu09b5f1f2011-08-25 21:36:19 +0800110# hardware drivers require DRM
111ifneq ($(MESA_GPU_DRIVERS),swrast)
112LOCAL_SHARED_LIBRARIES += libdrm
113endif
114
Chia-I Wu099faee2011-08-19 17:11:34 +0800115ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
116LOCAL_STATIC_LIBRARIES += libmesa_egl_dri2
117endif
118
Chia-I Wu327de222011-08-17 12:19:23 +0800119ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
120
121gallium_DRIVERS :=
122
123# swrast
124gallium_DRIVERS += libmesa_pipe_softpipe libmesa_winsys_sw_android
125
Chia-I Wu99be9682011-08-22 11:04:46 +0800126# i915g
127ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
128gallium_DRIVERS += libmesa_winsys_i915 libmesa_pipe_i915
129LOCAL_SHARED_LIBRARIES += libdrm_intel
130endif
131
Chia-I Wu534df792011-08-22 11:21:31 +0800132# nouveau
133ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),)
134gallium_DRIVERS += \
135 libmesa_winsys_nouveau \
136 libmesa_pipe_nvc0 \
137 libmesa_pipe_nv50 \
138 libmesa_pipe_nvfx \
139 libmesa_pipe_nouveau
140LOCAL_SHARED_LIBRARIES += libdrm_nouveau
141endif
142
Chia-I Wuc696d652011-08-22 10:45:29 +0800143# r300g/r600g
144ifneq ($(filter r300g r600g, $(MESA_GPU_DRIVERS)),)
Chia-I Wu7b1972d2011-08-19 14:35:45 +0800145gallium_DRIVERS += libmesa_winsys_radeon
Chia-I Wuc696d652011-08-22 10:45:29 +0800146ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),)
147gallium_DRIVERS += libmesa_pipe_r300
148endif
149ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),)
Chia-I Wu7b1972d2011-08-19 14:35:45 +0800150gallium_DRIVERS += libmesa_pipe_r600 libmesa_winsys_r600
151endif
Chia-I Wuc696d652011-08-22 10:45:29 +0800152endif
Chia-I Wu7b1972d2011-08-19 14:35:45 +0800153
Chia-I Wu04dbb372011-08-22 11:14:33 +0800154# vmwgfx
155ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
156gallium_DRIVERS += libmesa_winsys_svga libmesa_pipe_svga
157endif
158
Chia-I Wu327de222011-08-17 12:19:23 +0800159#
160# Notes about the order here:
161#
162# * libmesa_st_egl depends on libmesa_winsys_sw_android in $(gallium_DRIVERS)
Chia-I Wuc696d652011-08-22 10:45:29 +0800163# * libmesa_pipe_r300 in $(gallium_DRIVERS) depends on libmesa_st_mesa and
164# libmesa_glsl
Chia-I Wu327de222011-08-17 12:19:23 +0800165# * libmesa_st_mesa depends on libmesa_glsl
166# * libmesa_glsl depends on libmesa_glsl_utils
167#
168LOCAL_STATIC_LIBRARIES := \
169 libmesa_egl_gallium \
170 libmesa_st_egl \
171 $(gallium_DRIVERS) \
172 libmesa_st_mesa \
173 libmesa_glsl \
174 libmesa_glsl_utils \
175 libmesa_gallium \
176 $(LOCAL_STATIC_LIBRARIES)
177
178endif # MESA_BUILD_GALLIUM
179
Chia-I Wuc9b21d92011-08-17 11:07:01 +0800180LOCAL_MODULE := libGLES_mesa
181LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
182
183include $(MESA_COMMON_MK)
184include $(BUILD_SHARED_LIBRARY)
185
Chia-I Wu688db6e2011-08-17 11:38:00 +0800186mkfiles := $(patsubst %,$(MESA_TOP)/%/Android.mk,$(SUBDIRS))
Chia-I Wu2a77dc02011-08-17 11:24:11 +0800187include $(mkfiles)
Chia-I Wu688db6e2011-08-17 11:38:00 +0800188
Chia-I Wuc9b21d92011-08-17 11:07:01 +0800189endif # MESA_GPU_DRIVERS