loader: rework xmlconfig dependency
[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 += \
124 $(top_builddir)/src/loader/libloader.la \
125 $(top_builddir)/src/util/libxmlconfig.la \
126 $(DLOPEN_LIBS) \
127 $(LIBDRM_LIBS) \
128 $(CLOCK_LIB)
129
130 GLVND_GEN_DEPS = generate/gen_egl_dispatch.py \
131 generate/egl.xml generate/eglFunctionList.py generate/genCommon.py \
132 generate/egl_other.xml
133
134 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
135 g_egldispatchstubs.c: $(GLVND_GEN_DEPS)
136 $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py source \
137 $(top_srcdir)/src/egl/generate/eglFunctionList.py \
138 $(top_srcdir)/src/egl/generate/egl.xml \
139 $(top_srcdir)/src/egl/generate/egl_other.xml > $@
140
141 g_egldispatchstubs.h: $(GLVND_GEN_DEPS)
142 $(PYTHON_GEN) $(top_srcdir)/src/egl/generate/gen_egl_dispatch.py header \
143 $(top_srcdir)/src/egl/generate/eglFunctionList.py \
144 $(top_srcdir)/src/egl/generate/egl.xml \
145 $(top_srcdir)/src/egl/generate/egl_other.xml > $@
146
147 BUILT_SOURCES += g_egldispatchstubs.c g_egldispatchstubs.h
148 CLEANFILES = $(BUILT_SOURCES)
149
150 if USE_LIBGLVND
151 AM_CFLAGS += \
152 $(GLVND_CFLAGS)
153
154 vendorjsondir = @LIBGLVND_DATADIR@/glvnd/egl_vendor.d
155 vendorjson_DATA = main/50_mesa.json
156
157 lib_LTLIBRARIES = libEGL_mesa.la
158 libEGL_mesa_la_SOURCES = \
159 main/eglglvnd.c \
160 main/egldispatchstubs.h \
161 main/egldispatchstubs.c \
162 g_egldispatchstubs.c \
163 g_egldispatchstubs.h
164 libEGL_mesa_la_LIBADD = libEGL_common.la
165 libEGL_mesa_la_LDFLAGS = \
166 -no-undefined \
167 -version-number 0 \
168 $(BSYMBOLIC) \
169 $(GC_SECTIONS) \
170 $(LD_NO_UNDEFINED)
171
172 else # USE_LIBGLVND
173
174 lib_LTLIBRARIES = libEGL.la
175 libEGL_la_SOURCES =
176 libEGL_la_LIBADD = libEGL_common.la
177 libEGL_la_LDFLAGS = \
178 -no-undefined \
179 -version-number 1:0 \
180 $(BSYMBOLIC) \
181 $(GC_SECTIONS) \
182 $(LD_NO_UNDEFINED)
183
184 endif # USE_LIBGLVND
185
186 include $(top_srcdir)/install-lib-links.mk
187
188 pkgconfigdir = $(libdir)/pkgconfig
189
190 pkgconfig_DATA = main/egl.pc
191
192 egldir = $(includedir)/EGL
193 egl_HEADERS = \
194 $(top_srcdir)/include/EGL/eglext.h \
195 $(top_srcdir)/include/EGL/egl.h \
196 $(top_srcdir)/include/EGL/eglextchromium.h \
197 $(top_srcdir)/include/EGL/eglmesaext.h \
198 $(top_srcdir)/include/EGL/eglplatform.h
199
200 TESTS = egl-symbols-check \
201 egl-entrypoint-check
202
203 EXTRA_DIST = \
204 $(TESTS) \
205 SConscript \
206 drivers/haiku \
207 main/egl.def \
208 main/README.txt \
209 $(GLVND_GEN_DEPS) \
210 main/50_mesa.json