ecaf148aaece49c3f3c50095abfd497708c3e3f0
[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/egl/main \
31 -I$(top_srcdir)/src/gbm/main \
32 -I$(top_srcdir)/src \
33 $(DEFINES) \
34 $(VISIBILITY_CFLAGS) \
35 $(LIBDRM_CFLAGS) \
36 $(EGL_CFLAGS) \
37 -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM)
38
39 # Depending on whether libglvnd is enabled, we'll build the EGL library as
40 # either libEGL.so.1 or libEGL_mesa.so.0. Using an automake substitution
41 # in the variable names breaks "make dist" target, so use a conenience library
42 # instead.
43 noinst_LTLIBRARIES = libEGL_common.la
44 libEGL_common_la_SOURCES = \
45 $(LIBEGL_C_FILES)
46
47 libEGL_common_la_LIBADD = \
48 $(EGL_LIB_DEPS)
49
50 dri2_backend_FILES =
51 dri3_backend_FILES =
52
53 if HAVE_PLATFORM_X11
54 AM_CFLAGS += $(XCB_DRI2_CFLAGS)
55 libEGL_common_la_LIBADD += $(XCB_DRI2_LIBS)
56 dri2_backend_FILES += drivers/dri2/platform_x11.c
57
58 if HAVE_DRI3
59 dri3_backend_FILES += \
60 drivers/dri2/platform_x11_dri3.c \
61 drivers/dri2/platform_x11_dri3.h
62
63 libEGL_common_la_LIBADD += $(top_builddir)/src/loader/libloader_dri3_helper.la
64 endif
65 endif
66
67 WL_DMABUF_XML = $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
68
69 drivers/dri2/linux-dmabuf-unstable-v1-protocol.c: $(WL_DMABUF_XML)
70 $(MKDIR_GEN)
71 $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
72
73 drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: $(WL_DMABUF_XML)
74 $(MKDIR_GEN)
75 $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
76
77 if HAVE_PLATFORM_WAYLAND
78 drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo: drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
79 drivers/dri2/egl_dri2.lo: drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
80
81 AM_CFLAGS += $(WAYLAND_CFLAGS)
82 libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
83 libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
84 libEGL_common_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
85 libEGL_common_la_LIBADD += $(top_builddir)/src/util/libmesautil.la
86 dri2_backend_FILES += \
87 drivers/dri2/platform_wayland.c \
88 drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
89 drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
90 endif
91
92 if HAVE_PLATFORM_DRM
93 libEGL_common_la_LIBADD += $(top_builddir)/src/gbm/libgbm.la
94 dri2_backend_FILES += drivers/dri2/platform_drm.c
95 endif
96
97 if HAVE_PLATFORM_SURFACELESS
98 dri2_backend_FILES += drivers/dri2/platform_surfaceless.c
99 endif
100
101 if HAVE_PLATFORM_ANDROID
102 AM_CFLAGS += $(ANDROID_CFLAGS)
103 libEGL_common_la_LIBADD += $(ANDROID_LIBS)
104 dri2_backend_FILES += drivers/dri2/platform_android.c
105 endif
106
107 AM_CFLAGS += \
108 -I$(top_srcdir)/src/loader \
109 -I$(top_builddir)/src/egl/drivers/dri2 \
110 -I$(top_srcdir)/src/egl/drivers/dri2 \
111 -I$(top_srcdir)/src/gbm/backends/dri \
112 -I$(top_srcdir)/src/egl/wayland/wayland-egl \
113 -I$(top_builddir)/src/egl/wayland/wayland-drm \
114 -I$(top_srcdir)/src/egl/wayland/wayland-drm \
115 -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
116 -D_EGL_BUILT_IN_DRIVER_DRI2
117
118 libEGL_common_la_SOURCES += \
119 $(dri2_backend_core_FILES) \
120 $(dri2_backend_FILES) \
121 $(dri3_backend_FILES)
122
123 libEGL_common_la_LIBADD += $(top_builddir)/src/loader/libloader.la
124 libEGL_common_la_LIBADD += $(DLOPEN_LIBS) $(LIBDRM_LIBS) $(CLOCK_LIB)
125
126 GLVND_GEN_DEPS = generate/gen_egl_dispatch.py \
127 generate/egl.xml generate/eglFunctionList.py generate/genCommon.py \
128 generate/egl_other.xml
129
130 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
131 g_egldispatchstubs.c: $(GLVND_GEN_DEPS)
132 $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py source \
133 $(top_srcdir)/src/egl/generate/eglFunctionList.py \
134 $(top_srcdir)/src/egl/generate/egl.xml \
135 $(top_srcdir)/src/egl/generate/egl_other.xml > $@
136
137 g_egldispatchstubs.h: $(GLVND_GEN_DEPS)
138 $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py header \
139 $(top_srcdir)/src/egl/generate/eglFunctionList.py \
140 $(top_srcdir)/src/egl/generate/egl.xml \
141 $(top_srcdir)/src/egl/generate/egl_other.xml > $@
142
143 BUILT_SOURCES += g_egldispatchstubs.c g_egldispatchstubs.h
144 CLEANFILES = $(BUILT_SOURCES)
145
146 if USE_LIBGLVND
147 AM_CFLAGS += \
148 $(GLVND_CFLAGS)
149
150 vendorjsondir = @LIBGLVND_DATADIR@/glvnd/egl_vendor.d
151 vendorjson_DATA = main/50_mesa.json
152
153 lib_LTLIBRARIES = libEGL_mesa.la
154 libEGL_mesa_la_SOURCES = \
155 main/eglglvnd.c \
156 main/egldispatchstubs.h \
157 main/egldispatchstubs.c \
158 g_egldispatchstubs.c \
159 g_egldispatchstubs.h
160 libEGL_mesa_la_LIBADD = libEGL_common.la
161 libEGL_mesa_la_LDFLAGS = \
162 -no-undefined \
163 -version-number 0 \
164 $(BSYMBOLIC) \
165 $(GC_SECTIONS) \
166 $(LD_NO_UNDEFINED)
167
168 else # USE_LIBGLVND
169
170 lib_LTLIBRARIES = libEGL.la
171 libEGL_la_SOURCES =
172 libEGL_la_LIBADD = libEGL_common.la
173 libEGL_la_LDFLAGS = \
174 -no-undefined \
175 -version-number 1:0 \
176 $(BSYMBOLIC) \
177 $(GC_SECTIONS) \
178 $(LD_NO_UNDEFINED)
179
180 endif # USE_LIBGLVND
181
182 include $(top_srcdir)/install-lib-links.mk
183
184 pkgconfigdir = $(libdir)/pkgconfig
185
186 pkgconfig_DATA = main/egl.pc
187
188 egldir = $(includedir)/EGL
189 egl_HEADERS = \
190 $(top_srcdir)/include/EGL/eglext.h \
191 $(top_srcdir)/include/EGL/egl.h \
192 $(top_srcdir)/include/EGL/eglextchromium.h \
193 $(top_srcdir)/include/EGL/eglmesaext.h \
194 $(top_srcdir)/include/EGL/eglplatform.h
195
196 TESTS = egl-symbols-check \
197 egl-entrypoint-check
198
199 EXTRA_DIST = \
200 $(TESTS) \
201 SConscript \
202 drivers/haiku \
203 main/egl.def \
204 main/README.txt \
205 $(GLVND_GEN_DEPS) \
206 main/50_mesa.json