blob: be1ed5f60304d1d4d288071cb486b362f225769c [file] [log] [blame]
José Fonsecac42e6252008-01-31 13:14:35 +09001#######################################################################
José Fonseca33ceb672008-02-18 10:52:44 +00002# SConscript for Mesa
José Fonsecac42e6252008-01-31 13:14:35 +09003
4
5Import('*')
Brian Paulf83af362011-09-28 08:15:22 -06006import filecmp
7import os
8import subprocess
Brian Pauldff36e92012-05-30 10:08:11 -06009from sys import executable as python_cmd
José Fonsecac42e6252008-01-31 13:14:35 +090010
José Fonseca601498a2010-11-01 13:30:22 +000011env = env.Clone()
José Fonsecab9da3792008-02-19 15:07:53 +090012
José Fonseca601498a2010-11-01 13:30:22 +000013env.Append(CPPPATH = [
14 '#/src/mapi',
15 '#/src/glsl',
16 '#/src/mesa',
17])
José Fonseca2105b612009-01-06 16:20:12 +000018
Imre Deak66781252012-09-12 19:46:05 +030019enabled_apis = []
20enabled_apis += ['GL']
Chia-I Wubb770af2011-01-14 17:50:29 +080021
José Fonseca601498a2010-11-01 13:30:22 +000022if env['platform'] == 'windows':
23 env.Append(CPPDEFINES = [
24 '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
25 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
José Fonseca601498a2010-11-01 13:30:22 +000026 ])
Chia-I Wubb770af2011-01-14 17:50:29 +080027 if not env['gles']:
28 # prevent _glapi_* from being declared __declspec(dllimport)
29 env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
Chia-I Wubb045d32010-11-20 17:47:11 -080030else:
31 env.Append(CPPDEFINES = [
32 'IN_DRI_DRIVER', # enable the remap table (for DRI drivers)
Tapani Pälli91214602012-08-28 14:01:51 +030033 ('HAVE_DLOPEN', '1'),
Chia-I Wubb045d32010-11-20 17:47:11 -080034 ])
José Fonseca5c9c6b02008-06-04 23:56:57 +090035
José Fonseca601498a2010-11-01 13:30:22 +000036#
37# Source files
38#
Michal Krol3371f7e2009-11-25 14:52:21 +010039
José Fonseca601498a2010-11-01 13:30:22 +000040main_sources = [
41 'main/api_arrayelt.c',
42 'main/api_exec.c',
43 'main/api_loopback.c',
José Fonseca601498a2010-11-01 13:30:22 +000044 'main/api_validate.c',
45 'main/accum.c',
46 'main/arbprogram.c',
47 'main/atifragshader.c',
48 'main/attrib.c',
49 'main/arrayobj.c',
50 'main/blend.c',
51 'main/bufferobj.c',
52 'main/buffers.c',
53 'main/clear.c',
54 'main/clip.c',
55 'main/colortab.c',
56 'main/condrender.c',
57 'main/context.c',
58 'main/convolve.c',
59 'main/cpuinfo.c',
60 'main/debug.c',
61 'main/depth.c',
José Fonseca601498a2010-11-01 13:30:22 +000062 'main/dlist.c',
José Fonseca601498a2010-11-01 13:30:22 +000063 'main/drawpix.c',
64 'main/drawtex.c',
65 'main/enable.c',
66 'main/enums.c',
nobled5ab088c2011-05-01 12:47:31 +000067 'main/errors.c',
Vinson Lee5cbc0f02012-11-06 23:16:29 -080068 'main/es1_conversion.c',
José Fonseca601498a2010-11-01 13:30:22 +000069 'main/eval.c',
70 'main/execmem.c',
71 'main/extensions.c',
72 'main/fbobject.c',
73 'main/feedback.c',
Vinson Leedee6eaf2011-03-11 13:32:41 -080074 'main/ff_fragment_shader.cpp',
José Fonseca601498a2010-11-01 13:30:22 +000075 'main/ffvertex_prog.c',
76 'main/fog.c',
77 'main/formats.c',
Brian Paulaa6cb952011-12-03 10:04:18 -070078 'main/format_pack.c',
Brian Paul730952a2011-09-08 20:16:18 -060079 'main/format_unpack.c',
José Fonseca601498a2010-11-01 13:30:22 +000080 'main/framebuffer.c',
José Fonseca601498a2010-11-01 13:30:22 +000081 'main/getstring.c',
Jordan Justen9ad8f432012-06-25 10:52:39 -070082 'main/glformats.c',
José Fonseca601498a2010-11-01 13:30:22 +000083 'main/hash.c',
Eric Anholt35fd61b2012-11-06 23:18:41 -080084 'main/hash_table.c',
José Fonseca601498a2010-11-01 13:30:22 +000085 'main/hint.c',
86 'main/histogram.c',
87 'main/image.c',
88 'main/imports.c',
89 'main/light.c',
90 'main/lines.c',
91 'main/matrix.c',
92 'main/mipmap.c',
93 'main/mm.c',
94 'main/multisample.c',
José Fonseca601498a2010-11-01 13:30:22 +000095 'main/pack.c',
Brian Paulb70610b2011-02-28 18:24:35 -070096 'main/pbo.c',
José Fonseca601498a2010-11-01 13:30:22 +000097 'main/pixel.c',
98 'main/pixelstore.c',
99 'main/pixeltransfer.c',
100 'main/points.c',
101 'main/polygon.c',
102 'main/querymatrix.c',
103 'main/queryobj.c',
104 'main/rastpos.c',
105 'main/readpix.c',
106 'main/remap.c',
107 'main/renderbuffer.c',
Brian Paul34a5d3b2011-04-10 12:48:28 -0600108 'main/samplerobj.c',
José Fonseca601498a2010-11-01 13:30:22 +0000109 'main/scissor.c',
110 'main/shaderapi.c',
111 'main/shaderobj.c',
Brian Paul6399b7d2011-10-04 15:59:09 -0600112 'main/shader_query.cpp',
José Fonseca601498a2010-11-01 13:30:22 +0000113 'main/shared.c',
114 'main/state.c',
115 'main/stencil.c',
116 'main/syncobj.c',
117 'main/texcompress.c',
Brian Paulc1a9e602012-08-21 20:22:27 -0600118 'main/texcompress_cpal.c',
Vinson Lee93893132011-02-27 23:17:49 -0800119 'main/texcompress_rgtc.c',
José Fonseca601498a2010-11-01 13:30:22 +0000120 'main/texcompress_s3tc.c',
121 'main/texcompress_fxt1.c',
Chia-I Wu51f4d272011-11-28 23:55:31 +0800122 'main/texcompress_etc.c',
José Fonseca601498a2010-11-01 13:30:22 +0000123 'main/texenv.c',
José Fonseca601498a2010-11-01 13:30:22 +0000124 'main/texformat.c',
125 'main/texgen.c',
126 'main/texgetimage.c',
127 'main/teximage.c',
128 'main/texobj.c',
José Fonseca601498a2010-11-01 13:30:22 +0000129 'main/texparam.c',
José Fonseca601498a2010-11-01 13:30:22 +0000130 'main/texstate.c',
Brian Paul29eb2e82011-10-31 10:52:56 -0600131 'main/texstorage.c',
José Fonseca601498a2010-11-01 13:30:22 +0000132 'main/texstore.c',
Marek Olšákd0e805e2011-03-15 16:25:16 +0100133 'main/texturebarrier.c',
José Fonseca601498a2010-11-01 13:30:22 +0000134 'main/transformfeedback.c',
Vinson Lee116b7bb2011-10-18 18:39:11 -0700135 'main/uniform_query.cpp',
José Fonseca601498a2010-11-01 13:30:22 +0000136 'main/uniforms.c',
137 'main/varray.c',
138 'main/version.c',
139 'main/viewport.c',
140 'main/vtxfmt.c',
141]
José Fonseca5c9c6b02008-06-04 23:56:57 +0900142
Imre Deak98f880e2012-09-10 08:46:13 +0300143glget_sources = [
144 'main/get.c',
145]
146
José Fonseca601498a2010-11-01 13:30:22 +0000147math_sources = [
148 'math/m_debug_clip.c',
149 'math/m_debug_norm.c',
150 'math/m_debug_xform.c',
151 'math/m_eval.c',
152 'math/m_matrix.c',
153 'math/m_translate.c',
154 'math/m_vector.c',
155 'math/m_xform.c',
156]
157
José Fonseca8e8a56e2011-04-23 12:22:59 +0100158swrast_sources = [
159 'swrast/s_aaline.c',
160 'swrast/s_aatriangle.c',
José Fonseca8e8a56e2011-04-23 12:22:59 +0100161 'swrast/s_alpha.c',
162 'swrast/s_atifragshader.c',
163 'swrast/s_bitmap.c',
164 'swrast/s_blend.c',
165 'swrast/s_blit.c',
166 'swrast/s_clear.c',
167 'swrast/s_copypix.c',
168 'swrast/s_context.c',
169 'swrast/s_depth.c',
170 'swrast/s_drawpix.c',
171 'swrast/s_feedback.c',
172 'swrast/s_fog.c',
173 'swrast/s_fragprog.c',
174 'swrast/s_lines.c',
175 'swrast/s_logic.c',
176 'swrast/s_masking.c',
177 'swrast/s_points.c',
Brian Paulb85284f2011-12-05 20:40:48 -0700178 'swrast/s_renderbuffer.c',
José Fonseca8e8a56e2011-04-23 12:22:59 +0100179 'swrast/s_span.c',
180 'swrast/s_stencil.c',
181 'swrast/s_texcombine.c',
Brian Paulbaeefef2011-09-17 14:50:48 -0600182 'swrast/s_texfetch.c',
José Fonseca8e8a56e2011-04-23 12:22:59 +0100183 'swrast/s_texfilter.c',
Brian Paul755f2e22011-06-13 13:44:35 -0600184 'swrast/s_texrender.c',
Brian Paul6f1846e2011-08-29 11:37:13 -0600185 'swrast/s_texture.c',
José Fonseca8e8a56e2011-04-23 12:22:59 +0100186 'swrast/s_triangle.c',
187 'swrast/s_zoom.c',
188]
189
190swrast_setup_sources = [
191 'swrast_setup/ss_context.c',
192 'swrast_setup/ss_triangle.c',
193]
194
195tnl_sources = [
196 'tnl/t_context.c',
197 'tnl/t_pipeline.c',
198 'tnl/t_draw.c',
199 'tnl/t_rasterpos.c',
200 'tnl/t_vb_program.c',
201 'tnl/t_vb_render.c',
202 'tnl/t_vb_texgen.c',
203 'tnl/t_vb_texmat.c',
204 'tnl/t_vb_vertex.c',
205 'tnl/t_vb_fog.c',
206 'tnl/t_vb_light.c',
207 'tnl/t_vb_normals.c',
208 'tnl/t_vb_points.c',
209 'tnl/t_vp_build.c',
210 'tnl/t_vertex.c',
211 'tnl/t_vertex_sse.c',
212 'tnl/t_vertex_generic.c',
213]
214
José Fonseca601498a2010-11-01 13:30:22 +0000215vbo_sources = [
216 'vbo/vbo_context.c',
217 'vbo/vbo_exec.c',
218 'vbo/vbo_exec_api.c',
219 'vbo/vbo_exec_array.c',
220 'vbo/vbo_exec_draw.c',
221 'vbo/vbo_exec_eval.c',
Brian Paule6c41592011-11-09 17:22:47 -0700222 'vbo/vbo_noop.c',
Jordan Justenbc8e0f52012-05-07 15:50:21 -0700223 'vbo/vbo_primitive_restart.c',
José Fonseca601498a2010-11-01 13:30:22 +0000224 'vbo/vbo_rebase.c',
225 'vbo/vbo_split.c',
226 'vbo/vbo_split_copy.c',
227 'vbo/vbo_split_inplace.c',
228 'vbo/vbo_save.c',
229 'vbo/vbo_save_api.c',
230 'vbo/vbo_save_draw.c',
231 'vbo/vbo_save_loopback.c',
232]
233
José Fonseca601498a2010-11-01 13:30:22 +0000234statetracker_sources = [
235 'state_tracker/st_atom.c',
Brian Paul4d9f2632012-06-15 09:31:15 -0600236 'state_tracker/st_atom_array.c',
José Fonseca601498a2010-11-01 13:30:22 +0000237 'state_tracker/st_atom_blend.c',
238 'state_tracker/st_atom_clip.c',
239 'state_tracker/st_atom_constbuf.c',
240 'state_tracker/st_atom_depth.c',
241 'state_tracker/st_atom_framebuffer.c',
242 'state_tracker/st_atom_msaa.c',
243 'state_tracker/st_atom_pixeltransfer.c',
244 'state_tracker/st_atom_sampler.c',
245 'state_tracker/st_atom_scissor.c',
246 'state_tracker/st_atom_shader.c',
247 'state_tracker/st_atom_rasterizer.c',
248 'state_tracker/st_atom_stipple.c',
249 'state_tracker/st_atom_texture.c',
250 'state_tracker/st_atom_viewport.c',
José Fonseca601498a2010-11-01 13:30:22 +0000251 'state_tracker/st_cb_bitmap.c',
252 'state_tracker/st_cb_blit.c',
253 'state_tracker/st_cb_bufferobjects.c',
254 'state_tracker/st_cb_clear.c',
255 'state_tracker/st_cb_condrender.c',
256 'state_tracker/st_cb_flush.c',
257 'state_tracker/st_cb_drawpixels.c',
258 'state_tracker/st_cb_drawtex.c',
259 'state_tracker/st_cb_eglimage.c',
260 'state_tracker/st_cb_fbo.c',
261 'state_tracker/st_cb_feedback.c',
262 'state_tracker/st_cb_program.c',
263 'state_tracker/st_cb_queryobj.c',
264 'state_tracker/st_cb_rasterpos.c',
265 'state_tracker/st_cb_readpixels.c',
Marek Olšák5257a6d2011-03-05 20:32:28 +0100266 'state_tracker/st_cb_syncobj.c',
José Fonseca601498a2010-11-01 13:30:22 +0000267 'state_tracker/st_cb_strings.c',
268 'state_tracker/st_cb_texture.c',
Marek Olšákaea4ed42011-03-08 11:32:35 +0100269 'state_tracker/st_cb_texturebarrier.c',
José Fonseca601498a2010-11-01 13:30:22 +0000270 'state_tracker/st_cb_viewport.c',
271 'state_tracker/st_cb_xformfb.c',
272 'state_tracker/st_context.c',
273 'state_tracker/st_debug.c',
274 'state_tracker/st_draw.c',
275 'state_tracker/st_draw_feedback.c',
276 'state_tracker/st_extensions.c',
277 'state_tracker/st_format.c',
Brian Pauld7f2e382011-08-04 15:55:13 -0600278 'state_tracker/st_glsl_to_tgsi.cpp',
José Fonseca601498a2010-11-01 13:30:22 +0000279 'state_tracker/st_gen_mipmap.c',
280 'state_tracker/st_manager.c',
281 'state_tracker/st_mesa_to_tgsi.c',
282 'state_tracker/st_program.c',
283 'state_tracker/st_texture.c',
284]
285
Brian Paule78ebbc2012-09-15 09:01:02 -0600286env.Append(YACCFLAGS = '-d -p "_mesa_program_"')
Kenneth Graunke8be58df2011-03-01 15:04:04 -0800287program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l')
288program_parse = env.CFile('program/program_parse.tab.c',
289 'program/program_parse.y')
José Fonsecadbfbb8c2011-03-03 15:43:18 +0000290
291# Make program/program_parse.tab.h reacheable from the include path
José Fonseca5d0e8be2011-03-03 16:57:38 +0000292env.Append(CPPPATH = [Dir('.').abspath])
José Fonsecadbfbb8c2011-03-03 15:43:18 +0000293
José Fonseca601498a2010-11-01 13:30:22 +0000294program_sources = [
295 'program/arbprogparse.c',
296 'program/hash_table.c',
297 'program/ir_to_mesa.cpp',
José Fonseca601498a2010-11-01 13:30:22 +0000298 'program/program.c',
José Fonseca601498a2010-11-01 13:30:22 +0000299 'program/program_parse_extra.c',
300 'program/prog_cache.c',
301 'program/prog_execute.c',
302 'program/prog_instruction.c',
303 'program/prog_noise.c',
304 'program/prog_optimize.c',
Ian Romanick54c48a92011-02-10 15:48:27 -0800305 'program/prog_opt_constant_fold.c',
José Fonseca601498a2010-11-01 13:30:22 +0000306 'program/prog_parameter.c',
307 'program/prog_parameter_layout.c',
308 'program/prog_print.c',
309 'program/prog_statevars.c',
José Fonseca601498a2010-11-01 13:30:22 +0000310 'program/programopt.c',
311 'program/sampler.cpp',
312 'program/symbol_table.c',
Brian Paul6399b7d2011-10-04 15:59:09 -0600313 'program/string_to_uint_map.cpp',
Kenneth Graunke8be58df2011-03-01 15:04:04 -0800314 program_lex,
315 program_parse[0],
José Fonseca601498a2010-11-01 13:30:22 +0000316]
317
José Fonseca8e8a56e2011-04-23 12:22:59 +0100318common_driver_sources = [
319 'drivers/common/driverfuncs.c',
320 'drivers/common/meta.c',
321]
322
José Fonseca601498a2010-11-01 13:30:22 +0000323mesa_sources = (
324 main_sources +
Imre Deak98f880e2012-09-10 08:46:13 +0300325 glget_sources +
José Fonseca601498a2010-11-01 13:30:22 +0000326 math_sources +
327 program_sources +
328 vbo_sources +
José Fonseca8e8a56e2011-04-23 12:22:59 +0100329 tnl_sources +
330 swrast_sources +
331 swrast_setup_sources +
332 common_driver_sources +
José Fonseca601498a2010-11-01 13:30:22 +0000333 statetracker_sources
334)
335
Brian Pauldff36e92012-05-30 10:08:11 -0600336GLAPI = '#src/mapi/glapi/'
337
Chia-I Wubb770af2011-01-14 17:50:29 +0800338if env['gles']:
Chia-I Wubb770af2011-01-14 17:50:29 +0800339
Imre Deak66781252012-09-12 19:46:05 +0300340 enabled_apis += ['ES1', 'ES2']
Chia-I Wubb770af2011-01-14 17:50:29 +0800341
342 # generate GLES sources
Vinson Lee5cbc0f02012-11-06 23:16:29 -0800343 gles_sources = []
Chia-I Wubb770af2011-01-14 17:50:29 +0800344
345 # generate GLES headers
Chia-I Wubb770af2011-01-14 17:50:29 +0800346 gles_headers = []
Chia-I Wubb770af2011-01-14 17:50:29 +0800347
348 env.Depends(gles_sources, gles_headers)
349
350 # gles_sources #include gles_headers with full path
351 env.Append(CPPPATH = [gles_headers[0].dir.up().up()])
352
353 mesa_sources += gles_sources
354
Imre Deak66781252012-09-12 19:46:05 +0300355env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis])
356
Imre Deak98f880e2012-09-10 08:46:13 +0300357get_hash_gen_opts = ' '.join(["-a %s" % api for api in enabled_apis])
358
359get_hash_header = env.CodeGenerate(
360 target = 'main/get_hash.h',
361 script = 'main/get_hash_generator.py',
362 source = GLAPI + 'gen/gl_and_es_API.xml',
363 command = python_cmd + ' $SCRIPT ' + get_hash_gen_opts +
364 ' -f $SOURCE > $TARGET'
365)
366
367env.Depends(glget_sources, get_hash_header)
368
José Fonseca601498a2010-11-01 13:30:22 +0000369#
370# Assembly sources
371#
Vinson Lee9549e552012-09-27 23:21:09 -0700372if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows'):
José Fonsecaf9156eb2010-11-01 13:56:16 +0000373 if env['machine'] == 'x86':
374 env.Append(CPPDEFINES = [
375 'USE_X86_ASM',
376 'USE_MMX_ASM',
377 'USE_3DNOW_ASM',
378 'USE_SSE_ASM',
379 ])
380 mesa_sources += [
381 'x86/common_x86.c',
382 'x86/x86_xform.c',
383 'x86/3dnow.c',
384 'x86/sse.c',
385 'x86/common_x86_asm.S',
386 'x86/x86_xform2.S',
387 'x86/x86_xform3.S',
388 'x86/x86_xform4.S',
389 'x86/x86_cliptest.S',
390 'x86/mmx_blend.S',
391 'x86/3dnow_xform1.S',
392 'x86/3dnow_xform2.S',
393 'x86/3dnow_xform3.S',
394 'x86/3dnow_xform4.S',
395 'x86/3dnow_normal.S',
396 'x86/sse_xform1.S',
397 'x86/sse_xform2.S',
398 'x86/sse_xform3.S',
399 'x86/sse_xform4.S',
400 'x86/sse_normal.S',
401 'x86/read_rgba_span_x86.S',
402 ]
403 elif env['machine'] == 'x86_64':
404 env.Append(CPPDEFINES = [
405 'USE_X86_64_ASM',
406 ])
407 mesa_sources += [
408 'x86-64/x86-64.c',
409 'x86-64/xform4.S',
410 ]
José Fonsecaf9156eb2010-11-01 13:56:16 +0000411 elif env['machine'] == 'sparc':
412 mesa_sources += [
413 'sparc/sparc.c',
Jon TURNEY86768902012-07-07 00:53:31 +0100414 'sparc/sparc_clip.S',
José Fonsecaf9156eb2010-11-01 13:56:16 +0000415 'sparc/norm.S',
416 'sparc/xform.S',
417 ]
418 else:
419 pass
José Fonseca601498a2010-11-01 13:30:22 +0000420
José Fonsecaf9156eb2010-11-01 13:56:16 +0000421 # Generate matypes.h
422 if env['machine'] in ('x86', 'x86_64'):
423 # See http://www.scons.org/wiki/UsingCodeGenerators
424 gen_matypes = env.Program(
425 target = 'gen_matypes',
426 source = 'x86/gen_matypes.c',
427 )
428 matypes = env.Command(
429 'matypes.h',
430 gen_matypes,
431 gen_matypes[0].abspath + ' > $TARGET',
432 )
433 # Add the dir containing the generated header (somewhere inside the
434 # build dir) to the include path
435 env.Append(CPPPATH = [matypes[0].dir])
José Fonseca601498a2010-11-01 13:30:22 +0000436
Brian Paul0c245502011-04-05 14:07:41 -0600437
Brian Pauldff36e92012-05-30 10:08:11 -0600438# The enums.c file is generated from the GL/ES API.xml file
439env.CodeGenerate(
440 target = 'main/enums.c',
441 script = GLAPI + 'gen/gl_enums.py',
442 source = GLAPI + 'gen/gl_and_es_API.xml',
443 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
444 )
445
Paul Berry98874ec2012-10-31 10:42:08 -0700446# The api_exec.c file is generated from the GL/ES API.xml file
447env.CodeGenerate(
448 target = 'main/api_exec.c',
449 script = GLAPI + 'gen/gl_genexec.py',
450 source = GLAPI + 'gen/gl_and_es_API.xml',
451 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
452 )
453
Brian Pauldff36e92012-05-30 10:08:11 -0600454# We also depend on the auto-generated GL API headers
455env.Depends(mesa_sources, glapi_headers)
Brian Paulf83af362011-09-28 08:15:22 -0600456
457
458def write_git_sha1_h_file(filename):
459 """Mesa looks for a git_sha1.h file at compile time in order to display
460 the current git hash id in the GL_VERSION string. This function tries
461 to retrieve the git hashid and write the header file. An empty file
462 will be created if anything goes wrong."""
463
464 args = [ 'git', 'log', '-n', '1', '--oneline' ]
465 try:
466 (commit, foo) = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
467 except:
468 # git log command didn't work
469 if not os.path.exists(filename):
470 # create an empty file if none already exists
471 f = open(filename, "w")
472 f.close()
473 return
474
Brian Pauld487cc22011-09-28 09:51:36 -0600475 commit = '#define MESA_GIT_SHA1 "git-%s"\n' % commit[0:7]
Brian Paulf83af362011-09-28 08:15:22 -0600476 tempfile = "git_sha1.h.tmp"
477 f = open(tempfile, "w")
478 f.write(commit)
Vinson Lee622ee082011-04-05 15:32:39 -0700479 f.close()
Brian Paulf83af362011-09-28 08:15:22 -0600480 if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename):
481 # The filename does not exist or it's different from the new file,
482 # so replace old file with new.
Brian Paule1122872011-09-28 09:04:03 -0600483 if os.path.exists(filename):
484 os.remove(filename)
Brian Paulf83af362011-09-28 08:15:22 -0600485 os.rename(tempfile, filename)
486 return
487
488
489# Create the git_sha1.h header file
490write_git_sha1_h_file("main/git_sha1.h")
Vinson Lee622ee082011-04-05 15:32:39 -0700491# and update CPPPATH so the git_sha1.h header can be found
492env.Append(CPPPATH = ["#" + env['build_dir'] + "/mesa/main"])
Brian Paul0c245502011-04-05 14:07:41 -0600493
494
José Fonseca601498a2010-11-01 13:30:22 +0000495#
496# Libraries
497#
498
499mesa = env.ConvenienceLibrary(
500 target = 'mesa',
501 source = mesa_sources,
502)
503
504env.Alias('mesa', mesa)
505
506Export('mesa')
José Fonseca8e8a56e2011-04-23 12:22:59 +0100507
508SConscript('drivers/SConscript')