Import('env')

if not env['GLUT']:
    Return()

env = env.Clone()

env.Prepend(LIBS = ['$GLUT_LIB'])

progs = [
    'clear-fbo-tex',
	'clear-fbo',
	'clear-scissor',
	'clear-undefined',
	'clear-repeat',
	'clear',
	'dlist-dangling',
	'dlist-edgeflag-dangling',
	'dlist-edgeflag',
	'dlist-degenerate',
	'drawarrays',
	'draw2arrays',
	'drawelements',
	'drawrange',
	'flat-clip',
	'fs-tri',
	'line-clip',
	'line-cull',
	'line-flat',
	'line-smooth',
	'line-stipple-wide',
	'line-userclip-clip',
	'line-userclip-nop-clip',
	'line-userclip-nop',
	'line-userclip',
	'line-wide',
	'line',
	'lineloop-clip',
	'lineloop-elts',
	'lineloop',
	'linestrip-flat-stipple',
	'linestrip-stipple-wide',
	'linestrip-stipple',
	'linestrip',
	'long-fixed-func',
	'pgon-mode',
	'point-clip',
	'point-param',
	'point-sprite',
	'point-wide',
	'point-wide-smooth',
	'point',
	'poly-flat',
	'poly-flat-clip',
	'poly-flat-unfilled-clip',
	'poly-unfilled',
	'poly',
	'quad-clip-all-vertices',
	'quad-clip-nearplane',
	'quad-clip',
	'quad-degenerate',
	'quad-flat',
	'quad-offset-factor',
	'quad-offset-unfilled',
	'quad-offset-units',
	'quad-tex-2d',
	'quad-tex-3d',
	'quad-tex-alpha',
	'quad-tex-pbo',
	'quad-tex-sub',
	'quad-unfilled-clip',
	'quad-unfilled-stipple',
	'quad-unfilled',
	'quad',
	'quads',
	'quadstrip-clip',
	'quadstrip-cont',
	'quadstrip-flat',
	'quadstrip',
	'tri-alpha',
	'tri-blend-color',
	'tri-blend-max',
	'tri-blend-min',
	'tri-blend-revsub',
	'tri-blend-sub',
	'tri-blend',
	'tri-clip',
	'tri-clear',
	'tri-cull-both',
	'tri-cull',
	'tri-dlist',
	'tri-edgeflag',
	'tri-fbo-tex-mip',
	'tri-fbo-tex',
	'tri-fbo',
	'tri-flat-clip',
	'tri-flat',
	'tri-fog',
	'tri-fp',
	'tri-fp-const-imm',
	'tri-lit',
	'tri-logicop-none',
	'tri-logicop-xor',
	'tri-mask-tri',
	'tri-orig',
	'tri-query',
	'tri-repeat',
	'tri-scissor-tri',
	'tri-stencil',
	'tri-stipple',
	'tri-multitex-vbo',
	'tri-tex',
	'tri-tex-3d',
	'tri-tri',
	'tri-unfilled-fog',
	'tri-unfilled-edgeflag',
	'tri-unfilled-clip',
	'tri-unfilled-smooth',
	'tri-unfilled-tri',
	'tri-unfilled-tri-lit',
	'tri-unfilled-userclip-stip',
	'tri-unfilled-userclip',
	'tri-unfilled',
	'tri-userclip',
	'tri-viewport',
	'tri-z-eq',
	'tri-z',
	'tri',
	'trifan-flat',
	'trifan-flat-clip',
	'trifan-flat-unfilled-clip',
	'trifan-unfilled',
	'trifan',
	'tristrip-clip',
	'tristrip-flat',
	'tristrip',
	'vbo-drawarrays',
	'vbo-noninterleaved',
	'vbo-drawelements',
	'vbo-drawrange',
	'vp-array',
	'vp-array-int',
	'vp-clip',
	'vp-line-clip',
	'vp-tri',
	'vp-tri-invariant',
	'vp-tri-swap',
	'vp-tri-tex',
	'vp-tri-imm',
	'vp-tri-cb',
	'vp-tri-cb-pos',
	'vp-tri-cb-tex',
	'vp-unfilled',
]

for prog in progs:
    prog = env.Program(
        target = prog,
        source = prog + '.c',
    )

# auto code generation
#getprocaddress: getprocaddress.c getproclist.h

#getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
#	python getprocaddress.py > getproclist.h


#readtex.h: $(TOP)/progs/util/readtex.h
#	ln -s $(TOP)/progs/util/readtex.h .

#readtex.c: $(TOP)/progs/util/readtex.c
#	ln -s $(TOP)/progs/util/readtex.c .


#extfuncs.h:  $(TOP)/progs/util/extfuncs.h
#	cp $< .