1# These are the "official" xserver indent flags from utils/modular/x-indent.sh
2XORG_INDENT_FLAGS = -linux -bad -bap -blf -bli0 -cbi0 -cdw -nce -cs -i4 -lc80 -psl -nbbo \
3    -nbc -psl -nbfda -nut -nss -T pointer -T ScreenPtr -T ScrnInfoPtr -T pointer \
4    -T DeviceIntPtr -T DevicePtr -T ClientPtr -T CallbackListPtr \
5    -T CallbackProcPtr -T OsTimerPtr -T CARD32 -T CARD16 -T CARD8 \
6    -T INT32 -T INT16 -T INT8 -T Atom -T Time -T WindowPtr -T DrawablePtr \
7    -T PixmapPtr -T ColormapPtr -T CursorPtr -T Font -T XID -T Mask \
8    -T BlockHandlerProcPtr -T WakeupHandlerProcPtr -T RegionPtr \
9    -T InternalEvent -T GrabPtr -T Timestamp -T Bool -T TimeStamp \
10    -T xEvent -T DeviceEvent -T RawDeviceEvent -T GrabMask -T Window \
11    -T Drawable -T FontPtr -T CallbackPtr -T XIPropertyValuePtr \
12    -T GrabParameters -T deviceKeyButtonPointer -T TouchOwnershipEvent \
13    -T xGenericEvent -T DeviceChangedEvent -T GCPtr -T BITS32 \
14    -T xRectangle -T BoxPtr -T RegionRec -T ValuatorMask -T KeyCode \
15    -T KeySymsPtr -T XkbDescPtr -T InputOption -T XI2Mask -T DevUnion \
16    -T DevPrivateKey -T DevScreenPrivateKey -T PropertyPtr -T RESTYPE \
17    -T XkbAction -T XkbChangesPtr -T XkbControlsPtr -T PrivatePtr -T pmWait \
18    -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT
19
20
21MESA_DIR = $(top_builddir)/src/mesa
22MESA_GLAPI_DIR = $(top_builddir)/src/mapi/glapi
23MESA_MAPI_DIR = $(top_srcdir)/src/mapi
24MESA_GLX_DIR = $(top_builddir)/src/glx
25
26MESA_GLAPI_OUTPUTS = \
27	$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h \
28	$(MESA_GLAPI_DIR)/glprocs.h \
29	$(MESA_GLAPI_DIR)/glapitemp.h \
30	$(MESA_GLAPI_DIR)/glapitable.h
31
32if HAVE_APPLEDRI
33MESA_GLAPI_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_gentable.c
34endif
35if HAVE_WINDOWSDRI
36MESA_GLAPI_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_gentable.c
37endif
38
39MESA_GLAPI_ASM_OUTPUTS =
40if HAVE_X86_ASM
41if HAVE_X86_64_ASM
42MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86-64.S
43else
44MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86.S
45endif
46endif
47
48if HAVE_SPARC_ASM
49MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_sparc.S
50endif
51
52BUILT_SOURCES = \
53	$(MESA_GLAPI_OUTPUTS) \
54	$(MESA_GLAPI_ASM_OUTPUTS) \
55	$(MESA_DIR)/main/enums.c \
56	$(MESA_DIR)/main/api_exec.c \
57	$(MESA_DIR)/main/marshal_generated.c \
58	$(MESA_DIR)/main/marshal_generated.h \
59	$(MESA_DIR)/main/dispatch.h \
60	$(MESA_DIR)/main/remap_helper.h \
61	$(MESA_GLX_DIR)/indirect.c \
62	$(MESA_GLX_DIR)/indirect.h \
63	$(MESA_GLX_DIR)/indirect_init.c \
64	$(MESA_GLX_DIR)/indirect_size.h \
65	$(MESA_GLX_DIR)/indirect_size.c
66EXTRA_DIST= \
67	$(BUILT_SOURCES) \
68	$(MESA_GLAPI_DIR)/glapi_gentable.c \
69	$(MESA_GLAPI_DIR)/glapi_x86.S \
70	$(MESA_GLAPI_DIR)/glapi_x86-64.S \
71	$(MESA_GLAPI_DIR)/glapi_sparc.S \
72	$(COMMON_GLX) \
73	apiexec.py \
74	gl_apitemp.py \
75	gl_enums.py \
76	gl_genexec.py \
77	gl_gentable.py \
78	gl_marshal.py \
79	gl_marshal_h.py \
80	gl_procs.py \
81	gl_SPARC_asm.py \
82	gl_table.py \
83	gl_x86-64_asm.py \
84	gl_x86_asm.py \
85	glX_proto_recv.py \
86	glX_proto_send.py \
87	glX_proto_size.py \
88	glX_server_table.py \
89	marshal_XML.py \
90	remap_helper.py \
91	static_data.py \
92	SConscript \
93	gl_API.dtd \
94	meson.build
95
96######################################################################
97
98XORG_GLX_DIR = $(XORG_BASE)/glx
99XORG_GLAPI_DIR = $(XORG_BASE)/glx
100
101XORG_OUTPUTS = \
102	$(XORG_GLX_DIR)/indirect_dispatch.c \
103	$(XORG_GLX_DIR)/indirect_dispatch_swap.c \
104	$(XORG_GLX_DIR)/indirect_dispatch.h \
105	$(XORG_GLX_DIR)/indirect_reqsize.c \
106	$(XORG_GLX_DIR)/indirect_reqsize.h \
107	$(XORG_GLX_DIR)/indirect_size.h \
108	$(XORG_GLX_DIR)/indirect_size_get.c \
109	$(XORG_GLX_DIR)/indirect_size_get.h \
110	$(XORG_GLX_DIR)/indirect_table.c
111
112.PHONY: $(XORG_OUTPUTS)
113
114######################################################################
115
116API_XML = \
117	gl_API.xml \
118	es_EXT.xml \
119	gl_and_es_API.xml \
120	gl_and_glX_API.xml \
121	ARB_base_instance.xml \
122	ARB_blend_func_extended.xml \
123	ARB_bindless_texture.xml \
124	ARB_clear_buffer_object.xml \
125	ARB_clear_texture.xml \
126	ARB_clip_control.xml \
127	ARB_color_buffer_float.xml \
128	ARB_compressed_texture_pixel_storage.xml \
129	ARB_compute_shader.xml \
130	ARB_compute_variable_group_size.xml \
131	ARB_copy_buffer.xml \
132	ARB_copy_image.xml \
133	ARB_debug_output.xml \
134	ARB_depth_buffer_float.xml \
135	ARB_depth_clamp.xml \
136	ARB_direct_state_access.xml \
137	ARB_draw_buffers.xml \
138	ARB_draw_buffers_blend.xml \
139	ARB_draw_elements_base_vertex.xml \
140	ARB_draw_indirect.xml \
141	ARB_draw_instanced.xml \
142	ARB_ES2_compatibility.xml \
143	ARB_ES3_compatibility.xml \
144	ARB_framebuffer_no_attachments.xml \
145	ARB_framebuffer_object.xml \
146	ARB_get_program_binary.xml \
147	ARB_get_texture_sub_image.xml \
148	ARB_gl_spirv.xml \
149	ARB_gpu_shader_fp64.xml \
150	ARB_gpu_shader_int64.xml \
151	ARB_gpu_shader5.xml \
152	ARB_indirect_parameters.xml \
153	ARB_instanced_arrays.xml \
154	ARB_internalformat_query.xml \
155	ARB_internalformat_query2.xml \
156	ARB_invalidate_subdata.xml \
157	ARB_map_buffer_range.xml \
158	ARB_multi_bind.xml \
159	ARB_pipeline_statistics_query.xml \
160	ARB_program_interface_query.xml \
161	ARB_robustness.xml \
162	ARB_sample_shading.xml \
163	ARB_sampler_objects.xml \
164	ARB_seamless_cube_map.xml \
165	ARB_separate_shader_objects.xml \
166	ARB_shader_atomic_counters.xml \
167	ARB_shader_image_load_store.xml \
168	ARB_shader_subroutine.xml \
169	ARB_shader_storage_buffer_object.xml \
170	ARB_sparse_buffer.xml \
171	ARB_sync.xml \
172	ARB_tessellation_shader.xml \
173	ARB_texture_barrier.xml \
174	ARB_texture_buffer_object.xml \
175	ARB_texture_buffer_range.xml \
176	ARB_texture_compression_rgtc.xml \
177	ARB_texture_cube_map_array.xml \
178	ARB_texture_float.xml \
179	ARB_texture_gather.xml \
180	ARB_texture_multisample.xml \
181	ARB_texture_rgb10_a2ui.xml \
182	ARB_texture_rg.xml \
183	ARB_texture_storage_multisample.xml \
184	ARB_texture_storage.xml \
185	ARB_texture_view.xml \
186	ARB_uniform_buffer_object.xml \
187	ARB_vertex_array_object.xml \
188	ARB_vertex_attrib_64bit.xml \
189	ARB_vertex_attrib_binding.xml \
190	ARB_viewport_array.xml \
191	AMD_draw_buffers_blend.xml \
192	AMD_performance_monitor.xml \
193	ARB_vertex_type_2_10_10_10_rev.xml \
194	APPLE_object_purgeable.xml \
195	APPLE_vertex_array_object.xml \
196	EXT_draw_buffers2.xml \
197	EXT_external_objects.xml \
198	EXT_external_objects_fd.xml \
199	EXT_framebuffer_object.xml \
200	EXT_gpu_shader4.xml \
201	EXT_packed_depth_stencil.xml \
202	EXT_provoking_vertex.xml \
203	EXT_separate_shader_objects.xml \
204	EXT_texture_array.xml \
205	EXT_texture_integer.xml \
206	EXT_transform_feedback.xml \
207	EXT_window_rectangles.xml \
208	GREMEDY_string_marker.xml \
209	INTEL_performance_query.xml \
210	KHR_debug.xml \
211	KHR_context_flush_control.xml \
212	KHR_robustness.xml \
213	KHR_robustness_es.xml \
214	KHR_texture_compression_astc.xml \
215	MESA_tile_raster_order.xml \
216	NV_conditional_render.xml \
217	NV_primitive_restart.xml \
218	NV_texture_barrier.xml \
219	NV_vdpau_interop.xml \
220	OES_EGL_image.xml \
221	OES_fixed_point.xml \
222	OES_single_precision.xml \
223	OES_texture_compression_astc.xml \
224	GL3x.xml \
225	GL4x.xml
226
227COMMON = $(API_XML) \
228	gl_XML.py \
229	glX_XML.py \
230	license.py \
231	static_data.py \
232	typeexpr.py
233
234COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
235
236PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
237
238######################################################################
239
240xorg: check-xorg-source $(XORG_OUTPUTS)
241
242check-xorg-source:
243	@if ! test -d $(XORG_GLX_DIR); then \
244		echo "ERROR: Must specify path to xserver/ checkout. Set XORG_BASE env var."; \
245		if test x$(XORG_BASE) != x; then \
246			echo "'$(XORG_GLX_DIR)' does not exist."; \
247		fi; \
248		exit 1; \
249	fi
250
251clean-local:
252	-rm -f *~ *.pyo
253
254######################################################################
255
256$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c
257	$(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
258
259$(XORG_GLAPI_DIR)/dispatch.h: $(MESA_DIR)/main/dispatch.h
260	$(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
261
262$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h
263	$(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
264
265######################################################################
266
267$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON)
268	$(PYTHON_GEN) $(MESA_MAPI_DIR)/mapi_abi.py \
269		--printer glapi $(srcdir)/gl_and_es_API.xml > $@
270
271$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
272	$(PYTHON_GEN) $(srcdir)/gl_procs.py -c -f $(srcdir)/gl_and_es_API.xml > $@
273
274$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON)
275	$(PYTHON_GEN) $(srcdir)/gl_apitemp.py -f $(srcdir)/gl_and_es_API.xml > $@
276
277$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON)
278	$(PYTHON_GEN) $(srcdir)/gl_table.py -f $(srcdir)/gl_and_es_API.xml > $@
279
280$(MESA_GLAPI_DIR)/glapi_gentable.c: gl_gentable.py $(COMMON)
281	$(PYTHON_GEN) $(srcdir)/gl_gentable.py -f $(srcdir)/gl_and_es_API.xml > $@
282
283######################################################################
284
285$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON)
286	$(PYTHON_GEN) $(srcdir)/gl_x86_asm.py -f $(srcdir)/gl_and_es_API.xml > $@
287
288$(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON)
289	$(PYTHON_GEN) $(srcdir)/gl_x86-64_asm.py -f $(srcdir)/gl_and_es_API.xml > $@
290
291$(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON)
292	$(PYTHON_GEN) $(srcdir)/gl_SPARC_asm.py -f $(srcdir)/gl_and_es_API.xml > $@
293
294######################################################################
295
296$(MESA_DIR)/main/enums.c: gl_enums.py $(srcdir)/../registry/gl.xml
297	$(PYTHON_GEN) $(srcdir)/gl_enums.py -f $(srcdir)/../registry/gl.xml > $@
298
299$(MESA_DIR)/main/api_exec.c: gl_genexec.py apiexec.py $(COMMON)
300	$(PYTHON_GEN) $(srcdir)/gl_genexec.py -f $(srcdir)/gl_and_es_API.xml > $@
301
302$(MESA_DIR)/main/marshal_generated.c: gl_marshal.py marshal_XML.py $(COMMON)
303	$(PYTHON_GEN) $(srcdir)/gl_marshal.py -f $(srcdir)/gl_and_es_API.xml > $@
304
305$(MESA_DIR)/main/marshal_generated.h: gl_marshal_h.py marshal_XML.py $(COMMON)
306	$(PYTHON_GEN) $(srcdir)/gl_marshal_h.py -f $(srcdir)/gl_and_es_API.xml > $@
307
308$(MESA_DIR)/main/dispatch.h: gl_table.py $(COMMON)
309	$(PYTHON_GEN) $(srcdir)/gl_table.py -f $(srcdir)/gl_and_es_API.xml -m remap_table > $@
310
311$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON)
312	$(PYTHON_GEN) $(srcdir)/remap_helper.py -f $(srcdir)/gl_and_es_API.xml > $@
313
314######################################################################
315
316$(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX)
317	$(PYTHON_GEN) $(srcdir)/glX_proto_send.py -f $(srcdir)/gl_API.xml -m proto \
318	  | $(INDENT) $(INDENT_FLAGS) > $@
319
320$(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX)
321	$(PYTHON_GEN) $(srcdir)/glX_proto_send.py -f $(srcdir)/gl_API.xml -m init_h > $@
322
323$(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX)
324	$(PYTHON_GEN) $(srcdir)/glX_proto_send.py -f $(srcdir)/gl_API.xml -m init_c > $@
325
326$(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX)
327	$(PYTHON_GEN) $(srcdir)/glX_proto_size.py -f $(srcdir)/gl_API.xml -m size_h --only-set \
328	    --header-tag _INDIRECT_SIZE_H_ \
329	  | $(INDENT) $(INDENT_FLAGS) > $@
330
331$(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX)
332	$(PYTHON_GEN) $(srcdir)/glX_proto_size.py -f $(srcdir)/gl_API.xml -m size_c --only-set \
333	  | $(INDENT) $(INDENT_FLAGS) > $@
334
335######################################################################
336
337$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX)
338	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m dispatch_c \
339	| $(INDENT) $(XORG_INDENT_FLAGS) > $@
340
341$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX)
342	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m dispatch_c -s \
343	| $(INDENT) $(XORG_INDENT_FLAGS) > $@
344
345$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX)
346	$(PYTHON_GEN) $< -m dispatch_h -f $(srcdir)/gl_and_glX_API.xml -s \
347	| $(INDENT) $(XORG_INDENT_FLAGS) > $@
348
349$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX)
350	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m size_h \
351           --only-get --header-tag '_INDIRECT_SIZE_GET_H_' \
352	  | $(INDENT) $(XORG_INDENT_FLAGS) > $@
353
354$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX)
355	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m size_c \
356	  | $(INDENT) $(INDENT_FLAGS) > $@
357
358$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX)
359	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m reqsize_h \
360           --only-get --header-tag '_INDIRECT_SIZE_GET_H_' \
361	  | $(INDENT) $(XORG_INDENT_FLAGS) > $@
362
363$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX)
364	$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m reqsize_c \
365          | $(INDENT) $(XORG_INDENT_FLAGS) > $@
366
367$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX)
368	$(PYTHON_GEN) $< -f $(srcdir)/gl_and_glX_API.xml \
369	| $(INDENT) $(XORG_INDENT_FLAGS) > $@
370