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