xref: /netbsd-src/external/mit/xorg/lib/gallium/Makefile (revision ae87de8892f277bece3527c15b186ebcfa188227)
1# $NetBSD: Makefile,v 1.50 2023/07/16 22:20:54 rjs Exp $
2
3# Link the gallium mega driver.
4
5LIBISMODULE=	yes
6LIBISCXX=     yes
7
8.include <bsd.own.mk>
9
10.include "../mesa-which.mk"
11
12SHLIB_MAJOR=    0
13
14LIB=		gallium_dri
15DRIDIR=		${X11USRLIBDIR}/modules/dri
16DRIDEBUGDIR=	${DEBUGDIR}${X11USRLIBDIR}/modules/dri
17
18LLVM_INCLUDE_OBJDIR!=	cd ${NETBSDSRCDIR}/external/apache2/llvm/include && ${PRINTOBJDIR}
19
20CWARNFLAGS.clang += -Wno-atomic-alignment -Wno-unknown-warning-option -Wno-implicit-int-float-conversion
21
22CXXFLAGS+=	-std=c++14
23CFLAGS+=	-std=gnu11
24CPPFLAGS+=	-I${DESTDIR}${X11INCDIR}/libdrm \
25		-I${NETBSDSRCDIR}/external/apache2/llvm/dist/llvm/include \
26		-I${LLVM_INCLUDE_OBJDIR} -I${NETBSDSRCDIR}/external/apache2/llvm/config
27
28CFLAGS+=	-pthread
29LDFLAGS+=	-pthread
30
31# Reduce debugging for these extremely large objects.
32.if ${MKDEBUG:Uno} != "no"
33#CXXFLAGS+=	-g1
34#CFLAGS+=	-g1
35.endif
36
37GALLIUM_SUBDIRS= \
38	auxiliary \
39	auxiliary/cso_cache \
40	auxiliary/draw \
41	auxiliary/driver_ddebug \
42	auxiliary/driver_noop \
43	auxiliary/driver_rbug \
44	auxiliary/driver_trace \
45	auxiliary/hud \
46	auxiliary/indices \
47	auxiliary/nir \
48	auxiliary/os \
49	auxiliary/pipebuffer \
50	auxiliary/pipe-loader \
51	auxiliary/postprocess \
52	auxiliary/rbug \
53	auxiliary/renderonly \
54	auxiliary/rtasm \
55	auxiliary/tessellator \
56	auxiliary/tgsi \
57	auxiliary/translate \
58	auxiliary/util \
59	auxiliary/vl \
60	drivers/noop \
61	drivers/rbug \
62	drivers/softpipe \
63	winsys/sw/dri \
64	winsys/sw/kms-dri \
65	winsys/sw/null \
66	winsys/sw/wrapper \
67	frontends/dri
68
69GALLIUM_SUBDIRS_VDPAU=	\
70	frontends/vdpau
71
72GALLIUM_SUBDIRS_LLVMPIPE= \
73	auxiliary/gallivm \
74	drivers/llvmpipe
75
76GALLIUM_SUBDIRS_ATI= \
77	drivers/radeon \
78	drivers/radeonsi \
79	drivers/r300 \
80	drivers/r300/compiler \
81	drivers/r600 \
82	drivers/r600/sb \
83	drivers/r600/sfn \
84	winsys/radeon/drm \
85	winsys/amdgpu/drm
86
87GALLIUM_SUBDIRS_I915= \
88	drivers/i915 \
89	winsys/i915/drm
90
91GALLIUM_SUBDIRS_IRIS= \
92	drivers/iris \
93	winsys/iris/drm
94
95GALLIUM_SUBDIRS_CROCUS= \
96	drivers/crocus \
97	winsys/crocus/drm
98
99GALLIUM_SUBDIRS_NOUVEAU= \
100	drivers/nouveau \
101	drivers/nouveau/nv30 \
102	drivers/nouveau/nv50 \
103	drivers/nouveau/codegen \
104	drivers/nouveau/nvc0 \
105	winsys/nouveau/drm
106
107BUILD_RADEON=0
108BUILD_NOUVEAU=0
109BUILD_VDPAU=0
110BUILD_LLVMPIPE=0
111BUILD_I915=0
112BUILD_IRIS=0
113BUILD_CROCUS=0
114.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
115BUILD_I915=1
116#BUILD_IRIS=1
117#BUILD_CROCUS=1
118.endif
119.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "evbarm"
120BUILD_NOUVEAU=1
121. if ${MKLLVMRT} != "no"
122BUILD_RADEON=1
123. endif
124BUILD_VDPAU=1
125.endif
126
127.if ${MACHINE_ARCH} == "i386" || \
128    ${MACHINE_ARCH} == "x86_64" || \
129    ${MACHINE_ARCH} == "powerpc" || \
130    ${MACHINE_ARCH} == "powerpc64" || \
131    !empty(MACHINE_ARCH:Maarch64*) || \
132    !empty(MACHINE_ARCH:Mmips*) || \
133    !empty(MACHINE_ARCH:Mearm*) || \
134    !empty(MACHINE_ARCH:Marm*)
135. if ${MKLLVMRT} != "no"
136BUILD_LLVMPIPE=1
137. endif
138.endif
139
140DRIVERS=		kms_swrast swrast
141.if ${BUILD_RADEON} == 1
142DRIVERS+=		r600 r300 radeonsi
143GALLIUM_SUBDIRS+=	${GALLIUM_SUBDIRS_ATI}
144.endif
145.if ${BUILD_NOUVEAU} == 1
146DRIVERS+=		nouveau
147GALLIUM_SUBDIRS+=	${GALLIUM_SUBDIRS_NOUVEAU}
148.endif
149.if ${BUILD_VDPAU} == 1
150GALLIUM_SUBDIRS+=	${GALLIUM_SUBDIRS_VDPAU}
151.endif
152.if ${BUILD_I915} == 1
153GALLIUM_SUBDIRS+=	${GALLIUM_SUBDIRS_I915}
154.endif
155.if ${BUILD_IRIS} == 1
156GALLIUM_SUBDIRS+=	${GALLIUM_SUBDIRS_IRIS}
157.endif
158.if ${BUILD_CROCUS} == 1
159GALLIUM_SUBDIRS+=	${GALLIUM_SUBDIRS_CROCUS}
160.endif
161.if ${BUILD_LLVMPIPE} == 1
162GALLIUM_SUBDIRS+=	${GALLIUM_SUBDIRS_LLVMPIPE}
163.endif
164
165GALLIUM_SOURCES.auxiliary/cso_cache= \
166	cso_cache.c \
167	cso_context.c \
168	cso_hash.c
169
170GALLIUM_SOURCES.auxiliary/draw= \
171	draw_context.c \
172	draw_fs.c \
173	draw_gs.c \
174	draw_pipe_aaline.c \
175	draw_pipe_aapoint.c \
176	draw_pipe.c \
177	draw_pipe_clip.c \
178	draw_pipe_cull.c \
179	draw_pipe_flatshade.c \
180	draw_pipe_offset.c \
181	draw_pipe_pstipple.c \
182	draw_pipe_stipple.c \
183	draw_pipe_twoside.c \
184	draw_pipe_unfilled.c \
185	draw_pipe_user_cull.c \
186	draw_pipe_util.c \
187	draw_pipe_validate.c \
188	draw_pipe_vbuf.c \
189	draw_pipe_wide_line.c \
190	draw_pipe_wide_point.c \
191	draw_prim_assembler.c \
192	draw_pt.c \
193	draw_pt_emit.c \
194	draw_pt_fetch.c \
195	draw_pt_fetch_shade_emit.c \
196	draw_pt_fetch_shade_pipeline.c \
197	draw_pt_post_vs.c \
198	draw_pt_so_emit.c \
199	draw_pt_util.c \
200	draw_pt_vsplit.c \
201	draw_tess.c \
202	draw_vertex.c \
203	draw_vs.c \
204	draw_vs_exec.c \
205	draw_vs_variant.c
206
207.if ${MKLLVMRT} != "no"
208GALLIUM_SOURCES.auxiliary/draw+= \
209	draw_llvm.c \
210	draw_llvm_sample.c \
211	draw_pt_fetch_shade_pipeline_llvm.c \
212	draw_vs_llvm.c
213.endif
214
215GALLIUM_SOURCES.auxiliary/hud= \
216	font.c \
217	hud_context.c \
218	hud_cpu.c \
219	hud_nic.c \
220	hud_cpufreq.c \
221	hud_diskstat.c \
222	hud_sensors_temp.c \
223	hud_fps.c \
224	hud_driver_query.c
225GALLIUM_SOURCES.auxiliary/indices= \
226	u_primconvert.c
227GALLIUM_SOURCES.auxiliary/os= \
228	os_process.c
229GALLIUM_SOURCES.auxiliary/pipe-loader= \
230	pipe_loader.c \
231	pipe_loader_drm.c \
232	pipe_loader_sw.c
233
234.for _f in ${GALLIUM_SOURCES.auxiliary/pipe-loader}
235CPPFLAGS.${_f} +=	-DHAVE_PIPE_LOADER_KMS=1 \
236			-DHAVE_PIPE_LOADER_DRI=1 \
237			-DGALLIUM_STATIC_TARGETS=1 \
238			-I${X11SRCDIR.Mesa}/src/gallium/winsys \
239			-I${X11SRCDIR.Mesa}/src/loader \
240			-I${X11SRCDIR.Mesa}/../src/util
241.endfor
242
243GALLIUM_SOURCES.auxiliary/pipebuffer= \
244	pb_buffer_fenced.c \
245	pb_bufmgr_cache.c \
246	pb_bufmgr_debug.c \
247	pb_bufmgr_mm.c \
248	pb_bufmgr_slab.c \
249	pb_cache.c \
250	pb_slab.c \
251	pb_validate.c
252GALLIUM_SOURCES.auxiliary/postprocess= \
253	pp_celshade.c \
254	pp_colors.c \
255	pp_init.c \
256	pp_mlaa.c \
257	pp_run.c \
258	pp_program.c
259GALLIUM_SOURCES.auxiliary/rbug= \
260	rbug_connection.c \
261	RBUGrbug_context.c \
262	RBUGrbug_core.c \
263	rbug_demarshal.c \
264	rbug_texture.c \
265	rbug_shader.c
266GALLIUM_SOURCES.auxiliary/rtasm= \
267	rtasm_cpu.c \
268	rtasm_execmem.c \
269	rtasm_x86sse.c
270GALLIUM_SOURCES.auxiliary/tessellator= \
271	p_tessellator.cpp \
272	tessellator.cpp
273GALLIUM_SOURCES.auxiliary/tgsi= \
274	tgsi_aa_point.c \
275	tgsi_build.c \
276	tgsi_dump.c \
277	tgsi_exec.c \
278	tgsi_emulate.c \
279	tgsi_from_mesa.c \
280	tgsi_info.c \
281	tgsi_iterate.c \
282	tgsi_lowering.c \
283	tgsi_parse.c \
284	tgsi_point_sprite.c \
285	tgsi_sanity.c \
286	tgsi_scan.c \
287	tgsi_strings.c \
288	tgsi_text.c \
289	tgsi_transform.c \
290	tgsi_two_side.c \
291	tgsi_ureg.c \
292	tgsi_util.c
293GALLIUM_SOURCES.auxiliary/translate= \
294	translate.c \
295	translate_cache.c \
296	translate_generic.c \
297	translate_sse.c
298GALLIUM_SOURCES.auxiliary/util= \
299	os_misc.c \
300	u_async_debug.c \
301	u_bitmask.c \
302	u_blitter.c \
303	u_cache.c \
304	u_compute.c \
305	u_debug_flush.c \
306	u_debug_image.c \
307	u_dl.c \
308	u_draw.c \
309	u_draw_quad.c \
310	u_driconf.c \
311	u_dump_defines.c \
312	u_dump_state.c \
313	u_framebuffer.c \
314	u_gen_mipmap.c \
315	u_handle_table.c \
316	u_helpers.c \
317	u_index_modify.c \
318	u_linear.c \
319	u_live_shader_cache.c \
320	u_log.c \
321	u_network.c \
322	u_prim.c \
323	u_prim_restart.c \
324	u_pstipple.c \
325	u_resource.c \
326	u_sampler.c \
327	u_screen.c \
328	u_simple_shaders.c \
329	u_split_draw.c \
330	u_suballoc.c \
331	u_surface.c \
332	u_tests.c \
333	u_texture.c \
334	u_tile.c \
335	u_trace_gallium.c \
336	u_transfer.c \
337	u_transfer_helper.c \
338	u_threaded_context.c \
339	u_upload_mgr.c \
340	u_vbuf.c \
341	u_vertex_state_cache.c
342GALLIUM_SOURCES.auxiliary/nir = \
343	nir_draw_helpers.c \
344	nir_to_tgsi.c \
345	nir_to_tgsi_info.c \
346	tgsi_to_nir.c
347GALLIUM_SOURCES.auxiliary/vl= \
348	vl_bicubic_filter.c \
349	vl_compositor.c \
350	vl_compositor_cs.c \
351	vl_compositor_gfx.c \
352	vl_csc.c \
353	vl_decoder.c \
354	vl_deint_filter.c \
355	vl_idct.c \
356	vl_matrix_filter.c \
357	vl_mc.c \
358	vl_median_filter.c \
359	vl_mpeg12_bitstream.c \
360	vl_mpeg12_decoder.c \
361	vl_vertex_buffers.c \
362	vl_video_buffer.c \
363	vl_winsys_dri.c \
364	vl_zscan.c
365
366# Generated
367.PATH: ${X11SRCDIR.Mesa}/../src/gallium/auxiliary
368GALLIUM_SOURCES.auxiliary= \
369	u_indices_gen.c \
370	u_tracepoints.c \
371	u_unfilled_gen.c
372.for _f in ${GALLIUM_SOURCES.auxiliary/vl}
373CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/loader
374.endfor
375.for _f in ${GALLIUM_SOURCES.auxiliary/util}
376CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/../src/gallium/auxiliary
377.endfor
378.for _f in ${GALLIUM_SOURCES.auxiliary}
379CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/gallium/auxiliary/util
380CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/util
381.endfor
382
383GALLIUM_SOURCES.auxiliary/renderonly= \
384	renderonly.c
385
386GALLIUM_SOURCES.auxiliary/gallivm= \
387	lp_bld_arit.c \
388	lp_bld_arit_overflow.c \
389	lp_bld_assert.c \
390	lp_bld_bitarit.c \
391	lp_bld_const.c \
392	lp_bld_conv.c \
393	lp_bld_coro.c \
394	lp_bld_flow.c \
395	lp_bld_format_aos_array.c \
396	lp_bld_format_aos.c \
397	lp_bld_format_float.c \
398	lp_bld_format.c \
399	lp_bld_format_soa.c \
400	lp_bld_format_s3tc.c \
401	lp_bld_format_srgb.c \
402	lp_bld_format_yuv.c \
403	lp_bld_gather.c \
404	lp_bld_init.c \
405	lp_bld_intr.c \
406	lp_bld_ir_common.c \
407	lp_bld_logic.c \
408	lp_bld_misc.cpp \
409	lp_bld_nir.c \
410	lp_bld_nir_soa.c \
411	lp_bld_pack.c \
412	lp_bld_printf.c \
413	lp_bld_quad.c \
414	lp_bld_sample_aos.c \
415	lp_bld_sample.c \
416	lp_bld_sample_soa.c \
417	lp_bld_struct.c \
418	lp_bld_swizzle.c \
419	lp_bld_tgsi_action.c \
420	lp_bld_tgsi_aos.c \
421	lp_bld_tgsi.c \
422	lp_bld_tgsi_info.c \
423	lp_bld_tgsi_soa.c \
424	lp_bld_type.c
425	#lp_bld_debug.cpp
426
427.for _f in ${GALLIUM_SOURCES.auxiliary/gallivm}
428CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/gallium/auxiliary/util
429.endfor
430
431CPPFLAGS.lp_texture.c += -I${X11SRCDIR.Mesa}/../src
432
433GALLIUM_SOURCES.auxiliary/driver_ddebug = \
434        dd_context.c \
435	dd_draw.c \
436	dd_screen.c
437
438GALLIUM_SOURCES.auxiliary/driver_noop = \
439        noop_pipe.c \
440        noop_state.c
441
442GALLIUM_SOURCES.auxiliary/driver_trace = \
443        tr_context.c \
444        tr_dump.c \
445        tr_dump_state.c \
446        tr_screen.c \
447        tr_texture.c
448
449GALLIUM_SOURCES.auxiliary/driver_rbug = \
450        DRIVERrbug_core.c \
451        DRIVERrbug_context.c \
452        rbug_objects.c \
453        rbug_screen.c
454# Conflicts with auxiliary/rbug/ files
455BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/auxiliary/rbug/rbug_core.c		RBUGrbug_core.c
456BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/auxiliary/rbug/rbug_context.c		RBUGrbug_context.c
457BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/auxiliary/driver_rbug/rbug_core.c	DRIVERrbug_core.c
458BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/auxiliary/driver_rbug/rbug_context.c	DRIVERrbug_context.c
459CPPFLAGS.DRIVERrbug_core.c+=	-I${X11SRCDIR.Mesa}/src/gallium/auxiliary
460CPPFLAGS.DRIVERrbug_core.c+=	-I${X11SRCDIR.Mesa}/src/gallium/auxiliary/driver_rbug
461CPPFLAGS.DRIVERrbug_core.c+=	-I${X11SRCDIR.Mesa}/src/gallium/drivers
462CPPFLAGS.DRIVERrbug_context.c+=	-I${X11SRCDIR.Mesa}/src/gallium/auxiliary
463CPPFLAGS.DRIVERrbug_context.c+=	-I${X11SRCDIR.Mesa}/src/gallium/auxiliary/driver_rbug
464CPPFLAGS.DRIVERrbug_context.c+=	-I${X11SRCDIR.Mesa}/src/gallium/drivers
465
466GALLIUM_SOURCES.drivers/i915= \
467	i915_blit.c \
468	i915_clear.c \
469	i915_context.c \
470	i915_debug.c \
471	i915_debug_fp.c \
472	i915_flush.c \
473	i915_fpc_emit.c \
474	i915_fpc_optimize.c \
475	i915_fpc_translate.c \
476	i915_nir.c \
477	i915_prim_emit.c \
478	i915_prim_vbuf.c \
479	i915_query.c \
480	i915_resource_buffer.c \
481	i915_resource.c \
482	i915_resource_texture.c \
483	i915_screen.c \
484	i915_state.c \
485	i915_state_derived.c \
486	i915_state_dynamic.c \
487	i915_state_emit.c \
488	i915_state_fpc.c \
489	i915_state_immediate.c \
490	i915_state_sampler.c \
491	i915_state_static.c \
492	i915_surface.c
493
494GALLIUM_SOURCES.winsys/i915/drm= \
495	i915_drm_batchbuffer.c \
496	i915_drm_buffer.c \
497	i915_drm_fence.c \
498	i915_drm_winsys.c
499
500GALLIUM_SOURCES.drivers/iris= \
501	iris_batch.c \
502	iris_binder.c \
503	iris_blit.c \
504	iris_border_color.c \
505	iris_bufmgr.c \
506	iris_clear.c \
507	iris_context.c \
508	iris_disk_cache.c \
509	iris_draw.c \
510	iris_fence.c \
511	iris_fine_fence.c \
512	iris_formats.c \
513	iris_measure.c \
514	iris_monitor.c \
515	iris_perf.c \
516	iris_performance_query.c \
517	iris_pipe_control.c \
518	iris_program.c \
519	iris_program_cache.c \
520	iris_resolve.c \
521	iris_resource.c \
522	iris_screen.c
523
524GALLIUM_SOURCES.winsys/iris/drm= \
525	iris_drm_winsys.c
526
527IRIS_GENS_BLORP=	80 90 110 120 125
528
529.for _gen in ${IRIS_GENS_BLORP}
530BUILDSYMLINKS+=		${X11SRCDIR.Mesa}/src/gallium/drivers/iris/iris_blorp.c ${_gen}_iris_blorp.c
531BUILDSYMLINKS+=		${X11SRCDIR.Mesa}/src/gallium/drivers/iris/iris_query.c ${_gen}_iris_query.c
532BUILDSYMLINKS+=		${X11SRCDIR.Mesa}/src/gallium/drivers/iris/iris_state.c ${_gen}_iris_state.c
533GALLIIUM_SOURCES.drivers/iris+=	${_gen}_iris_blorp.c ${_gen}_iris_query.c ${_gen}_iris_state.c
534
535CPPFLAGS.${_gen}_iris_blorp.c+=		-DGFX_VERx10=${_gen}
536CPPFLAGS.${_gen}_iris_query.c+=		-DGFX_VERx10=${_gen}
537CPPFLAGS.${_gen}_iris_state.c+=		-DGFX_VERx10=${_gen}
538.endfor
539
540.for _f in ${GALLIUM_SOURCES.drivers/iris}
541CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/intel
542.endfor
543
544GALLIUM_SOURCES.drivers/crocus= \
545	crocus_batch.c \
546	crocus_blit.c \
547	crocus_blorp.c \
548	crocus_blt.c \
549	crocus_bufmgr.c \
550	crocus_clear.c \
551	crocus_context.c \
552	crocus_disk_cache.c \
553	crocus_draw.c \
554	crocus_fence.c \
555	crocus_fine_fence.c \
556	crocus_formats.c \
557	crocus_monitor.c \
558	crocus_pipe_control.c \
559	crocus_program.c \
560	crocus_program_cache.c \
561	crocus_query.c \
562	crocus_resolve.c \
563	crocus_resource.c \
564	crocus_screen.c \
565	crocus_state.c
566
567GALLIUM_SOURCES.winsys/crocus/drm= \
568	crocus_drm_winsys.c
569
570CROCUS_GENS_BLORP=	40 45 50 60 70 75 80
571
572.for _gen in ${CROCUS_GENS_BLORP}
573BUILDSYMLINKS+=		${X11SRCDIR.Mesa}/src/gallium/drivers/crocus/crocus_blorp.c ${_gen}_crocus_blorp.c
574BUILDSYMLINKS+=		${X11SRCDIR.Mesa}/src/gallium/drivers/crocus/crocus_query.c ${_gen}_crocus_query.c
575BUILDSYMLINKS+=		${X11SRCDIR.Mesa}/src/gallium/drivers/crocus/crocus_state.c ${_gen}_crocus_state.c
576BUILDSYMLINKS+=		${X11SRCDIR.Mesa}/src/gallium/drivers/crocus/crocus_blt.c ${_gen}_crocus_bltec
577GALLIIUM_SOURCES.drivers/iris+=	${_gen}_crocus_blorp.c ${_gen}_crocus_query.c ${_gen}_crocus_state.c ${_gen}_crocus_blt.c
578
579CPPFLAGS.${_gen}_crocus_blorp.c+=	-DGFX_VERx10=${_gen}
580CPPFLAGS.${_gen}_crocus_query.c+=	-DGFX_VERx10=${_gen}
581CPPFLAGS.${_gen}_crocus_state.c+=	-DGFX_VERx10=${_gen}
582CPPFLAGS.${_gen}_crocus_blt.c+=		-DGFX_VERx10=${_gen}
583.endfor
584
585.for _f in ${GALLIUM_SOURCES.drivers/crocus}
586CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/intel
587.endfor
588
589# Conflicts with r600/radeon_video.c and radeon/radeon_video.c
590BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/r600/radeon_video.c r600_radeon_video.c
591BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeon/radeon_video.c radeon_radeon_video.c
592BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/r600/radeon_vce.c r600_radeon_vce.c
593BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeon/radeon_vce.c radeon_radeon_vce.c
594BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/r600/radeon_uvd.c r600_radeon_uvd.c
595BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeon/radeon_uvd.c radeon_radeon_uvd.c
596
597GALLIUM_SOURCES.drivers/radeon = \
598        cayman_msaa.c \
599        r600_buffer_common.c \
600        r600_pipe_common.c \
601        r600_query.c \
602        r600_streamout.c \
603        r600_texture.c \
604        radeon_radeon_uvd.c \
605	radeon_uvd_enc.c \
606	radeon_uvd_enc_1_1.c \
607        radeon_vce_40_2_2.c \
608	radeon_vce_50.c \
609	radeon_vce_52.c \
610	radeon_vcn_dec.c \
611	radeon_vcn_dec_jpeg.c \
612	radeon_vcn_enc.c \
613	radeon_vcn_enc_1_2.c \
614	radeon_vcn_enc_2_0.c \
615	radeon_vcn_enc_3_0.c \
616        radeon_radeon_vce.c \
617        radeon_radeon_video.c \
618
619GALLIUM_SOURCES.drivers/r600 = \
620	eg_debug.c \
621	r600_gpu_load.c \
622	r600_perfcounter.c \
623	r600_radeon_vce.c \
624	r600_radeon_video.c \
625        compute_memory_pool.c \
626	r600_viewport.c \
627        eg_asm.c \
628        evergreen_compute.c \
629        evergreen_hw_context.c \
630        evergreen_state.c \
631        r600_asm.c \
632        r600_blit.c \
633	r600_dump.c \
634        r600_hw_context.c \
635        r600_isa.c \
636        r600_pipe.c \
637        r600_shader.c \
638        r600_state.c \
639        r600_state_common.c \
640        r600_uvd.c \
641        r600_radeon_uvd.c \
642	r600_test_dma.c \
643        r700_asm.c
644GALLIUM_SOURCES.drivers/r600/sb = \
645        sb_bc_builder.cpp \
646        sb_bc_decoder.cpp \
647        sb_bc_dump.cpp \
648        sb_bc_finalize.cpp \
649        sb_bc_parser.cpp \
650        sb_context.cpp \
651        sb_core.cpp \
652        sb_dce_cleanup.cpp \
653        sb_def_use.cpp \
654        sb_dump.cpp \
655        sb_expr.cpp \
656        sb_gcm.cpp \
657        sb_gvn.cpp \
658        sb_if_conversion.cpp \
659        sb_ir.cpp \
660        sb_liveness.cpp \
661        sb_pass.cpp \
662        sb_peephole.cpp \
663        sb_psi_ops.cpp \
664        sb_ra_checker.cpp \
665        sb_ra_coalesce.cpp \
666        sb_ra_init.cpp \
667        sb_sched.cpp \
668        sb_shader.cpp \
669        sb_ssa_builder.cpp \
670        sb_valtable.cpp
671GALLIUM_SOURCES.drivers/r600/sfn = \
672	sfn_nir_vectorize_vs_inputs.c \
673	sfn_alu_defines.cpp \
674	sfn_liverange.cpp \
675	sfn_callstack.cpp \
676	sfn_nir.cpp \
677	sfn_conditionaljumptracker.cpp \
678	sfn_nir_legalize_image_load_store.cpp \
679	sfn_debug.cpp \
680	sfn_nir_lower_64bit.cpp \
681	sfn_emitaluinstruction.cpp \
682	sfn_nir_lower_alu.cpp \
683	sfn_emitinstruction.cpp \
684	sfn_nir_lower_fs_out_to_vector.cpp \
685	sfn_emitssboinstruction.cpp \
686	sfn_nir_lower_tess_io.cpp \
687	sfn_emittexinstruction.cpp \
688	sfn_instruction_alu.cpp \
689	sfn_shader_base.cpp \
690	sfn_instruction_base.cpp \
691	sfn_shader_compute.cpp \
692	sfn_instruction_block.cpp \
693	sfn_shader_fragment.cpp \
694	sfn_instruction_cf.cpp \
695	sfn_shader_geometry.cpp \
696	sfn_instruction_export.cpp \
697	sfn_shader_tcs.cpp \
698	sfn_instruction_fetch.cpp \
699	sfn_shader_tess_eval.cpp \
700	sfn_instruction_gds.cpp \
701	sfn_shader_vertex.cpp \
702	sfn_instruction_lds.cpp \
703	sfn_shaderio.cpp \
704	sfn_instruction_misc.cpp \
705	sfn_value.cpp \
706	sfn_instruction_tex.cpp \
707	sfn_value_gpr.cpp \
708	sfn_instructionvisitor.cpp \
709	sfn_valuepool.cpp \
710	sfn_ir_to_assembly.cpp \
711	sfn_vertexstageexport.cpp
712
713GALLIUM_SOURCES.drivers/r300 = \
714	r300_blit.c \
715	r300_chipset.c \
716	r300_context.c \
717	r300_debug.c \
718	r300_emit.c \
719	r300_flush.c \
720	r300_fs.c \
721	r300_hyperz.c \
722	r300_query.c \
723	r300_render.c \
724	r300_render_stencilref.c \
725	r300_render_translate.c \
726	r300_resource.c \
727	r300_screen_buffer.c \
728	r300_screen.c \
729	r300_state.c \
730	r300_state_derived.c \
731	r300_texture.c \
732	r300_texture_desc.c \
733	r300_tgsi_to_rc.c \
734	r300_transfer.c \
735	r300_vs.c \
736	r300_vs_draw.c
737
738GALLIUM_SOURCES.drivers/r300/compiler = \
739	memory_pool.c \
740	r300_fragprog.c \
741	r300_fragprog_emit.c \
742	r300_fragprog_swizzle.c \
743	r3xx_fragprog.c \
744	r3xx_vertprog.c \
745	r3xx_vertprog_dump.c \
746	r500_fragprog.c \
747	r500_fragprog_emit.c \
748	radeon_code.c \
749	radeon_compiler.c \
750	radeon_compiler_util.c \
751	radeon_dataflow.c \
752	radeon_dataflow_deadcode.c \
753	radeon_dataflow_swizzles.c \
754	radeon_emulate_branches.c \
755	radeon_emulate_loops.c \
756	radeon_inline_literals.c \
757	radeon_list.c \
758	radeon_opcodes.c \
759	radeon_optimize.c \
760	radeon_pair_dead_sources.c \
761	radeon_pair_regalloc.c \
762	radeon_pair_schedule.c \
763	radeon_pair_translate.c \
764	radeon_program_alu.c \
765	radeon_program.c \
766	radeon_program_pair.c \
767	radeon_program_print.c \
768	radeon_program_tex.c \
769	radeon_remove_constants.c \
770	radeon_rename_regs.c \
771	radeon_variable.c \
772	radeon_vert_fc.c
773
774GALLIUM_SOURCES.drivers/radeonsi = \
775	gfx10_query.c \
776	gfx10_shader_ngg.c \
777	si_blit.c \
778	si_buffer.c \
779	si_clear.c \
780	si_compute.c \
781	si_compute_blit.c \
782	si_cp_dma.c \
783	si_cp_reg_shadowing.c \
784	si_debug.c \
785	si_descriptors.c \
786	si_fence.c \
787	si_get.c \
788	si_gfx_cs.c \
789	si_gpu_load.c \
790	si_pipe.c \
791	si_pm4.c \
792	si_perfcounter.c \
793	si_query.c \
794	si_nir_optim.c \
795	si_shader.c \
796	si_sdma_copy_image.c \
797	si_shader_llvm.c \
798	si_shader_llvm_gs.c \
799	si_shader_llvm_ps.c \
800	si_shader_llvm_resources.c \
801	si_shader_llvm_tess.c \
802	si_shader_llvm_vs.c \
803	si_shader_nir.c \
804	si_shaderlib_nir.c \
805	si_shaderlib_tgsi.c \
806	si_sqtt.c \
807	si_state.c \
808	si_state_binning.c \
809	si_state_draw_gfx6.cpp \
810	si_state_draw_gfx7.cpp \
811	si_state_draw_gfx8.cpp \
812	si_state_draw_gfx9.cpp \
813	si_state_draw_gfx10.cpp \
814	si_state_draw_gfx103.cpp \
815	si_state_msaa.c \
816	si_state_shaders.c \
817	si_state_streamout.c \
818	si_state_viewport.c \
819	si_test_blit.c \
820	si_test_dma_perf.c \
821	si_texture.c \
822	si_uvd.c
823
824.PATH:		${X11SRCDIR.Mesa}/src/gallium/drivers/radeonsi
825BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeonsi/si_state_draw.cpp si_state_draw_gfx6.cpp
826BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeonsi/si_state_draw.cpp si_state_draw_gfx7.cpp
827BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeonsi/si_state_draw.cpp si_state_draw_gfx8.cpp
828BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeonsi/si_state_draw.cpp si_state_draw_gfx9.cpp
829BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeonsi/si_state_draw.cpp si_state_draw_gfx10.cpp
830BUILDSYMLINKS+=	${X11SRCDIR.Mesa}/src/gallium/drivers/radeonsi/si_state_draw.cpp si_state_draw_gfx103.cpp
831
832CPPFLAGS.si_state_draw_gfx6.cpp += -DGFX_VER=6
833CPPFLAGS.si_state_draw_gfx7.cpp += -DGFX_VER=7
834CPPFLAGS.si_state_draw_gfx8.cpp += -DGFX_VER=8
835CPPFLAGS.si_state_draw_gfx9.cpp += -DGFX_VER=9
836CPPFLAGS.si_state_draw_gfx10.cpp += -DGFX_VER=10
837CPPFLAGS.si_state_draw_gfx103.cpp += -DGFX_VER=103
838
839.for _f in ${GALLIUM_SOURCES.drivers/radeon}
840CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/gallium/drivers/radeon
841.endfor
842
843.for _f in ${GALLIUM_SOURCES.drivers/r300} ${GALLIUM_SOURCES.drivers/r300/compiler}
844CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/gallium/drivers/r300 \
845			-I${X11SRCDIR.Mesa}/src/gallium/drivers/r300/compiler
846.endfor
847
848.for _f in ${GALLIUM_SOURCES.drivers/r600} ${GALLIUM_SOURCES.drivers/r600/sb} ${GALLIUM_SOURCES.drivers/radeonsi} ${GALLIUM_SOURCES.drivers/r600/sfn}
849CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/gallium/drivers/r600
850CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/../src/gallium/drivers/r600
851CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/amd/common
852CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/../src/amd/common
853CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/amd/llvm
854.endfor
855
856.for _f in ${GALLIUM_SOURCES.drivers/radeon}
857CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/gallium/drivers/radeonsi
858CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/amd/common
859CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/amd/llvm
860.endfor
861
862GALLIUM_SOURCES.drivers/nouveau = \
863	nouveau_buffer.c \
864	nouveau_fence.c \
865	nouveau_heap.c \
866	nouveau_mm.c \
867	nouveau_screen.c \
868	nouveau_video.c \
869	nouveau_vp3_video_bsp.c \
870	nouveau_vp3_video.c \
871	nouveau_vp3_video_vp.c
872
873GALLIUM_SOURCES.drivers/nouveau/nv30 = \
874	nv30_clear.c \
875	nv30_context.c \
876	nv30_draw.c \
877	nv30_format.c \
878	nv30_fragprog.c \
879	nv30_fragtex.c \
880	nv30_miptree.c \
881	nv30_push.c \
882	nv30_query.c \
883	nv30_resource.c \
884	nv30_screen.c \
885	nv30_state.c \
886	nv30_state_validate.c \
887	nv30_texture.c \
888	nv30_transfer.c \
889	nv30_vbo.c \
890	nv30_vertprog.c \
891	nv40_verttex.c \
892	nvfx_fragprog.c \
893	nvfx_vertprog.c
894
895GALLIUM_SOURCES.drivers/nouveau/nv50 = \
896	nv50_compute.c \
897	nv50_context.c \
898	nv50_formats.c \
899	nv50_miptree.c \
900	nv50_program.c \
901	nv50_push.c \
902	nv50_query.c \
903	nv50_query_hw.c \
904	nv50_query_hw_metric.c \
905	nv50_query_hw_sm.c \
906	nv50_resource.c \
907	nv50_screen.c \
908	nv50_shader_state.c \
909	nv50_state.c \
910	nv50_state_validate.c \
911	nv50_surface.c \
912	nv50_tex.c \
913	nv50_transfer.c \
914	nv50_vbo.c \
915	nv84_video_bsp.c \
916	nv84_video.c \
917	nv84_video_vp.c \
918	nv98_video_bsp.c \
919	nv98_video.c \
920	nv98_video_ppp.c \
921	nv98_video_vp.c
922
923GALLIUM_SOURCES.drivers/nouveau/codegen = \
924	nv50_ir.cpp \
925	nv50_ir_bb.cpp \
926	nv50_ir_build_util.cpp \
927	nv50_ir_emit_gk110.cpp \
928	nv50_ir_emit_gm107.cpp \
929	nv50_ir_emit_gv100.cpp \
930	nv50_ir_emit_nv50.cpp \
931	nv50_ir_emit_nvc0.cpp \
932	nv50_ir_from_common.cpp \
933	nv50_ir_from_nir.cpp \
934	nv50_ir_from_tgsi.cpp \
935	nv50_ir_graph.cpp \
936	nv50_ir_lowering_gm107.cpp \
937	nv50_ir_lowering_gv100.cpp \
938	nv50_ir_lowering_helper.cpp \
939	nv50_ir_lowering_nv50.cpp \
940	nv50_ir_lowering_nvc0.cpp \
941	nv50_ir_peephole.cpp \
942	nv50_ir_print.cpp \
943	nv50_ir_ra.cpp \
944	nv50_ir_serialize.cpp \
945	nv50_ir_ssa.cpp \
946	nv50_ir_target.cpp \
947	nv50_ir_target_gv100.cpp \
948	nv50_ir_target_nv50.cpp \
949	nv50_ir_util.cpp \
950	nv50_ir_target_gm107.cpp \
951	nv50_ir_target_nvc0.cpp
952
953GALLIUM_SOURCES.drivers/nouveau/nvc0 = \
954	nvc0_compute.c \
955	nvc0_context.c \
956	nvc0_formats.c \
957	nvc0_miptree.c \
958	nvc0_resource.c \
959	nvc0_screen.c \
960	nvc0_state.c \
961	nvc0_state_validate.c \
962	nvc0_surface.c \
963	nvc0_tex.c \
964	nvc0_transfer.c \
965	nvc0_vbo.c \
966	nvc0_vbo_translate.c \
967	nvc0_program.c \
968	nvc0_shader_state.c \
969	nvc0_query.c \
970	nvc0_query_hw.c \
971	nvc0_query_hw_metric.c \
972	nvc0_query_hw_sm.c \
973	nvc0_query_sw.c \
974	nve4_compute.c \
975	nvc0_video.c \
976	nvc0_video_bsp.c \
977	nvc0_video_vp.c \
978	nvc0_video_ppp.c
979
980GALLIUM_SOURCES.winsys/nouveau/drm = \
981        nouveau_drm_winsys.c
982
983.for _f in ${GALLIUM_SOURCES.drivers/nouveau} \
984	   ${GALLIUM_SOURCES.drivers/nouveau/nv30} \
985	   ${GALLIUM_SOURCES.drivers/nouveau/nv50} \
986	   ${GALLIUM_SOURCES.drivers/nouveau/codegen} \
987	   ${GALLIUM_SOURCES.drivers/nouveau/nvc0} \
988	   ${GALLIUM_SOURCES.winsys/nouveau/drm}
989CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/gallium/drivers/nouveau \
990			-I${DESTDIR}${X11INCDIR}/libdrm/nouveau
991.endfor
992
993GALLIUM_SOURCES.winsys/radeon/drm = \
994        radeon_drm_bo.c \
995        radeon_drm_cs.c \
996	radeon_drm_surface.c \
997        radeon_drm_winsys.c
998
999GALLIUM_SOURCES.winsys/amdgpu/drm = \
1000	amdgpu_bo.c \
1001	amdgpu_cs.c \
1002	amdgpu_surface.c \
1003	amdgpu_winsys.c
1004
1005.for _f in ${GALLIUM_SOURCES.winsys/amdgpu/drm}
1006CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/amd
1007CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/amd/common
1008CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/../src/amd/common
1009CPPFLAGS.${_f} +=	-I${X11SRCDIR.Mesa}/src/amd/llvm
1010.endfor
1011
1012GALLIUM_SOURCES.frontends/vdpau = \
1013	bitmap.c \
1014	decode.c \
1015	device.c \
1016	ftab.c \
1017	htab.c \
1018	mixer.c \
1019	output.c \
1020	preemption.c \
1021	presentation.c \
1022	query.c \
1023	surface.c
1024
1025GALLIUM_SOURCES.drivers/llvmpipe = \
1026	lp_bld_alpha.c \
1027	lp_bld_blend_aos.c \
1028	lp_bld_blend.c \
1029	lp_bld_blend_logicop.c \
1030	lp_bld_depth.c \
1031	lp_bld_interp.c \
1032	lp_clear.c \
1033	lp_context.c \
1034	lp_cs_tpool.c \
1035	lp_draw_arrays.c \
1036	lp_fence.c \
1037	lp_flush.c \
1038	lp_jit.c \
1039	lp_linear.c \
1040	lp_linear_fastpath.c \
1041	lp_linear_interp.c \
1042	lp_linear_sampler.c \
1043	lp_memory.c \
1044	lp_perf.c \
1045	lp_query.c \
1046	lp_rast.c \
1047	lp_rast_debug.c \
1048	lp_rast_linear.c \
1049	lp_rast_linear_fallback.c \
1050	lp_rast_rect.c \
1051	lp_rast_tri.c \
1052	lp_scene.c \
1053	lp_scene_queue.c \
1054	lp_screen.c \
1055	lp_setup.c \
1056	lp_setup_analysis.c \
1057	lp_setup_line.c \
1058	lp_setup_point.c \
1059	lp_setup_rect.c \
1060	lp_setup_tri.c \
1061	lp_setup_vbuf.c \
1062	lp_state_blend.c \
1063	lp_state_clip.c \
1064	lp_state_cs.c \
1065	lp_state_derived.c \
1066	lp_state_fs.c \
1067	lp_state_fs_analysis.c \
1068	lp_state_fs_fastpath.c \
1069	lp_state_fs_linear.c \
1070	lp_state_fs_linear_llvm.c \
1071	lp_state_gs.c \
1072	lp_state_rasterizer.c \
1073	lp_state_sampler.c \
1074	lp_state_setup.c \
1075	lp_state_so.c \
1076	lp_state_surface.c \
1077	lp_state_tess.c \
1078	lp_state_vertex.c \
1079	lp_state_vs.c \
1080	lp_surface.c \
1081	lp_tex_sample.c \
1082	lp_texture.c
1083
1084GALLIUM_SOURCES.drivers/softpipe = \
1085	sp_buffer.c \
1086	sp_clear.c \
1087	sp_context.c \
1088	sp_compute.c \
1089	sp_draw_arrays.c \
1090	sp_fence.c \
1091	sp_flush.c \
1092	sp_fs_exec.c \
1093	sp_image.c \
1094	sp_prim_vbuf.c \
1095	sp_quad_blend.c \
1096	sp_quad_depth_test.c \
1097	sp_quad_fs.c \
1098	sp_quad_pipe.c \
1099	sp_quad_stipple.c \
1100	sp_query.c \
1101	sp_screen.c \
1102	sp_setup.c \
1103	sp_state_blend.c \
1104	sp_state_clip.c \
1105	sp_state_derived.c \
1106	sp_state_image.c \
1107	sp_state_rasterizer.c \
1108	sp_state_sampler.c \
1109	sp_state_shader.c \
1110	sp_state_so.c \
1111	sp_state_surface.c \
1112	sp_state_vertex.c \
1113	sp_surface.c \
1114	sp_tex_sample.c \
1115	sp_tex_tile_cache.c \
1116	sp_texture.c \
1117	sp_tile_cache.c
1118
1119GALLIUM_SOURCES.winsys/sw/null = \
1120	null_sw_winsys.c
1121
1122GALLIUM_SOURCES.winsys/sw/wrapper = \
1123	wrapper_sw_winsys.c
1124
1125GALLIUM_SOURCES.winsys/sw/dri = \
1126	dri_sw_winsys.c
1127
1128GALLIUM_SOURCES.winsys/sw/kms-dri = \
1129	kms_dri_sw_winsys.c
1130
1131GALLIUM_SOURCES.frontends/dri = \
1132        dri_context.c \
1133        dri_drawable.c \
1134	dri_helpers.c \
1135        dri_query_renderer.c \
1136        dri_screen.c \
1137	drisw.c \
1138	dri2.c
1139
1140# missing
1141CPPFLAGS+=	\
1142	-DGALLIUM_SOFTPIPE \
1143	-DGALLIUM_STATIC_TARGETS=1 \
1144	-DMESA_EGL_NO_X11_HEADERS
1145
1146.for _d in ${GALLIUM_SUBDIRS}
1147SRCS+=	${GALLIUM_SOURCES.${_d}}
1148.PATH: ${X11SRCDIR.Mesa}/src/gallium/${_d}
1149. for _s in ${GALLIUM_SOURCES.${_d}}
1150CPPFLAGS.${_s}+= -I${X11SRCDIR.Mesa}/src/gallium/${_d}
1151. endfor
1152.endfor
1153
1154#. if defined(${GALLIUM_SOURCES.${_d}})
1155#SRCS+=	${GALLIUM_SOURCES.${_d}}
1156#. endif
1157
1158.include "../libloader.mk"
1159
1160.if ${BUILD_RADEON} == 1
1161CFLAGS+=	-pthread
1162LDFLAGS+=	-pthread
1163.endif
1164
1165LIBDPLIBS+=	X11-xcb         ${.CURDIR}/../libX11/libX11-xcb
1166LIBDPLIBS+=	xcb-dri2        ${.CURDIR}/../libxcb/dri2
1167LIBDPLIBS+=	xcb		${.CURDIR}/../libxcb/libxcb
1168.if ${BUILD_RADEON} == 1 || ${BUILD_NOUVEAU} == 1
1169LIBDPLIBS+= 	drm		${.CURDIR}/../libdrm
1170.if ${BUILD_I915} == 1
1171LIBDPLIBS+= 	drm_intel	${.CURDIR}/../libdrm_intel
1172.endif
1173.if ${BUILD_IRIS} == 1
1174LIBDPLIBS+= 	drm_intel	${.CURDIR}/../libdrm_intel
1175.endif
1176.if ${BUILD_CROCUS} == 1
1177LIBDPLIBS+= 	drm_intel	${.CURDIR}/../libdrm_intel
1178.endif
1179.if ${BUILD_RADEON} == 1
1180LIBDPLIBS+= 	drm_radeon	${.CURDIR}/../libdrm_radeon
1181LIBDPLIBS+= 	drm_amdgpu	${.CURDIR}/../libdrm_amdgpu
1182.endif	# ${BUILD_RADEON} == 1
1183.if ${BUILD_NOUVEAU} == 1
1184LIBDPLIBS+= 	drm_nouveau	${.CURDIR}/../libdrm_nouveau
1185.endif	# ${BUILD_NOUVEAU} == 1
1186.endif	# ${BUILD_RADEON} == 1 || ${BUILD_NOUVEAU} == 1
1187LIBDPLIBS+= 	glapi		${.CURDIR}/../libglapi${OLD_SUFFIX}
1188LIBDPLIBS+=	expat		${.CURDIR}/../../../../../external/mit/expat/lib/libexpat
1189LIBDPLIBS+=	terminfo	${.CURDIR}/../../../../../lib/libterminfo
1190LIBDPLIBS+=	execinfo	${.CURDIR}/../../../../../lib/libexecinfo
1191
1192LIBDPLIBS+=	elf		${NETBSDSRCDIR}/external/bsd/elftoolchain/lib/libelf
1193LIBDPLIBS+=	z		${.CURDIR}/../../../../../lib/libz
1194LIBDPLIBS+=	m		${.CURDIR}/../../../../../lib/libm
1195
1196# gallium drivers requiring LLVM
1197.if ${BUILD_LLVMPIPE} == 1 || ${BUILD_RADEON} == 1
1198
1199LLVMRT_LIBS=	\
1200		MCJIT \
1201		ExecutionEngine \
1202		ExecutionEngineOrcTargetProcess \
1203		ExecutionEngineOrcShared \
1204		Orc \
1205		RuntimeDyld
1206
1207.if ${BUILD_RADEON} == 1
1208LLVMRT_LIBS+=	\
1209		AMDGPUCodeGen \
1210		AMDGPUMCTargetDesc \
1211		AMDGPUTargetInfo \
1212		AMDGPUAsmParser \
1213		AMDGPUDisassembler \
1214		AMDGPUUtils
1215.endif
1216
1217.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
1218# XXX duplicates
1219LLVMRT_LIBS+=	\
1220		X86Disassembler \
1221		X86CodeGen \
1222		X86MCTargetDesc \
1223		X86Disassembler \
1224		X86MCTargetDesc \
1225		X86TargetInfo
1226.endif
1227
1228.if ${MACHINE_CPU} == "aarch64"
1229LLVMRT_LIBS+=	\
1230		AArch64AsmParser \
1231		AArch64CodeGen \
1232		AArch64MCTargetDesc \
1233		AArch64Utils \
1234		AArch64Disassembler \
1235		AArch64TargetInfo
1236.endif
1237
1238.if ${MACHINE_CPU} == "arm"
1239LLVMRT_LIBS+=	\
1240		ARMCodeGen \
1241		ARMDisassembler \
1242		ARMTargetInfo \
1243		ARMMCTargetDesc \
1244		ARMAsmParser \
1245		ARMUtils
1246.endif
1247
1248.if ${MACHINE_CPU} == "mips"
1249LLVMRT_LIBS+=	\
1250		MipsCodeGen \
1251		MipsDisassembler \
1252		MipsAsmParser \
1253		MipsMCTargetDesc \
1254		MipsTargetInfo
1255.endif
1256
1257.if ${MACHINE_CPU} == "powerpc"
1258LLVMRT_LIBS+=	\
1259		PowerPCCodeGen \
1260		PowerPCDisassembler \
1261		PowerPCTargetInfo \
1262		PowerPCMCTargetDesc \
1263		PowerPCAsmParser
1264.endif
1265
1266LLVMRT_LIBS+=	\
1267		Passes \
1268		TransformsCoroutines \
1269		ObjCARC \
1270		GlobalISel \
1271		MCDisassembler \
1272		SelectionDAG \
1273		AsmPrinter \
1274		CodeGen \
1275		TransformsCFGuard \
1276		Target \
1277		InstCombine \
1278		ScalarOpts \
1279		DebugInfoCodeView \
1280		DebugInfoDWARF \
1281		Object \
1282		BitReader \
1283		TextAPI \
1284		MIRParser \
1285		MCParser \
1286		MC \
1287		ipo \
1288		BitWriter \
1289		FrontendOpenMP \
1290		Instrumentation \
1291		IRReader \
1292		AsmParser \
1293		Vectorize \
1294		TransformsAggressiveInstCombine \
1295		ProfileData \
1296		TransformsUtils \
1297		Analysis \
1298		IR \
1299		Remarks \
1300		BitstreamReader \
1301		Linker \
1302		BinaryFormat \
1303		Support \
1304		Demangle
1305
1306.include "${NETBSDSRCDIR}/external/apache2/llvm/link.mk"
1307
1308.endif  # ${BUILD_LLVM_PIPE} == 1 || ${BUILD_RADEON} == 1
1309
1310LDFLAGS+=	-Wl,--version-script=${X11SRCDIR.Mesa}/src/gallium/targets/dri/dri.sym
1311.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE_CPU} == "aarch64"
1312LDFLAGS+=	-Wl,-z,defs
1313.endif
1314
1315##  build mesagallium parts
1316MESA_SRC_MODULES=  main math vbo state_tracker program asm_s
1317.if ${BUILD_RADEON} == 1
1318MESA_SRC_MODULES+= amd
1319.endif
1320
1321.include "../libmesa.mk"
1322.include "../libglsl.mk"
1323
1324# Special addition for just gallium; it misses the rest of asm_c files.
1325.PATH: ${X11SRCDIR.Mesa}/src/mesa/x86
1326SRCS+=	common_x86.c
1327
1328.if ${MACHINE} == "amd64" || ${MACHINE} == "i386"
1329SRCS+=	streaming-load-memcpy.c
1330CPPFLAGS.streaming-load-memcpy.c+= -msse4.1
1331.endif
1332
1333# Needs 64bit atomics
1334CPPFLAGS.i386+= -march=i586
1335CPPFLAGS+=	${CPPFLAGS.${XORG_MACHINE_ARCH:U${MACHINE_ARCH}}}
1336
1337CPPFLAGS.r600_pipe_common.c+=	-DMESA_LLVM_VERSION_STRING=\"${LLVM_VERSION}\"
1338CPPFLAGS.si_get.c+=	-DMESA_LLVM_VERSION_STRING=\"${LLVM_VERSION}\"
1339CPPFLAGS.lp_screen.c+=	-DMESA_LLVM_VERSION_STRING=\"${LLVM_VERSION}\"
1340CPPFLAGS.lp_bld_intr.c+=	-DMESA_LLVM_VERSION_STRING=\"${LLVM_VERSION}\"
1341CPPFLAGS.lp_bld_type.c+=	-DMESA_LLVM_VERSION_STRING=\"${LLVM_VERSION}\"
1342
1343.include "../driver.mk"
1344
1345
1346.PATH: ${X11SRCDIR.Mesa}/src/gallium/targets/dri
1347SRCS+=	target.c
1348
1349CPPFLAGS+= \
1350	-I${X11SRCDIR.Mesa}/src/gallium/include \
1351	-I${X11SRCDIR.Mesa}/src/gallium/auxiliary \
1352	-I${X11SRCDIR.Mesa}/src/gallium/drivers \
1353	-I${X11SRCDIR.Mesa}/../src/mesa/drivers/dri/common
1354
1355CPPFLAGS.target.c += \
1356	-DDRI_TARGET \
1357	-DGALLIUM_NOOP \
1358	-DGALLIUM_RBUG \
1359	-DGALLIUM_TRACE \
1360	-DGALLIUM_SOFTPIPE \
1361	-I${X11SRCDIR.Mesa}/src/gallium/frontends/dri \
1362	-I${X11SRCDIR.Mesa}/src/loader \
1363	-I${X11SRCDIR.Mesa}/../src/util \
1364	-I${X11SRCDIR.Mesa}/../src/gallium/drivers \
1365	-I${X11SRCDIR.Mesa}/src/gallium/winsys
1366
1367.if ${BUILD_LLVMPIPE} == 1
1368CPPFLAGS.target.c += \
1369	-DGALLIUM_LLVMPIPE
1370.endif  #${BUILD_LLVMPIPE} == 1
1371
1372.if ${BUILD_I915} == 1
1373CPPFLAGS.target.c += \
1374	-DGALLIUM_I915 \
1375	-DGALLIUM_ILO
1376.endif
1377
1378.if ${BUILD_IRIS} == 1
1379CPPFLAGS.target.c += \
1380	-DGALLIUM_IRIS
1381.endif
1382
1383.if ${BUILD_CROCUS} == 1
1384CPPFLAGS.target.c += \
1385	-DGALLIUM_CROCUS
1386.endif
1387
1388.if ${BUILD_RADEON} == 1
1389CPPFLAGS.target.c += \
1390	-DGALLIUM_R200 \
1391	-DGALLIUM_R300 \
1392	-DGALLIUM_R600 \
1393	-DGALLIUM_RADEONSI
1394.endif	# ${BUILD_RADEON} == 1
1395
1396.if ${BUILD_NOUVEAU} == 1
1397CPPFLAGS.target.c += \
1398	-DGALLIUM_NOUVEAU
1399.endif	# ${BUILD_NOUVEAU} == 1
1400
1401CWARNFLAGS.clang+=	-Wno-error=constant-conversion \
1402			-Wno-error=tautological-constant-out-of-range-compare \
1403			-Wno-error=pointer-sign \
1404			-Wno-error=switch \
1405			-Wno-error=absolute-value \
1406			-Wno-error=tautological-compare \
1407			-Wno-error=static-in-inline \
1408			-Wno-error=logical-not-parentheses \
1409			-Wno-error=constant-logical-operand \
1410			-Wno-error=unknown-warning-option \
1411			-Wno-error=typedef-redefinition \
1412			-Wno-error=enum-conversion # https://bugs.freedesktop.org/show_bug.cgi?id=109761
1413
1414CWARNFLAGS+=		-Wno-error=stack-protector
1415
1416.include <bsd.x11.mk>
1417LIBDIR=		${X11USRLIBDIR}/modules/dri
1418
1419.for _d in ${DRIVERS}
1420SYMLINKS+= gallium_dri.so ${DRIDIR}/${_d}_dri.so
1421SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR} ${DRIDIR}/${_d}_dri.so.${SHLIB_MAJOR}
1422.if ${MKDEBUG} != "no"
1423SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR}.debug ${DRIDEBUGDIR}/${_d}_dri.so.${SHLIB_MAJOR}.debug
1424.endif
1425.endfor
1426
1427.if ${MACHINE_ARCH} == "sparc" || ${COMMON_MACHINE_ARCH:U} == "sparc"
1428COPTS+=	${${ACTIVE_CC} == "clang":? -Wa,-Av8plus  :}
1429.endif
1430
1431.if ${MACHINE_ARCH} == "vax"
1432COPTS.nir.c += -O1
1433.endif
1434
1435COPTS.u_atomic.c+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-builtin-declaration-mismatch :}
1436
1437.include <bsd.lib.mk>
1438# Don't regenerate c files
1439.y.c:
1440