noinst_LTLIBRARIES = libglcore.la

MESASRCDIR = @MESA_SOURCE@/src/mesa
MESADISTDIR = $(top_distdir)/GL/mesa
MESADISTSRCDIR = $(MESADISTDIR)/src/mesa

INCLUDES = \
	-I$(top_srcdir)/GL/glx \
	-I$(top_srcdir)/GL/include \
	-I$(top_srcdir)/GL/mesa/include \
	-I$(top_srcdir)/GL/mesa/X \
	-I$(top_srcdir)/mi \
	-I$(top_srcdir)/Xext \
	-I$(top_srcdir)/render \
	-I@MESA_SOURCE@/include	\
	-I$(MESASRCDIR)	\
	-I$(MESASRCDIR)/main \
	-I$(MESASRCDIR)/glapi \
	-I$(MESASRCDIR)/shader \
	-I$(MESASRCDIR)/shader/grammar \
	-I$(MESASRCDIR)/shader/slang \
	-I$(MESASRCDIR)/drivers/x11 \
	@XSERVER_CFLAGS@

MESA_BASE_SRCS = \
	$(MESASRCDIR)/main/dispatch.c \
	$(MESASRCDIR)/glapi/glapi.c \
	$(MESASRCDIR)/glapi/glthread.c \
	$(MESASRCDIR)/main/api_arrayelt.c \
	$(MESASRCDIR)/main/api_loopback.c \
	$(MESASRCDIR)/main/api_noop.c \
	$(MESASRCDIR)/main/api_validate.c \
	$(MESASRCDIR)/main/accum.c \
	$(MESASRCDIR)/main/attrib.c \
	$(MESASRCDIR)/main/blend.c \
	$(MESASRCDIR)/main/bufferobj.c \
	$(MESASRCDIR)/main/buffers.c \
	$(MESASRCDIR)/main/clip.c \
	$(MESASRCDIR)/main/colortab.c \
	$(MESASRCDIR)/main/context.c \
	$(MESASRCDIR)/main/convolve.c \
	$(MESASRCDIR)/main/debug.c \
	$(MESASRCDIR)/main/depth.c \
	$(MESASRCDIR)/main/depthstencil.c \
	$(MESASRCDIR)/main/dlist.c \
	$(MESASRCDIR)/main/drawpix.c \
	$(MESASRCDIR)/main/enable.c \
	$(MESASRCDIR)/main/enums.c \
	$(MESASRCDIR)/main/eval.c \
	$(MESASRCDIR)/main/execmem.c \
	$(MESASRCDIR)/main/extensions.c \
	$(MESASRCDIR)/main/fbobject.c \
	$(MESASRCDIR)/main/feedback.c \
	$(MESASRCDIR)/main/fog.c \
	$(MESASRCDIR)/main/framebuffer.c \
	$(MESASRCDIR)/main/get.c \
	$(MESASRCDIR)/main/getstring.c \
	$(MESASRCDIR)/main/hash.c \
	$(MESASRCDIR)/main/hint.c \
	$(MESASRCDIR)/main/histogram.c \
	$(MESASRCDIR)/main/image.c \
	$(MESASRCDIR)/main/imports.c \
	$(MESASRCDIR)/main/light.c \
	$(MESASRCDIR)/main/lines.c \
	$(MESASRCDIR)/main/matrix.c \
	$(MESASRCDIR)/main/mm.c \
	$(MESASRCDIR)/main/occlude.c \
	$(MESASRCDIR)/main/pixel.c \
	$(MESASRCDIR)/main/points.c \
	$(MESASRCDIR)/main/polygon.c \
	$(MESASRCDIR)/main/rastpos.c \
	$(MESASRCDIR)/main/renderbuffer.c \
	$(MESASRCDIR)/main/state.c \
	$(MESASRCDIR)/main/stencil.c \
	$(MESASRCDIR)/main/texcompress.c \
	$(MESASRCDIR)/main/texcompress_fxt1.c \
	$(MESASRCDIR)/main/texcompress_s3tc.c \
	$(MESASRCDIR)/main/texenvprogram.c \
	$(MESASRCDIR)/main/texformat.c \
	$(MESASRCDIR)/main/teximage.c \
	$(MESASRCDIR)/main/texrender.c \
	$(MESASRCDIR)/main/texobj.c \
	$(MESASRCDIR)/main/texstate.c \
	$(MESASRCDIR)/main/texstore.c \
	$(MESASRCDIR)/main/varray.c \
	$(MESASRCDIR)/main/vtxfmt.c

MESA_AC_SRCS = \
	$(MESASRCDIR)/array_cache/ac_context.c \
	$(MESASRCDIR)/array_cache/ac_import.c

MESA_SHADER_SRCS = \
	$(MESASRCDIR)/shader/arbprogparse.c \
	$(MESASRCDIR)/shader/arbprogram.c \
	$(MESASRCDIR)/shader/atifragshader.c \
	$(MESASRCDIR)/shader/grammar/grammar_mesa.c \
	$(MESASRCDIR)/shader/nvfragparse.c \
	$(MESASRCDIR)/shader/nvprogram.c \
	$(MESASRCDIR)/shader/nvvertexec.c \
	$(MESASRCDIR)/shader/nvvertparse.c \
	$(MESASRCDIR)/shader/program.c \
	$(MESASRCDIR)/shader/shaderobjects.c \
	$(MESASRCDIR)/shader/shaderobjects_3dlabs.c

MESA_SLANG_SRCS = \
	$(MESASRCDIR)/shader/slang/slang_assemble.c \
	$(MESASRCDIR)/shader/slang/slang_assemble_assignment.c \
	$(MESASRCDIR)/shader/slang/slang_assemble_conditional.c	\
	$(MESASRCDIR)/shader/slang/slang_assemble_constructor.c	\
	$(MESASRCDIR)/shader/slang/slang_assemble_typeinfo.c \
	$(MESASRCDIR)/shader/slang/slang_compile.c \
	$(MESASRCDIR)/shader/slang/slang_execute.c \
	$(MESASRCDIR)/shader/slang/slang_preprocess.c \
	$(MESASRCDIR)/shader/slang/slang_storage.c \
	$(MESASRCDIR)/shader/slang/slang_utility.c

MESA_SWRAST_SRCS = \
	$(MESASRCDIR)/swrast/s_aaline.c \
	$(MESASRCDIR)/swrast/s_aatriangle.c \
	$(MESASRCDIR)/swrast/s_accum.c \
	$(MESASRCDIR)/swrast/s_alpha.c \
	$(MESASRCDIR)/swrast/s_atifragshader.c \
	$(MESASRCDIR)/swrast/s_bitmap.c \
	$(MESASRCDIR)/swrast/s_blend.c \
	$(MESASRCDIR)/swrast/s_buffers.c \
	$(MESASRCDIR)/swrast/s_copypix.c \
	$(MESASRCDIR)/swrast/s_context.c \
	$(MESASRCDIR)/swrast/s_depth.c \
	$(MESASRCDIR)/swrast/s_drawpix.c \
	$(MESASRCDIR)/swrast/s_feedback.c \
	$(MESASRCDIR)/swrast/s_fog.c \
	$(MESASRCDIR)/swrast/s_imaging.c \
	$(MESASRCDIR)/swrast/s_lines.c \
	$(MESASRCDIR)/swrast/s_logic.c \
	$(MESASRCDIR)/swrast/s_masking.c \
	$(MESASRCDIR)/swrast/s_nvfragprog.c \
	$(MESASRCDIR)/swrast/s_points.c \
	$(MESASRCDIR)/swrast/s_readpix.c \
	$(MESASRCDIR)/swrast/s_span.c \
	$(MESASRCDIR)/swrast/s_stencil.c \
	$(MESASRCDIR)/swrast/s_texcombine.c \
	$(MESASRCDIR)/swrast/s_texfilter.c \
	$(MESASRCDIR)/swrast/s_texstore.c \
	$(MESASRCDIR)/swrast/s_triangle.c \
	$(MESASRCDIR)/swrast/s_zoom.c

MESA_SWRAST_SETUP_SRCS = \
	$(MESASRCDIR)/swrast_setup/ss_context.c \
	$(MESASRCDIR)/swrast_setup/ss_triangle.c

MESA_TNL_SRCS = \
	$(MESASRCDIR)/tnl/t_array_api.c \
	$(MESASRCDIR)/tnl/t_array_import.c \
	$(MESASRCDIR)/tnl/t_context.c \
	$(MESASRCDIR)/tnl/t_pipeline.c \
	$(MESASRCDIR)/tnl/t_save_api.c \
	$(MESASRCDIR)/tnl/t_save_loopback.c \
	$(MESASRCDIR)/tnl/t_save_playback.c \
	$(MESASRCDIR)/tnl/t_vb_cull.c \
	$(MESASRCDIR)/tnl/t_vb_fog.c \
	$(MESASRCDIR)/tnl/t_vb_light.c \
	$(MESASRCDIR)/tnl/t_vb_normals.c \
	$(MESASRCDIR)/tnl/t_vb_points.c \
	$(MESASRCDIR)/tnl/t_vb_program.c \
	$(MESASRCDIR)/tnl/t_vb_render.c \
	$(MESASRCDIR)/tnl/t_vb_texgen.c \
	$(MESASRCDIR)/tnl/t_vb_texmat.c \
	$(MESASRCDIR)/tnl/t_vb_vertex.c \
	$(MESASRCDIR)/tnl/t_vb_arbprogram.c \
	$(MESASRCDIR)/tnl/t_vertex.c \
	$(MESASRCDIR)/tnl/t_vertex_sse.c \
	$(MESASRCDIR)/tnl/t_vertex_generic.c \
	$(MESASRCDIR)/tnl/t_vp_build.c \
	$(MESASRCDIR)/tnl/t_vtx_api.c \
	$(MESASRCDIR)/tnl/t_vtx_eval.c \
	$(MESASRCDIR)/tnl/t_vtx_exec.c \
	$(MESASRCDIR)/tnl/t_vtx_generic.c \
	$(MESASRCDIR)/tnl/t_vtx_x86.c

MESA_MATH_SRCS = \
	$(MESASRCDIR)/math/m_debug_clip.c \
	$(MESASRCDIR)/math/m_debug_norm.c \
	$(MESASRCDIR)/math/m_debug_xform.c \
	$(MESASRCDIR)/math/m_debug_xform.c \
	$(MESASRCDIR)/math/m_eval.c \
	$(MESASRCDIR)/math/m_matrix.c \
	$(MESASRCDIR)/math/m_translate.c \
	$(MESASRCDIR)/math/m_vector.c \
	$(MESASRCDIR)/math/m_xform.c

MESA_COMMON_SRCS = \
	$(MESASRCDIR)/drivers/common/driverfuncs.c

MESA_X11_SRCS = \
	$(MESASRCDIR)/drivers/x11/xm_api.c \
	$(MESASRCDIR)/drivers/x11/xm_dd.c \
	$(MESASRCDIR)/drivers/x11/xm_line.c \
	$(MESASRCDIR)/drivers/x11/xm_span.c \
	$(MESASRCDIR)/drivers/x11/xm_tri.c \
	$(MESASRCDIR)/drivers/x11/xm_buffer.c

MESA_SRCS = \
	$(MESA_BASE_SRCS) \
	$(MESA_AC_SRCS) \
	$(MESA_SHADER_SRCS) \
	$(MESA_SLANG_SRCS) \
	$(MESA_SWRAST_SRCS) \
	$(MESA_SWRAST_SETUP_SRCS) \
	$(MESA_TNL_SRCS) \
	$(MESA_MATH_SRCS) \
	$(MESA_COMMON_SRCS) \
	$(MESA_X11_SRCS)

X_SRCS = \
	X/xf86glx.c \
	X/xf86glx_util.c \
	X/xf86glx_util.h \
	X/xf86glxint.h

libglcore_la_SOURCES = $(X_SRCS)
nodist_libglcore_la_SOURCES = $(MESA_SRCS)
libglcore_la_CFLAGS = -UHAVE_CONFIG_H -DGLXEXT -DXF86DRI \
	-DGLX_DIRECT_RENDERING -DGLX_USE_DLOPEN -DGLX_USE_MESA \
	-DXFree86Server -DUSE_MGL_NAMESPACE

dist-hook:
	mkdir -p $(MESADISTDIR)/include/GL
	cp -p @MESA_SOURCE@/include/GL/gl.h @MESA_SOURCE@/include/GL/glext.h \
	@MESA_SOURCE@/include/GL/gl_mangle.h @MESA_SOURCE@/include/GL/xmesa.h \
	@MESA_SOURCE@/include/GL/xmesa_xf86.h $(MESADISTDIR)/include/GL
	mkdir -p $(MESADISTDIR)/include/GL/internal
	cp -p @MESA_SOURCE@/include/GL/internal/glcore.h \
	$(MESADISTDIR)/include/GL/internal
	mkdir -p $(MESADISTSRCDIR)/main
	cp -p $(MESASRCDIR)/main/*.[ch] $(MESADISTSRCDIR)/main
	mkdir -p $(MESADISTSRCDIR)/glapi
	cp -p $(MESASRCDIR)/glapi/*.[ch] $(MESADISTSRCDIR)/glapi
	mkdir -p $(MESADISTSRCDIR)/array_cache
	cp -p $(MESASRCDIR)/array_cache/*.[ch] $(MESADISTSRCDIR)/array_cache
	mkdir -p $(MESADISTSRCDIR)/shader
	cp -p $(MESASRCDIR)/shader/*.[ch] $(MESADISTSRCDIR)/shader
	mkdir -p $(MESADISTSRCDIR)/shader/grammar
	cp -p $(MESASRCDIR)/shader/grammar/*.[ch] \
	$(MESADISTSRCDIR)/shader/grammar
	mkdir -p $(MESADISTSRCDIR)/shader/slang
	cp -p $(MESASRCDIR)/shader/slang/*.[ch] $(MESADISTSRCDIR)/shader/slang
	mkdir -p $(MESADISTSRCDIR)/shader/slang/library
	cp -p $(MESASRCDIR)/shader/slang/library/*.h \
	$(MESADISTSRCDIR)/shader/slang/library
	mkdir -p $(MESADISTSRCDIR)/swrast
	cp -p $(MESASRCDIR)/swrast/*.[ch] $(MESADISTSRCDIR)/swrast
	mkdir -p $(MESADISTSRCDIR)/swrast_setup
	cp -p $(MESASRCDIR)/swrast_setup/*.[ch] $(MESADISTSRCDIR)/swrast_setup
	mkdir -p $(MESADISTSRCDIR)/tnl
	cp -p $(MESASRCDIR)/tnl/*.[ch] $(MESADISTSRCDIR)/tnl
	mkdir -p $(MESADISTSRCDIR)/math
	cp -p $(MESASRCDIR)/math/*.[ch] $(MESADISTSRCDIR)/math
	mkdir -p $(MESADISTSRCDIR)/drivers/common
	cp -p $(MESASRCDIR)/drivers/common/*.[ch] \
	$(MESADISTSRCDIR)/drivers/common
	mkdir -p $(MESADISTSRCDIR)/drivers/x11
	cp -p $(MESASRCDIR)/drivers/x11/*.[ch] $(MESADISTSRCDIR)/drivers/x11
