1# $NetBSD: Makefile,v 1.12 2015/11/03 10:43:31 szptvlfn Exp $ 2 3# Link the gallium mega driver. 4 5LIBISMODULE= yes 6LIBISCXX= yes 7 8.include <bsd.own.mk> 9 10SHLIB_MAJOR= 0 11 12LIB= gallium_dri 13DRIDIR= ${X11USRLIBDIR}/modules/dri 14DRIDEBUGDIR= ${DEBUGDIR}${X11USRLIBDIR}/modules/dri 15 16DRIVERS= kms_swrast swrast 17.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" 18DRIVERS+= r600 19.endif 20.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "evbarm" 21DRIVERS+= nouveau 22.endif 23 24CPPFLAGS+= \ 25 -I${DESTDIR}${X11INCDIR}/libdrm 26 27# cargo culted. 28#CPPFLAGS+= -D_NETBSD_SOURCE -DPTHREADS 29 30GALLIUM_SUBDIRS= \ 31 auxiliary \ 32 auxiliary/cso_cache \ 33 auxiliary/draw \ 34 auxiliary/hud \ 35 auxiliary/indices \ 36 auxiliary/os \ 37 auxiliary/pipebuffer \ 38 auxiliary/postprocess \ 39 auxiliary/rbug \ 40 auxiliary/rtasm \ 41 auxiliary/tgsi \ 42 auxiliary/translate \ 43 auxiliary/util \ 44 auxiliary/vl \ 45 drivers/galahad \ 46 drivers/identity \ 47 drivers/noop \ 48 drivers/trace \ 49 drivers/rbug \ 50 drivers/radeon \ 51 drivers/r600 \ 52 drivers/r600/sb \ 53 drivers/nouveau \ 54 drivers/nouveau/nv30 \ 55 drivers/nouveau/nv50 \ 56 drivers/nouveau/codegen \ 57 drivers/nouveau/nvc0 \ 58 drivers/softpipe \ 59 winsys/radeon/drm \ 60 winsys/nouveau/drm \ 61 winsys/sw/null \ 62 winsys/sw/dri \ 63 winsys/sw/kms-dri \ 64 state_trackers/dri 65 66GALLIUM_SOURCES.auxiliary/cso_cache= \ 67 cso_cache.c \ 68 cso_context.c \ 69 cso_hash.c 70GALLIUM_SOURCES.auxiliary/draw= \ 71 draw_context.c \ 72 draw_fs.c \ 73 draw_gs.c \ 74 draw_pipe.c \ 75 draw_pipe_aaline.c \ 76 draw_pipe_aapoint.c \ 77 draw_pipe_clip.c \ 78 draw_pipe_cull.c \ 79 draw_pipe_flatshade.c \ 80 draw_pipe_offset.c \ 81 draw_pipe_pstipple.c \ 82 draw_pipe_stipple.c \ 83 draw_pipe_twoside.c \ 84 draw_pipe_unfilled.c \ 85 draw_pipe_util.c \ 86 draw_pipe_validate.c \ 87 draw_pipe_vbuf.c \ 88 draw_pipe_wide_line.c \ 89 draw_pipe_wide_point.c \ 90 draw_prim_assembler.c \ 91 draw_pt.c \ 92 draw_pt_emit.c \ 93 draw_pt_fetch.c \ 94 draw_pt_fetch_emit.c \ 95 draw_pt_fetch_shade_emit.c \ 96 draw_pt_fetch_shade_pipeline.c \ 97 draw_pt_post_vs.c \ 98 draw_pt_so_emit.c \ 99 draw_pt_util.c \ 100 draw_pt_vsplit.c \ 101 draw_vertex.c \ 102 draw_vs.c \ 103 draw_vs_exec.c \ 104 draw_vs_variant.c 105GALLIUM_SOURCES.auxiliary/hud= \ 106 font.c \ 107 hud_context.c \ 108 hud_cpu.c \ 109 hud_fps.c \ 110 hud_driver_query.c 111GALLIUM_SOURCES.auxiliary/indices= \ 112 u_primconvert.c 113GALLIUM_SOURCES.auxiliary/os= \ 114 os_misc.c \ 115 os_process.c \ 116 os_time.c 117GALLIUM_SOURCES.auxiliary/pipebuffer= \ 118 pb_buffer_fenced.c \ 119 pb_buffer_malloc.c \ 120 pb_bufmgr_alt.c \ 121 pb_bufmgr_cache.c \ 122 pb_bufmgr_debug.c \ 123 pb_bufmgr_mm.c \ 124 pb_bufmgr_ondemand.c \ 125 pb_bufmgr_pool.c \ 126 pb_bufmgr_slab.c \ 127 pb_validate.c 128GALLIUM_SOURCES.auxiliary/postprocess= \ 129 pp_celshade.c \ 130 pp_colors.c \ 131 pp_init.c \ 132 pp_mlaa.c \ 133 pp_run.c \ 134 pp_program.c 135GALLIUM_SOURCES.auxiliary/rbug= \ 136 rbug_connection.c \ 137 rbug_context.c \ 138 rbug_core.c \ 139 rbug_demarshal.c \ 140 rbug_texture.c \ 141 rbug_shader.c 142GALLIUM_SOURCES.auxiliary/rtasm= \ 143 rtasm_cpu.c \ 144 rtasm_execmem.c \ 145 rtasm_x86sse.c 146GALLIUM_SOURCES.auxiliary/tgsi= \ 147 tgsi_build.c \ 148 tgsi_dump.c \ 149 tgsi_exec.c \ 150 tgsi_info.c \ 151 tgsi_iterate.c \ 152 tgsi_parse.c \ 153 tgsi_sanity.c \ 154 tgsi_scan.c \ 155 tgsi_strings.c \ 156 tgsi_text.c \ 157 tgsi_transform.c \ 158 tgsi_ureg.c \ 159 tgsi_util.c 160GALLIUM_SOURCES.auxiliary/translate= \ 161 translate.c \ 162 translate_cache.c \ 163 translate_generic.c \ 164 translate_sse.c 165GALLIUM_SOURCES.auxiliary/util= \ 166 u_debug.c \ 167 u_debug_describe.c \ 168 u_debug_flush.c \ 169 u_debug_memory.c \ 170 u_debug_refcnt.c \ 171 u_debug_stack.c \ 172 u_debug_symbol.c \ 173 u_dump_defines.c \ 174 u_dump_state.c \ 175 u_bitmask.c \ 176 u_blit.c \ 177 u_blitter.c \ 178 u_cache.c \ 179 u_caps.c \ 180 u_cpu_detect.c \ 181 u_dl.c \ 182 u_draw.c \ 183 u_draw_quad.c \ 184 u_format.c \ 185 u_format_other.c \ 186 u_format_latc.c \ 187 u_format_s3tc.c \ 188 u_format_rgtc.c \ 189 u_format_etc.c \ 190 u_format_bptc.c \ 191 u_format_tests.c \ 192 u_format_yuv.c \ 193 u_format_zs.c \ 194 u_framebuffer.c \ 195 u_gen_mipmap.c \ 196 u_handle_table.c \ 197 u_hash.c \ 198 u_hash_table.c \ 199 u_helpers.c \ 200 u_index_modify.c \ 201 u_keymap.c \ 202 u_linear.c \ 203 u_linkage.c \ 204 u_network.c \ 205 u_math.c \ 206 u_mm.c \ 207 u_pstipple.c \ 208 u_ringbuffer.c \ 209 u_sampler.c \ 210 u_simple_shaders.c \ 211 u_slab.c \ 212 u_snprintf.c \ 213 u_staging.c \ 214 u_suballoc.c \ 215 u_surface.c \ 216 u_surfaces.c \ 217 u_texture.c \ 218 u_tile.c \ 219 u_transfer.c \ 220 u_resource.c \ 221 u_upload_mgr.c \ 222 u_vbuf.c 223GALLIUM_SOURCES.auxiliary/vl= \ 224 vl_csc.c \ 225 vl_compositor.c \ 226 vl_matrix_filter.c \ 227 vl_median_filter.c \ 228 vl_decoder.c \ 229 vl_mpeg12_decoder.c \ 230 vl_mpeg12_bitstream.c \ 231 vl_zscan.c \ 232 vl_idct.c \ 233 vl_mc.c \ 234 vl_vertex_buffers.c \ 235 vl_video_buffer.c \ 236 vl_deint_filter.c 237 238# Generated 239.PATH: ${X11SRCDIR.MesaLib}/../src/gallium/auxiliary 240GALLIUM_SOURCES.auxiliary= \ 241 u_indices_gen.c \ 242 u_unfilled_gen.c \ 243 u_format_table.c 244.for _f in ${GALLIUM_SOURCES.auxiliary} 245CPPFLAGS.${_f} += -I${X11SRCDIR.MesaLib}/src/gallium/auxiliary/util 246.endfor 247 248GALLIUM_SOURCES.drivers/galahad= \ 249 glhd_objects.c \ 250 glhd_context.c \ 251 glhd_screen.c 252 253GALLIUM_SOURCES.drivers/identity = \ 254 id_objects.c \ 255 id_context.c \ 256 id_screen.c 257 258GALLIUM_SOURCES.drivers/noop = \ 259 noop_pipe.c \ 260 noop_state.c 261 262GALLIUM_SOURCES.drivers/trace = \ 263 tr_context.c \ 264 tr_dump.c \ 265 tr_dump_state.c \ 266 tr_screen.c \ 267 tr_texture.c 268 269GALLIUM_SOURCES.drivers/rbug = \ 270 DRIVERrbug_core.c \ 271 DRIVERrbug_context.c \ 272 rbug_objects.c \ 273 rbug_screen.c 274# Conflicts with auxiliary/rbug/ files 275BUILDSYMLINKS+= ${X11SRCDIR.MesaLib}/src/gallium/drivers/rbug/rbug_core.c DRIVERrbug_core.c 276BUILDSYMLINKS+= ${X11SRCDIR.MesaLib}/src/gallium/drivers/rbug/rbug_context.c DRIVERrbug_context.c 277CPPFLAGS.DRIVERrbug_core.c+= -I${X11SRCDIR.MesaLib}/src/gallium/auxiliary 278CPPFLAGS.DRIVERrbug_core.c+= -I${X11SRCDIR.MesaLib}/src/gallium/drivers/rbug 279CPPFLAGS.DRIVERrbug_core.c+= -I${X11SRCDIR.MesaLib}/src/gallium/drivers 280CPPFLAGS.DRIVERrbug_context.c+= -I${X11SRCDIR.MesaLib}/src/gallium/auxiliary 281CPPFLAGS.DRIVERrbug_context.c+= -I${X11SRCDIR.MesaLib}/src/gallium/drivers/rbug 282CPPFLAGS.DRIVERrbug_context.c+= -I${X11SRCDIR.MesaLib}/src/gallium/drivers 283 284GALLIUM_SOURCES.drivers/radeon = \ 285 cayman_msaa.c \ 286 r600_buffer_common.c \ 287 r600_pipe_common.c \ 288 r600_query.c \ 289 r600_streamout.c \ 290 r600_texture.c \ 291 radeon_video.c \ 292 radeon_uvd.c \ 293 radeon_vce.c \ 294 radeon_vce_40_2_2.c 295#LLVM_C_FILES := \ 296# radeon_elf_util.c \ 297# radeon_setup_tgsi_llvm.c \ 298# radeon_llvm_emit.c \ 299# radeon_llvm_util.c 300 301GALLIUM_SOURCES.drivers/r600 = \ 302 r600_asm.c \ 303 r600_blit.c \ 304 r600_hw_context.c \ 305 r600_isa.c \ 306 r600_pipe.c \ 307 r600_shader.c \ 308 r600_state.c \ 309 r700_asm.c \ 310 evergreen_hw_context.c \ 311 evergreen_state.c \ 312 eg_asm.c \ 313 r600_state_common.c \ 314 evergreen_compute.c \ 315 compute_memory_pool.c \ 316 r600_uvd.c 317GALLIUM_SOURCES.drivers/r600/sb = \ 318 sb_bc_builder.cpp \ 319 sb_bc_decoder.cpp \ 320 sb_bc_dump.cpp \ 321 sb_bc_finalize.cpp \ 322 sb_bc_parser.cpp \ 323 sb_context.cpp \ 324 sb_core.cpp \ 325 sb_dce_cleanup.cpp \ 326 sb_def_use.cpp \ 327 sb_dump.cpp \ 328 sb_expr.cpp \ 329 sb_gcm.cpp \ 330 sb_gvn.cpp \ 331 sb_if_conversion.cpp \ 332 sb_ir.cpp \ 333 sb_liveness.cpp \ 334 sb_pass.cpp \ 335 sb_peephole.cpp \ 336 sb_psi_ops.cpp \ 337 sb_ra_checker.cpp \ 338 sb_ra_coalesce.cpp \ 339 sb_ra_init.cpp \ 340 sb_sched.cpp \ 341 sb_shader.cpp \ 342 sb_ssa_builder.cpp \ 343 sb_valtable.cpp 344#LLVM_C_SOURCES = r600_llvm.c 345 346.for _f in ${GALLIUM_SOURCES.drivers/r600} ${GALLIUM_SOURCES.drivers/r600/sb} 347CPPFLAGS.${_f} += -I${X11SRCDIR.MesaLib}/src/gallium/drivers/r600 348.endfor 349 350GALLIUM_SOURCES.drivers/nouveau = \ 351 nouveau_screen.c \ 352 nouveau_fence.c \ 353 nouveau_mm.c \ 354 nouveau_buffer.c \ 355 nouveau_heap.c \ 356 nouveau_video.c \ 357 nouveau_vp3_video.c \ 358 nouveau_vp3_video_bsp.c \ 359 nouveau_vp3_video_vp.c 360 361GALLIUM_SOURCES.drivers/nouveau/nv30 = \ 362 nv30_screen.c \ 363 nv30_context.c \ 364 nv30_format.c \ 365 nv30_resource.c \ 366 nv30_transfer.c \ 367 nv30_miptree.c \ 368 nv30_state.c \ 369 nv30_state_validate.c \ 370 nv30_texture.c \ 371 nv30_fragtex.c \ 372 nv40_verttex.c \ 373 nv30_fragprog.c \ 374 nv30_vertprog.c \ 375 nv30_clear.c \ 376 nv30_vbo.c \ 377 nv30_push.c \ 378 nv30_draw.c \ 379 nv30_query.c \ 380 nvfx_vertprog.c \ 381 nvfx_fragprog.c 382 383GALLIUM_SOURCES.drivers/nouveau/nv50 = \ 384 nv50_context.c \ 385 nv50_formats.c \ 386 nv50_miptree.c \ 387 nv50_resource.c \ 388 nv50_screen.c \ 389 nv50_state.c \ 390 nv50_state_validate.c \ 391 nv50_surface.c \ 392 nv50_tex.c \ 393 nv50_transfer.c \ 394 nv50_vbo.c \ 395 nv50_program.c \ 396 nv50_shader_state.c \ 397 nv50_push.c \ 398 nv50_query.c \ 399 nv84_video.c \ 400 nv84_video_bsp.c \ 401 nv84_video_vp.c \ 402 nv98_video.c \ 403 nv98_video_bsp.c \ 404 nv98_video_vp.c \ 405 nv98_video_ppp.c 406 407GALLIUM_SOURCES.drivers/nouveau/codegen = \ 408 nv50_ir.cpp \ 409 nv50_ir_bb.cpp \ 410 nv50_ir_build_util.cpp \ 411 nv50_ir_emit_nv50.cpp \ 412 nv50_ir_from_tgsi.cpp \ 413 nv50_ir_graph.cpp \ 414 nv50_ir_lowering_nv50.cpp \ 415 nv50_ir_peephole.cpp \ 416 nv50_ir_print.cpp \ 417 nv50_ir_ra.cpp \ 418 nv50_ir_ssa.cpp \ 419 nv50_ir_target.cpp \ 420 nv50_ir_target_nv50.cpp \ 421 nv50_ir_util.cpp \ 422 nv50_ir_emit_nvc0.cpp \ 423 nv50_ir_emit_gk110.cpp \ 424 nv50_ir_emit_gm107.cpp \ 425 nv50_ir_lowering_nvc0.cpp \ 426 nv50_ir_lowering_gm107.cpp \ 427 nv50_ir_target_nvc0.cpp \ 428 nv50_ir_target_gm107.cpp 429 430GALLIUM_SOURCES.drivers/nouveau/nvc0 = \ 431 nvc0_compute.c \ 432 nvc0_context.c \ 433 nvc0_formats.c \ 434 nvc0_miptree.c \ 435 nvc0_resource.c \ 436 nvc0_screen.c \ 437 nvc0_state.c \ 438 nvc0_state_validate.c \ 439 nvc0_surface.c \ 440 nvc0_tex.c \ 441 nvc0_transfer.c \ 442 nvc0_vbo.c \ 443 nvc0_vbo_translate.c \ 444 nvc0_program.c \ 445 nvc0_shader_state.c \ 446 nvc0_query.c \ 447 nve4_compute.c \ 448 nvc0_video.c \ 449 nvc0_video_bsp.c \ 450 nvc0_video_vp.c \ 451 nvc0_video_ppp.c 452 453.for _f in ${GALLIUM_SOURCES.drivers/nouveau} \ 454 ${GALLIUM_SOURCES.drivers/nouveau/nv30} \ 455 ${GALLIUM_SOURCES.drivers/nouveau/nv50} \ 456 ${GALLIUM_SOURCES.drivers/nouveau/codegen} \ 457 ${GALLIUM_SOURCES.drivers/nouveau/nvc0} 458CPPFLAGS.${_f} += -I${X11SRCDIR.MesaLib}/src/gallium/drivers/nouveau 459.endfor 460 461 462GALLIUM_SOURCES.winsys/radeon/drm = \ 463 radeon_drm_bo.c \ 464 radeon_drm_cs.c \ 465 radeon_drm_cs_dump.c \ 466 radeon_drm_winsys.c 467 468GALLIUM_SOURCES.winsys/nouveau/drm = \ 469 nouveau_drm_winsys.c 470 471GALLIUM_SOURCES.drivers/softpipe = \ 472 sp_fs_exec.c \ 473 sp_clear.c \ 474 sp_fence.c \ 475 sp_flush.c \ 476 sp_query.c \ 477 sp_context.c \ 478 sp_draw_arrays.c \ 479 sp_prim_vbuf.c \ 480 sp_quad_pipe.c \ 481 sp_quad_stipple.c \ 482 sp_quad_depth_test.c \ 483 sp_quad_fs.c \ 484 sp_quad_blend.c \ 485 sp_screen.c \ 486 sp_setup.c \ 487 sp_state_blend.c \ 488 sp_state_clip.c \ 489 sp_state_derived.c \ 490 sp_state_sampler.c \ 491 sp_state_shader.c \ 492 sp_state_so.c \ 493 sp_state_rasterizer.c \ 494 sp_state_surface.c \ 495 sp_state_vertex.c \ 496 sp_texture.c \ 497 sp_tex_sample.c \ 498 sp_tex_tile_cache.c \ 499 sp_tile_cache.c \ 500 sp_surface.c 501 502GALLIUM_SOURCES.winsys/sw/null = \ 503 null_sw_winsys.c 504 505GALLIUM_SOURCES.winsys/sw/dri = \ 506 dri_sw_winsys.c 507 508GALLIUM_SOURCES.winsys/sw/kms-dri = \ 509 kms_dri_sw_winsys.c 510 511GALLIUM_SOURCES.state_trackers/dri = \ 512 dri_context.c \ 513 dri_drawable.c \ 514 dri_query_renderer.c \ 515 dri_screen.c \ 516 drisw.c \ 517 dri2.c 518.for _f in ${GALLIUM_SOURCES.state_trackers/dri} 519CPPFLAGS.${_f} += -I${X11SRCDIR.MesaLib}/src/gallium/state_trackers/dri/common 520.endfor 521 522# missing 523CPPFLAGS+= \ 524 -DGALLIUM_SOFTPIPE \ 525 -DGALLIUM_STATIC_TARGETS=1 \ 526 -DMESA_EGL_NO_X11_HEADERS 527 528.for _d in ${GALLIUM_SUBDIRS} 529SRCS+= ${GALLIUM_SOURCES.${_d}} 530.PATH: ${X11SRCDIR.MesaLib}/src/gallium/${_d} 531.endfor 532 533#. if defined(${GALLIUM_SOURCES.${_d}}) 534#SRCS+= ${GALLIUM_SOURCES.${_d}} 535#. endif 536 537.include "../libloader.mk" 538 539LIBDPLIBS+= m ${.CURDIR}/../../../../../lib/libm 540LIBDPLIBS+= drm ${.CURDIR}/../libdrm 541LIBDPLIBS+= drm_radeon ${.CURDIR}/../libdrm_radeon 542.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "evbarm" 543LIBDPLIBS+= drm_nouveau ${.CURDIR}/../libdrm_nouveau 544.endif 545LIBDPLIBS+= glapi ${.CURDIR}/../libglapi 546LIBDPLIBS+= expat ${.CURDIR}/../../../../../external/mit/expat/lib/libexpat 547 548LDFLAGS+= -Wl,--version-script=${X11SRCDIR.MesaLib}/src/gallium/targets/dri/dri.sym 549 550## build mesagallium parts 551MESA_SRC_MODULES= main math vbo state_tracker program asm_s 552.include "../libmesa.mk" 553.include "../libglsl.mk" 554 555# Special addition for just gallium; it misses the rest of asm_c files. 556.PATH: ${X11SRCDIR.MesaLib}/src/mesa/x86 557SRCS+= common_x86.c 558 559.if ${MACHINE} == "amd64" || ${MACHINE} == "i386" 560SRCS+= streaming-load-memcpy.c 561CFLAGS.streaming-load-memcpy.c+= -msse4.1 562.endif 563 564.include "../driver.mk" 565 566 567.PATH: ${X11SRCDIR.MesaLib}/src/gallium/targets/dri 568SRCS+= target.c 569 570CPPFLAGS+= \ 571 -I${X11SRCDIR.MesaLib}/src/gallium/include \ 572 -I${X11SRCDIR.MesaLib}/src/gallium/auxiliary \ 573 -I${X11SRCDIR.MesaLib}/src/gallium/drivers \ 574 -I${X11SRCDIR.MesaLib}/../src/mesa/drivers/dri/common 575 576CPPFLAGS.target.c += \ 577 -DDRI_TARGET \ 578 -DGALLIUM_GALAHAD \ 579 -DGALLIUM_NOOP \ 580 -DGALLIUM_RBUG \ 581 -DGALLIUM_TRACE \ 582 -DGALLIUM_R200 \ 583 -DGALLIUM_R600 \ 584 -DGALLIUM_NOUVEAU \ 585 -DGALLIUM_SOFTPIPE \ 586 -I${X11SRCDIR.MesaLib}/src/gallium/state_trackers/dri \ 587 -I${X11SRCDIR.MesaLib}/src/loader \ 588 -I${X11SRCDIR.MesaLib}/src/gallium/winsys 589 590CWARNFLAGS.clang+= -Wno-error=constant-conversion \ 591 -Wno-error=tautological-constant-out-of-range-compare \ 592 -Wno-error=pointer-sign \ 593 -Wno-error=switch \ 594 -Wno-error=absolute-value \ 595 -Wno-error=tautological-compare \ 596 -Wno-error=static-in-inline 597 598.include <bsd.x11.mk> 599LIBDIR= ${X11USRLIBDIR}/modules/dri 600 601.for _d in ${DRIVERS} 602SYMLINKS+= gallium_dri.so ${DRIDIR}/${_d}_dri.so 603SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR} ${DRIDIR}/${_d}_dri.so.${SHLIB_MAJOR} 604.if ${MKDEBUG} != "no" 605SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR}.debug ${DRIDEBUGDIR}/${_d}_dri.so.${SHLIB_MAJOR}.debug 606.endif 607.endfor 608 609.include <bsd.lib.mk> 610# Don't regenerate c files 611.y.c: 612