1# Copyright © 2013, 2014 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
22SUBDIRS =
23TESTS =
24
25BUILT_SOURCES =
26CLEANFILES = $(BUILT_SOURCES)
27
28lib_LTLIBRARIES =
29check_PROGRAMS =
30pkgconfigdir = $(libdir)/pkgconfig
31pkgconfig_DATA =
32
33EXTRA_DIST = \
34	es1api/ABI-check \
35	es2api/ABI-check \
36	mapi_abi.py \
37	glapi/SConscript \
38	glapi/registry/gl.xml \
39	shared-glapi/SConscript \
40	es1api/meson.build \
41	es2api/meson.build \
42	glapi/meson.build \
43	shared-glapi/meson.build \
44	meson.build
45
46AM_CFLAGS = \
47	$(PTHREAD_CFLAGS) \
48	$(MSVC2013_COMPAT_CFLAGS)
49AM_CPPFLAGS =							\
50	$(DEFINES)						\
51	$(SELINUX_CFLAGS)					\
52	-I$(top_srcdir)/include					\
53	-I$(top_srcdir)/src					\
54	-I$(top_builddir)/src/mapi				\
55	-I$(top_srcdir)/src/mapi				\
56	-I$(top_builddir)/src/mapi/glapi			\
57	-I$(top_srcdir)/src/mapi/glapi
58
59include Makefile.sources
60
61MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
62PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
63
64glapi_gen_mapi_deps := \
65	mapi_abi.py \
66	$(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.xml) \
67	$(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.py)
68
69if HAVE_SHARED_GLAPI
70BUILT_SOURCES += shared-glapi/glapi_mapi_tmp.h
71
72lib_LTLIBRARIES += shared-glapi/libglapi.la
73shared_glapi_libglapi_la_SOURCES = $(MAPI_GLAPI_FILES) shared-glapi/glapi_mapi_tmp.h
74shared_glapi_libglapi_la_CFLAGS = \
75	$(AM_CFLAGS) \
76	$(VISIBILITY_CFLAGS)
77shared_glapi_libglapi_la_CPPFLAGS = \
78	$(AM_CPPFLAGS) \
79	-DMAPI_MODE_GLAPI \
80	-DMAPI_ABI_HEADER=\"shared-glapi/glapi_mapi_tmp.h\"
81shared_glapi_libglapi_la_LIBADD = \
82	$(PTHREAD_LIBS) \
83	$(SELINUX_LIBS)
84shared_glapi_libglapi_la_LDFLAGS = \
85	-no-undefined \
86	$(GC_SECTIONS) \
87	$(LD_NO_UNDEFINED)
88
89TESTS += shared-glapi-test
90check_PROGRAMS += shared-glapi-test
91
92shared_glapi_test_SOURCES = shared-glapi/tests/check_table.cpp
93shared_glapi_test_CPPFLAGS = \
94	$(AM_CPPFLAGS) \
95	-I$(top_srcdir)/src/gtest/include
96shared_glapi_test_LDADD = \
97	$(top_builddir)/src/mapi/shared-glapi/libglapi.la \
98	$(top_builddir)/src/gtest/libgtest.la
99endif
100
101shared-glapi/glapi_mapi_tmp.h : glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
102	$(MKDIR_GEN)
103	$(PYTHON_GEN) $(srcdir)/mapi_abi.py --printer shared-glapi \
104		$(srcdir)/glapi/gen/gl_and_es_API.xml > $@
105
106if HAVE_OPENGL
107noinst_LTLIBRARIES = glapi/libglapi.la
108
109if HAVE_X86_ASM
110if HAVE_X86_64_ASM
111GLAPI_ASM_SOURCES = glapi/glapi_x86-64.S
112else
113GLAPI_ASM_SOURCES = glapi/glapi_x86.S
114endif
115endif
116if HAVE_SPARC_ASM
117GLAPI_ASM_SOURCES = glapi/glapi_sparc.S
118endif
119
120glapi_libglapi_la_SOURCES =
121glapi_libglapi_la_CPPFLAGS = \
122	$(AM_CPPFLAGS) \
123	-I$(top_srcdir)/src/mesa
124
125if HAVE_APPLEDRI
126glapi_libglapi_la_SOURCES += glapi/glapi_gentable.c
127endif
128if HAVE_WINDOWSDRI
129glapi_libglapi_la_SOURCES += glapi/glapi_gentable.c
130endif
131
132if HAVE_SHARED_GLAPI
133glapi_libglapi_la_SOURCES += $(MAPI_BRIDGE_FILES) glapi/glapi_mapi_tmp.h
134glapi_libglapi_la_CPPFLAGS += \
135	-DMAPI_MODE_BRIDGE \
136	-DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\"
137else
138glapi_libglapi_la_CPPFLAGS += \
139	-DMAPI_MODE_UTIL
140glapi_libglapi_la_SOURCES += \
141	glapi/glapi_dispatch.c \
142	glapi/glapi_entrypoint.c \
143	glapi/glapi_getproc.c \
144	glapi/glapi_nop.c \
145	glapi/glapi.c \
146	glapi/glapi.h \
147	glapi/glapi_priv.h \
148	$(GLAPI_ASM_SOURCES) \
149	$(MAPI_UTIL_FILES)
150
151TESTS += glapi-test
152check_PROGRAMS += glapi-test
153
154glapi_test_SOURCES = glapi/tests/check_table.cpp
155glapi_test_CPPFLAGS = \
156	$(AM_CPPFLAGS) \
157	-I$(top_srcdir)/src/gtest/include
158
159glapi_test_LDADD = \
160	$(top_builddir)/src/mapi/glapi/libglapi.la \
161	$(top_builddir)/src/gtest/libgtest.la
162endif
163endif
164
165if HAVE_OPENGL_ES1
166TESTS += es1api/ABI-check
167
168BUILT_SOURCES += es1api/glapi_mapi_tmp.h
169
170pkgconfig_DATA += es1api/glesv1_cm.pc
171
172GLES_includedir = $(includedir)/GLES
173GLES_include_HEADERS = \
174	$(top_srcdir)/include/GLES/egl.h \
175	$(top_srcdir)/include/GLES/gl.h \
176	$(top_srcdir)/include/GLES/glext.h \
177	$(top_srcdir)/include/GLES/glplatform.h
178
179lib_LTLIBRARIES += es1api/libGLESv1_CM.la
180
181es1api_libGLESv1_CM_la_SOURCES = entry.c es1api/glapi_mapi_tmp.h
182es1api_libGLESv1_CM_la_CFLAGS = \
183	$(AM_CFLAGS) \
184	$(VISIBILITY_CFLAGS)
185es1api_libGLESv1_CM_la_CPPFLAGS = \
186	$(AM_CPPFLAGS) \
187	-DMAPI_MODE_BRIDGE \
188	-DMAPI_ABI_HEADER=\"es1api/glapi_mapi_tmp.h\"
189es1api_libGLESv1_CM_la_LIBADD = $(GLESv1_CM_LIB_DEPS)
190es1api_libGLESv1_CM_la_LDFLAGS = \
191	-no-undefined \
192	-version-number 1:1 \
193	$(GC_SECTIONS) \
194	$(LD_NO_UNDEFINED)
195
196es1api_libGLESv1_CM_la_LIBADD += shared-glapi/libglapi.la
197endif
198
199es1api/glapi_mapi_tmp.h: glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
200	$(MKDIR_GEN)
201	$(PYTHON_GEN) $(srcdir)/mapi_abi.py --printer es1api \
202		$(srcdir)/glapi/gen/gl_and_es_API.xml > $@
203
204if HAVE_OPENGL_ES2
205TESTS += es2api/ABI-check
206
207BUILT_SOURCES += es2api/glapi_mapi_tmp.h
208
209pkgconfig_DATA += es2api/glesv2.pc
210
211GLES2_includedir = $(includedir)/GLES2
212GLES2_include_HEADERS = \
213	$(top_srcdir)/include/GLES2/gl2.h \
214	$(top_srcdir)/include/GLES2/gl2ext.h \
215	$(top_srcdir)/include/GLES2/gl2platform.h
216GLES3_includedir = $(includedir)/GLES3
217GLES3_include_HEADERS = \
218	$(top_srcdir)/include/GLES3/gl3.h \
219	$(top_srcdir)/include/GLES3/gl31.h \
220	$(top_srcdir)/include/GLES3/gl32.h \
221	$(top_srcdir)/include/GLES3/gl3ext.h \
222	$(top_srcdir)/include/GLES3/gl3platform.h
223
224lib_LTLIBRARIES += es2api/libGLESv2.la
225
226es2api_libGLESv2_la_SOURCES = entry.c es2api/glapi_mapi_tmp.h
227es2api_libGLESv2_la_CFLAGS = \
228	$(AM_CFLAGS) \
229	$(VISIBILITY_CFLAGS)
230es2api_libGLESv2_la_CPPFLAGS = \
231	$(AM_CPPFLAGS) \
232	-DMAPI_MODE_BRIDGE \
233	-DMAPI_ABI_HEADER=\"es2api/glapi_mapi_tmp.h\"
234es2api_libGLESv2_la_LIBADD = $(GLESv2_LIB_DEPS)
235es2api_libGLESv2_la_LDFLAGS = \
236	-no-undefined \
237	-version-number 2 \
238	$(GC_SECTIONS) \
239	$(LD_NO_UNDEFINED)
240
241es2api_libGLESv2_la_LIBADD += shared-glapi/libglapi.la
242endif
243
244es2api/glapi_mapi_tmp.h: glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
245	$(MKDIR_GEN)
246	$(PYTHON_GEN) $(srcdir)/mapi_abi.py --printer es2api \
247		$(srcdir)/glapi/gen/gl_and_es_API.xml > $@
248
249include $(top_srcdir)/install-lib-links.mk
250
251if NEED_KHRPLATFORM
252khrdir = $(includedir)/KHR
253khr_HEADERS = $(top_srcdir)/include/KHR/khrplatform.h
254endif
255