4383cca1e004c413536475a44aa829f7db4b36b0
[mesa.git] / src / egl / Makefile.am
1 # Copyright © 2012 Intel Corporation
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the "Software"),
5 # to deal in the Software without restriction, including without limitation
6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 # and/or sell copies of the Software, and to permit persons to whom the
8 # Software is furnished to do so, subject to the following conditions:
9 #
10 # The above copyright notice and this permission notice (including the next
11 # paragraph) shall be included in all copies or substantial portions of the
12 # Software.
13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 # IN THE SOFTWARE.
21
22 include Makefile.sources
23
24 MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
25
26 BUILT_SOURCES =
27
28 AM_CFLAGS = \
29 -I$(top_srcdir)/include \
30 -I$(top_srcdir)/src/mapi \
31 -I$(top_srcdir)/src/egl/main \
32 -I$(top_srcdir)/src/gbm/main \
33 -I$(top_srcdir)/src \
34 $(DEFINES) \
35 $(VISIBILITY_CFLAGS) \
36 $(LIBDRM_CFLAGS) \
37 $(EGL_CFLAGS) \
38 -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM)
39
40 # Depending on whether libglvnd is enabled, we'll build the EGL library as
41 # either libEGL.so.1 or libEGL_mesa.so.0. Using an automake substitution
42 # in the variable names breaks "make dist" target, so use a conenience library
43 # instead.
44 noinst_LTLIBRARIES = libEGL_common.la
45 libEGL_common_la_SOURCES = \
46 $(LIBEGL_C_FILES)
47
48 libEGL_common_la_LIBADD = \
49 $(top_builddir)/src/util/libmesautil.la \
50 $(EGL_LIB_DEPS)
51
52 dri2_backend_FILES =
53 dri2_backend_GENERATED_FILES =
54 dri3_backend_FILES =
55
56 if HAVE_PLATFORM_X11
57 AM_CFLAGS += $(XCB_DRI2_CFLAGS)
58 libEGL_common_la_LIBADD += $(XCB_DRI2_LIBS)
59 dri2_backend_FILES += drivers/dri2/platform_x11.c
60
61 if HAVE_DRI3
62 dri3_backend_FILES += \
63 drivers/dri2/platform_x11_dri3.c \
64 drivers/dri2/platform_x11_dri3.h
65
66 libEGL_common_la_LIBADD += $(top_builddir)/src/loader/libloader_dri3_helper.la
67 endif
68 endif
69
70 WL_DMABUF_XML = $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
71
72 drivers/dri2/linux-dmabuf-unstable-v1-protocol.c: $(WL_DMABUF_XML)
73 $(MKDIR_GEN)
74 $(AM_V_GEN)$(WAYLAND_SCANNER) $(SCANNER_ARG) $< $@
75
76 drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: $(WL_DMABUF_XML)
77 $(MKDIR_GEN)
78 $(AM_V_GEN)$(WAYLAND_SCANNER) client-header $< $@
79
80 if HAVE_PLATFORM_WAYLAND
81 drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo: drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
82 drivers/dri2/egl_dri2.lo: drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
83 drivers/dri2/platform_wayland.lo: drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
84
85 AM_CFLAGS += $(WAYLAND_CLIENT_CFLAGS)
86 libEGL_common_la_LIBADD += $(WAYLAND_CLIENT_LIBS)
87 libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
88 AM_CFLAGS += $(WAYLAND_EGL_CFLAGS)
89 libEGL_common_la_LIBADD += $(WAYLAND_EGL_LIBS)
90 AM_CFLAGS += $(WAYLAND_SERVER_CFLAGS)
91 libEGL_common_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
92 libEGL_common_la_LIBADD += $(WAYLAND_SERVER_LIBS)
93 dri2_backend_FILES += \
94 drivers/dri2/platform_wayland.c
95 dri2_backend_GENERATED_FILES += \
96 drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
97 drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
98 endif
99
100 if HAVE_PLATFORM_DRM
101 libEGL_common_la_LIBADD += $(top_builddir)/src/gbm/libgbm.la
102 dri2_backend_FILES += drivers/dri2/platform_drm.c
103 endif
104
105 if HAVE_PLATFORM_SURFACELESS
106 dri2_backend_FILES += drivers/dri2/platform_surfaceless.c
107 endif
108
109 if HAVE_PLATFORM_ANDROID
110 AM_CFLAGS += $(ANDROID_CFLAGS)
111 libEGL_common_la_LIBADD += $(ANDROID_LIBS)
112 dri2_backend_FILES += drivers/dri2/platform_android.c
113 endif
114
115 AM_CFLAGS += \
116 -I$(top_srcdir)/src/loader \
117 -I$(top_builddir)/src/egl/drivers/dri2 \
118 -I$(top_srcdir)/src/egl/drivers/dri2 \
119 -I$(top_srcdir)/src/gbm/backends/dri \
120 -I$(top_builddir)/src/egl/wayland/wayland-drm \
121 -I$(top_srcdir)/src/egl/wayland/wayland-drm
122
123 nodist_libEGL_common_la_SOURCES = \
124 $(dri2_backend_GENERATED_FILES)
125
126 libEGL_common_la_SOURCES += \
127 $(dri2_backend_core_FILES) \
128 $(dri2_backend_FILES) \
129 $(dri3_backend_FILES)
130
131 libEGL_common_la_LIBADD += \
132 $(top_builddir)/src/loader/libloader.la \
133 $(top_builddir)/src/util/libxmlconfig.la \
134 $(DLOPEN_LIBS) \
135 $(LIBDRM_LIBS) \
136 $(CLOCK_LIB)
137
138 # dummy rule to keep dist happy
139 $(top_scrdir)/src/mapi/new/genCommon.py:
140
141 GLVND_GEN_EGL_DEPS = \
142 generate/gen_egl_dispatch.py \
143 generate/eglFunctionList.py \
144 generate/egl.xml \
145 generate/egl_other.xml
146
147 GLVND_GEN_DEPS = $(top_scrdir)/src/mapi/new/genCommon.py \
148 $(GLVND_GEN_EGL_DEPS)
149
150 PYTHON_GEN = $(AM_V_GEN)$(PYTHON) $(PYTHON_FLAGS)
151 g_egldispatchstubs.c: $(GLVND_GEN_DEPS)
152 $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py source \
153 $(top_srcdir)/src/egl/generate/egl.xml \
154 $(top_srcdir)/src/egl/generate/egl_other.xml > $@
155
156 g_egldispatchstubs.h: $(GLVND_GEN_DEPS)
157 $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py header \
158 $(top_srcdir)/src/egl/generate/egl.xml \
159 $(top_srcdir)/src/egl/generate/egl_other.xml > $@
160
161 BUILT_SOURCES += g_egldispatchstubs.c g_egldispatchstubs.h
162
163 CLEANFILES = \
164 $(BUILT_SOURCES) \
165 $(dri2_backend_GENERATED_FILES)
166
167 if USE_LIBGLVND
168 AM_CFLAGS += \
169 $(GLVND_CFLAGS)
170
171 vendorjsondir = @LIBGLVND_DATADIR@/glvnd/egl_vendor.d
172 vendorjson_DATA = main/50_mesa.json
173
174 lib_LTLIBRARIES = libEGL_mesa.la
175 libEGL_mesa_la_SOURCES = \
176 main/eglglvnd.c \
177 main/egldispatchstubs.h \
178 main/egldispatchstubs.c \
179 g_egldispatchstubs.c \
180 g_egldispatchstubs.h
181 libEGL_mesa_la_LIBADD = \
182 libEGL_common.la \
183 $(top_builddir)/src/mapi/shared-glapi/libglapi.la
184 libEGL_mesa_la_LDFLAGS = \
185 -no-undefined \
186 -version-number 0 \
187 $(BSYMBOLIC) \
188 $(GC_SECTIONS) \
189 $(LD_NO_UNDEFINED)
190
191 else # USE_LIBGLVND
192
193 lib_LTLIBRARIES = libEGL.la
194 libEGL_la_SOURCES =
195 libEGL_la_LIBADD = \
196 libEGL_common.la \
197 $(top_builddir)/src/mapi/shared-glapi/libglapi.la
198 libEGL_la_LDFLAGS = \
199 -no-undefined \
200 -version-number 1:0 \
201 $(BSYMBOLIC) \
202 $(GC_SECTIONS) \
203 $(LD_NO_UNDEFINED)
204
205 endif # USE_LIBGLVND
206
207 include $(top_srcdir)/install-lib-links.mk
208
209 # TODO: When building with glvnd, glvnd itself should be providing egl.pc and the headers
210 pkgconfigdir = $(libdir)/pkgconfig
211
212 pkgconfig_DATA = main/egl.pc
213
214 egldir = $(includedir)/EGL
215 egl_HEADERS = \
216 $(top_srcdir)/include/EGL/eglext.h \
217 $(top_srcdir)/include/EGL/egl.h \
218 $(top_srcdir)/include/EGL/eglextchromium.h \
219 $(top_srcdir)/include/EGL/eglmesaext.h \
220 $(top_srcdir)/include/EGL/eglplatform.h
221
222 TESTS = egl-entrypoint-check
223
224 if USE_LIBGLVND
225 #TODO: glvnd symbol check
226 else
227 TESTS += egl-symbols-check
228 endif
229
230 EXTRA_DIST = \
231 $(TESTS) \
232 SConscript \
233 drivers/haiku \
234 main/egl.def \
235 main/README.txt \
236 $(GLVND_GEN_EGL_DEPS) \
237 main/50_mesa.json \
238 meson.build