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