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