blob: c88af96898ba96dd2570bc99cc12228c31a3ccd8 [file] [log] [blame]
José Fonsecab04aa712008-06-06 14:48:57 +09001"""gallium
2
3Frontend-tool for Gallium3D architecture.
4
5"""
6
José Fonseca381e3482008-07-17 11:23:43 +09007#
José Fonsecab04aa712008-06-06 14:48:57 +09008# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
9# All Rights Reserved.
José Fonseca381e3482008-07-17 11:23:43 +090010#
José Fonsecab04aa712008-06-06 14:48:57 +090011# Permission is hereby granted, free of charge, to any person obtaining a
12# copy of this software and associated documentation files (the
13# "Software"), to deal in the Software without restriction, including
14# without limitation the rights to use, copy, modify, merge, publish,
15# distribute, sub license, and/or sell copies of the Software, and to
16# permit persons to whom the Software is furnished to do so, subject to
17# the following conditions:
José Fonseca381e3482008-07-17 11:23:43 +090018#
José Fonsecab04aa712008-06-06 14:48:57 +090019# The above copyright notice and this permission notice (including the
20# next paragraph) shall be included in all copies or substantial portions
21# of the Software.
José Fonseca381e3482008-07-17 11:23:43 +090022#
José Fonsecab04aa712008-06-06 14:48:57 +090023# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
26# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
27# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
José Fonseca381e3482008-07-17 11:23:43 +090030#
José Fonsecab04aa712008-06-06 14:48:57 +090031
32
Vinson Lee7d29afb2010-01-26 22:56:58 -080033import distutils.version
José Fonseca27d8d6f2008-07-03 12:42:23 +090034import os
José Fonsecab04aa712008-06-06 14:48:57 +090035import os.path
José Fonseca27d8d6f2008-07-03 12:42:23 +090036import re
José Fonsecab04aa712008-06-06 14:48:57 +090037
38import SCons.Action
39import SCons.Builder
José Fonseca27d8d6f2008-07-03 12:42:23 +090040import SCons.Scanner
José Fonsecab04aa712008-06-06 14:48:57 +090041
José Fonseca27d8d6f2008-07-03 12:42:23 +090042
José Fonseca52c2dd12008-09-08 07:54:15 +090043def symlink(target, source, env):
44 target = str(target[0])
45 source = str(source[0])
46 if os.path.islink(target) or os.path.exists(target):
47 os.remove(target)
48 os.symlink(os.path.basename(source), target)
49
José Fonseca8a318ed2010-01-01 22:35:28 +000050def install(env, source, subdir):
51 target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], subdir)
52 env.Install(target_dir, source)
José Fonsecab5a408b2009-12-23 15:21:56 +000053
José Fonseca8a318ed2010-01-01 22:35:28 +000054def install_program(env, source):
55 install(env, source, 'bin')
56
57def install_shared_library(env, sources, version = ()):
58 install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'])
José Fonseca52c2dd12008-09-08 07:54:15 +090059 version = tuple(map(str, version))
José Fonseca8a318ed2010-01-01 22:35:28 +000060 if env['SHLIBSUFFIX'] == '.dll':
61 dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX')
62 install(env, dlls, 'bin')
63 libs = env.FindIxes(sources, 'LIBPREFIX', 'LIBSUFFIX')
64 install(env, libs, 'lib')
José Fonsecab2e40642010-01-01 21:54:51 +000065 else:
José Fonseca8a318ed2010-01-01 22:35:28 +000066 for source in sources:
67 target_dir = os.path.join(install_dir, 'lib')
68 target_name = '.'.join((str(source),) + version)
69 last = env.InstallAs(os.path.join(target_dir, target_name), source)
70 while len(version):
71 version = version[:-1]
72 target_name = '.'.join((str(source),) + version)
73 action = SCons.Action.Action(symlink, "$TARGET -> $SOURCE")
74 last = env.Command(os.path.join(target_dir, target_name), last, action)
José Fonseca52c2dd12008-09-08 07:54:15 +090075
76def createInstallMethods(env):
José Fonsecab5a408b2009-12-23 15:21:56 +000077 env.AddMethod(install_program, 'InstallProgram')
José Fonseca52c2dd12008-09-08 07:54:15 +090078 env.AddMethod(install_shared_library, 'InstallSharedLibrary')
79
80
José Fonseca1e8177e2009-02-10 18:11:56 +000081def num_jobs():
82 try:
83 return int(os.environ['NUMBER_OF_PROCESSORS'])
84 except (ValueError, KeyError):
85 pass
86
87 try:
88 return os.sysconf('SC_NPROCESSORS_ONLN')
89 except (ValueError, OSError, AttributeError):
90 pass
91
92 try:
93 return int(os.popen2("sysctl -n hw.ncpu")[1].read())
94 except ValueError:
95 pass
96
97 return 1
98
99
José Fonsecab04aa712008-06-06 14:48:57 +0900100def generate(env):
José Fonseca381e3482008-07-17 11:23:43 +0900101 """Common environment generation code"""
José Fonsecab04aa712008-06-06 14:48:57 +0900102
José Fonseca6cf59e12008-11-18 19:13:32 +0900103 # Toolchain
104 platform = env['platform']
105 if env['toolchain'] == 'default':
106 if platform == 'winddk':
Michal Krol4f3dcf32008-11-19 20:31:38 +0100107 env['toolchain'] = 'winddk'
José Fonseca6cf59e12008-11-18 19:13:32 +0900108 elif platform == 'wince':
Michal Krol4f3dcf32008-11-19 20:31:38 +0100109 env['toolchain'] = 'wcesdk'
José Fonseca6cf59e12008-11-18 19:13:32 +0900110 env.Tool(env['toolchain'])
111
José Fonseca26e27ba2009-03-25 19:24:16 +0000112 env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
113 env['msvc'] = env['CC'] == 'cl'
114
José Fonseca381e3482008-07-17 11:23:43 +0900115 # shortcuts
116 debug = env['debug']
117 machine = env['machine']
118 platform = env['platform']
119 x86 = env['machine'] == 'x86'
Michel Dänzer6b69e3c2008-10-23 10:28:48 +0200120 ppc = env['machine'] == 'ppc'
José Fonseca26e27ba2009-03-25 19:24:16 +0000121 gcc = env['gcc']
122 msvc = env['msvc']
José Fonsecab04aa712008-06-06 14:48:57 +0900123
José Fonseca381e3482008-07-17 11:23:43 +0900124 # Put build output in a separate dir, which depends on the current
125 # configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
126 build_topdir = 'build'
127 build_subdir = env['platform']
José Fonseca381e3482008-07-17 11:23:43 +0900128 if env['llvm']:
129 build_subdir += "-llvm"
130 if env['machine'] != 'generic':
131 build_subdir += '-' + env['machine']
132 if env['debug']:
133 build_subdir += "-debug"
134 if env['profile']:
135 build_subdir += "-profile"
136 build_dir = os.path.join(build_topdir, build_subdir)
137 # Place the .sconsign file in the build dir too, to avoid issues with
138 # different scons versions building the same source file
139 env['build'] = build_dir
140 env.SConsignFile(os.path.join(build_dir, '.sconsign'))
José Fonseca18170bb2009-01-23 21:01:16 +0000141 env.CacheDir('build/cache')
José Fonseca8b755262009-12-25 17:39:47 +0000142 env['CONFIGUREDIR'] = os.path.join(build_dir, 'conf')
143 env['CONFIGURELOG'] = os.path.join(os.path.abspath(build_dir), 'config.log')
José Fonsecab04aa712008-06-06 14:48:57 +0900144
José Fonseca1e8177e2009-02-10 18:11:56 +0000145 # Parallel build
146 if env.GetOption('num_jobs') <= 1:
147 env.SetOption('num_jobs', num_jobs())
148
José Fonseca381e3482008-07-17 11:23:43 +0900149 # C preprocessor options
150 cppdefines = []
151 if debug:
152 cppdefines += ['DEBUG']
153 else:
154 cppdefines += ['NDEBUG']
155 if env['profile']:
156 cppdefines += ['PROFILE']
157 if platform == 'windows':
158 cppdefines += [
159 'WIN32',
160 '_WINDOWS',
José Fonseca42be0102009-01-22 14:26:30 +0000161 #'_UNICODE',
162 #'UNICODE',
José Fonseca129c6ed2008-12-01 11:53:26 -0800163 ('_WIN32_WINNT', '0x0501'), # minimum required OS version
164 ('WINVER', '0x0501'),
José Fonseca381e3482008-07-17 11:23:43 +0900165 ]
José Fonseca71793e0f2009-04-14 21:39:54 +0100166 if msvc and env['toolchain'] != 'winddk':
José Fonsecab3e03ed2009-03-25 19:32:54 +0000167 cppdefines += [
168 'VC_EXTRALEAN',
José Fonsecaad0975f2009-10-26 15:11:11 +0000169 '_USE_MATH_DEFINES',
José Fonseca1acd8912009-10-21 17:03:52 +0100170 '_CRT_SECURE_NO_WARNINGS',
José Fonsecab3e03ed2009-03-25 19:32:54 +0000171 '_CRT_SECURE_NO_DEPRECATE',
José Fonseca1acd8912009-10-21 17:03:52 +0100172 '_SCL_SECURE_NO_WARNINGS',
173 '_SCL_SECURE_NO_DEPRECATE',
José Fonsecab3e03ed2009-03-25 19:32:54 +0000174 ]
José Fonseca381e3482008-07-17 11:23:43 +0900175 if debug:
176 cppdefines += ['_DEBUG']
José Fonseca71793e0f2009-04-14 21:39:54 +0100177 if env['toolchain'] == 'winddk':
José Fonseca381e3482008-07-17 11:23:43 +0900178 # Mimic WINDDK's builtin flags. See also:
179 # - WINDDK's bin/makefile.new i386mk.inc for more info.
180 # - buildchk_wxp_x86.log files, generated by the WINDDK's build
181 # - http://alter.org.ua/docs/nt_kernel/vc8_proj/
José Fonseca71793e0f2009-04-14 21:39:54 +0100182 if machine == 'x86':
183 cppdefines += ['_X86_', 'i386']
184 if machine == 'x86_64':
185 cppdefines += ['_AMD64_', 'AMD64']
186 if platform == 'winddk':
José Fonseca381e3482008-07-17 11:23:43 +0900187 cppdefines += [
José Fonseca381e3482008-07-17 11:23:43 +0900188 'STD_CALL',
189 ('CONDITION_HANDLING', '1'),
190 ('NT_INST', '0'),
191 ('WIN32', '100'),
192 ('_NT1X_', '100'),
193 ('WINNT', '1'),
194 ('_WIN32_WINNT', '0x0501'), # minimum required OS version
195 ('WINVER', '0x0501'),
196 ('_WIN32_IE', '0x0603'),
197 ('WIN32_LEAN_AND_MEAN', '1'),
198 ('DEVL', '1'),
199 ('__BUILDMACHINE__', 'WinDDK'),
200 ('FPO', '0'),
201 ]
202 if debug:
203 cppdefines += [('DBG', 1)]
204 if platform == 'wince':
205 cppdefines += [
206 '_CRT_SECURE_NO_DEPRECATE',
207 '_USE_32BIT_TIME_T',
208 'UNICODE',
209 '_UNICODE',
210 ('UNDER_CE', '600'),
211 ('_WIN32_WCE', '0x600'),
212 'WINCEOEM',
213 'WINCEINTERNAL',
214 'WIN32',
215 'STRICT',
216 'x86',
217 '_X86_',
218 'INTERNATIONAL',
219 ('INTLMSG_CODEPAGE', '1252'),
220 ]
221 if platform == 'windows':
222 cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
223 if platform == 'winddk':
224 cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY']
225 if platform == 'wince':
226 cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE']
José Fonseca40b3bb02008-11-04 10:53:02 +0900227 cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL']
José Fonseca381e3482008-07-17 11:23:43 +0900228 env.Append(CPPDEFINES = cppdefines)
José Fonsecab04aa712008-06-06 14:48:57 +0900229
José Fonseca381e3482008-07-17 11:23:43 +0900230 # C compiler options
José Fonseca25f6c932009-06-26 19:50:12 +0100231 cflags = [] # C
232 cxxflags = [] # C++
233 ccflags = [] # C & C++
José Fonseca381e3482008-07-17 11:23:43 +0900234 if gcc:
235 if debug:
José Fonseca25f6c932009-06-26 19:50:12 +0100236 ccflags += ['-O0', '-g3']
José Fonsecabb8f3092009-06-28 11:12:22 +0100237 elif env['CCVERSION'].startswith('4.2.'):
238 # gcc 4.2.x optimizer is broken
239 print "warning: gcc 4.2.x optimizer is broken -- disabling optimizations"
240 ccflags += ['-O0', '-g3']
José Fonseca381e3482008-07-17 11:23:43 +0900241 else:
José Fonseca25f6c932009-06-26 19:50:12 +0100242 ccflags += ['-O3', '-g3']
José Fonseca381e3482008-07-17 11:23:43 +0900243 if env['profile']:
José Fonseca1a9eec82009-09-20 18:07:16 +0100244 # See http://code.google.com/p/jrfonseca/wiki/Gprof2Dot#Which_options_should_I_pass_to_gcc_when_compiling_for_profiling?
245 ccflags += [
246 '-fno-omit-frame-pointer',
247 '-fno-optimize-sibling-calls',
248 ]
José Fonseca381e3482008-07-17 11:23:43 +0900249 if env['machine'] == 'x86':
José Fonseca25f6c932009-06-26 19:50:12 +0100250 ccflags += [
José Fonseca381e3482008-07-17 11:23:43 +0900251 '-m32',
252 #'-march=pentium4',
José Fonseca381e3482008-07-17 11:23:43 +0900253 #'-mfpmath=sse',
254 ]
José Fonseca5ba645f2009-10-14 16:16:40 +0100255 if platform != 'windows':
256 # XXX: -mstackrealign causes stack corruption on MinGW. Ditto
257 # for -mincoming-stack-boundary=2. Still enable it on other
258 # platforms for now, but we can't rely on it for cross platform
259 # code. We have to use __attribute__((force_align_arg_pointer))
260 # instead.
261 ccflags += [
262 '-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
263 '-mstackrealign', # ensure stack is aligned
264 ]
José Fonseca381e3482008-07-17 11:23:43 +0900265 if env['machine'] == 'x86_64':
José Fonseca25f6c932009-06-26 19:50:12 +0100266 ccflags += ['-m64']
José Fonseca102cb5c2009-03-13 16:21:30 +0000267 # See also:
268 # - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
José Fonseca25f6c932009-06-26 19:50:12 +0100269 ccflags += [
José Fonseca381e3482008-07-17 11:23:43 +0900270 '-Wall',
José Fonseca102cb5c2009-03-13 16:21:30 +0000271 '-Wmissing-field-initializers',
José Fonseca381e3482008-07-17 11:23:43 +0900272 '-Wno-long-long',
273 '-ffast-math',
José Fonseca381e3482008-07-17 11:23:43 +0900274 '-fmessage-length=0', # be nice to Eclipse
275 ]
José Fonseca25f6c932009-06-26 19:50:12 +0100276 cflags += [
José Fonseca25f6c932009-06-26 19:50:12 +0100277 '-Wmissing-prototypes',
278 '-std=gnu99',
279 ]
Vinson Lee7d29afb2010-01-26 22:56:58 -0800280 if distutils.version.LooseVersion(env['CCVERSION']) >= distutils.version.LooseVersion('4.2'):
Alan Hourihane1019f0d2010-01-26 19:13:27 +0000281 ccflags += [
282 '-Werror=pointer-arith',
283 ]
284 cflags += [
285 '-Werror=declaration-after-statement',
286 ]
José Fonseca381e3482008-07-17 11:23:43 +0900287 if msvc:
288 # See also:
José Fonsecaa6c72582008-09-01 09:47:40 +0900289 # - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
José Fonseca381e3482008-07-17 11:23:43 +0900290 # - cl /?
291 if debug:
José Fonseca25f6c932009-06-26 19:50:12 +0100292 ccflags += [
José Fonseca381e3482008-07-17 11:23:43 +0900293 '/Od', # disable optimizations
294 '/Oi', # enable intrinsic functions
295 '/Oy-', # disable frame pointer omission
José Fonseca73ccabc2009-02-12 11:57:45 +0000296 '/GL-', # disable whole program optimization
José Fonseca381e3482008-07-17 11:23:43 +0900297 ]
298 else:
José Fonseca25f6c932009-06-26 19:50:12 +0100299 ccflags += [
José Fonseca78dad272009-06-04 10:34:02 -0700300 '/O2', # optimize for speed
José Fonsecada3bc492009-12-11 15:16:22 +0000301 '/GL', # enable whole program optimization
José Fonseca381e3482008-07-17 11:23:43 +0900302 ]
José Fonseca25f6c932009-06-26 19:50:12 +0100303 ccflags += [
José Fonsecada3bc492009-12-11 15:16:22 +0000304 '/fp:fast', # fast floating point
José Fonseca381e3482008-07-17 11:23:43 +0900305 '/W3', # warning level
306 #'/Wp64', # enable 64 bit porting warnings
307 ]
José Fonsecaa6c72582008-09-01 09:47:40 +0900308 if env['machine'] == 'x86':
José Fonseca25f6c932009-06-26 19:50:12 +0100309 ccflags += [
José Fonsecaa6c72582008-09-01 09:47:40 +0900310 #'/arch:SSE2', # use the SSE2 instructions
311 ]
José Fonseca381e3482008-07-17 11:23:43 +0900312 if platform == 'windows':
José Fonseca25f6c932009-06-26 19:50:12 +0100313 ccflags += [
José Fonseca381e3482008-07-17 11:23:43 +0900314 # TODO
315 ]
316 if platform == 'winddk':
José Fonseca25f6c932009-06-26 19:50:12 +0100317 ccflags += [
José Fonseca381e3482008-07-17 11:23:43 +0900318 '/Zl', # omit default library name in .OBJ
319 '/Zp8', # 8bytes struct member alignment
320 '/Gy', # separate functions for linker
321 '/Gm-', # disable minimal rebuild
322 '/WX', # treat warnings as errors
323 '/Gz', # __stdcall Calling convention
324 '/GX-', # disable C++ EH
325 '/GR-', # disable C++ RTTI
326 '/GF', # enable read-only string pooling
327 '/G6', # optimize for PPro, P-II, P-III
328 '/Ze', # enable extensions
329 '/Gi-', # disable incremental compilation
330 '/QIfdiv-', # disable Pentium FDIV fix
331 '/hotpatch', # prepares an image for hotpatching.
332 #'/Z7', #enable old-style debug info
333 ]
334 if platform == 'wince':
335 # See also C:\WINCE600\public\common\oak\misc\makefile.def
José Fonseca25f6c932009-06-26 19:50:12 +0100336 ccflags += [
José Fonseca381e3482008-07-17 11:23:43 +0900337 '/Zl', # omit default library name in .OBJ
338 '/GF', # enable read-only string pooling
339 '/GR-', # disable C++ RTTI
340 '/GS', # enable security checks
341 # Allow disabling language conformance to maintain backward compat
342 #'/Zc:wchar_t-', # don't force wchar_t as native type, instead of typedef
343 #'/Zc:forScope-', # don't enforce Standard C++ for scoping rules
344 #'/wd4867',
345 #'/wd4430',
346 #'/MT',
347 #'/U_MT',
348 ]
349 # Automatic pdb generation
350 # See http://scons.tigris.org/issues/show_bug.cgi?id=1656
351 env.EnsureSConsVersion(0, 98, 0)
352 env['PDB'] = '${TARGET.base}.pdb'
José Fonseca25f6c932009-06-26 19:50:12 +0100353 env.Append(CCFLAGS = ccflags)
José Fonseca381e3482008-07-17 11:23:43 +0900354 env.Append(CFLAGS = cflags)
José Fonseca25f6c932009-06-26 19:50:12 +0100355 env.Append(CXXFLAGS = cxxflags)
José Fonsecab04aa712008-06-06 14:48:57 +0900356
José Fonseca1781d7f2009-01-06 16:16:38 +0000357 if env['platform'] == 'windows' and msvc:
358 # Choose the appropriate MSVC CRT
359 # http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
360 if env['debug']:
361 env.Append(CCFLAGS = ['/MTd'])
362 env.Append(SHCCFLAGS = ['/LDd'])
363 else:
364 env.Append(CCFLAGS = ['/MT'])
365 env.Append(SHCCFLAGS = ['/LD'])
366
José Fonseca381e3482008-07-17 11:23:43 +0900367 # Assembler options
368 if gcc:
369 if env['machine'] == 'x86':
370 env.Append(ASFLAGS = ['-m32'])
371 if env['machine'] == 'x86_64':
372 env.Append(ASFLAGS = ['-m64'])
José Fonseca27d8d6f2008-07-03 12:42:23 +0900373
José Fonseca381e3482008-07-17 11:23:43 +0900374 # Linker options
375 linkflags = []
José Fonseca72ad0392009-06-28 10:54:23 +0100376 shlinkflags = []
José Fonseca381e3482008-07-17 11:23:43 +0900377 if gcc:
378 if env['machine'] == 'x86':
379 linkflags += ['-m32']
380 if env['machine'] == 'x86_64':
381 linkflags += ['-m64']
José Fonseca72ad0392009-06-28 10:54:23 +0100382 shlinkflags += [
383 '-Wl,-Bsymbolic',
384 ]
José Fonseca7b391942009-08-13 16:32:51 +0100385 # Handle circular dependencies in the libraries
Vinson Lee6b55aac2010-01-23 21:43:26 -0800386 if env['platform'] in ('darwin'):
387 pass
388 else:
389 env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
José Fonsecada3bc492009-12-11 15:16:22 +0000390 if msvc:
391 if not env['debug']:
392 # enable Link-time Code Generation
393 linkflags += ['/LTCG']
394 env.Append(ARFLAGS = ['/LTCG'])
José Fonseca6fe421c2009-02-12 12:59:58 +0000395 if platform == 'windows' and msvc:
José Fonseca381e3482008-07-17 11:23:43 +0900396 # See also:
397 # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
398 linkflags += [
José Fonseca73ccabc2009-02-12 11:57:45 +0000399 '/fixed:no',
400 '/incremental:no',
401 ]
402 if platform == 'winddk':
403 linkflags += [
José Fonseca381e3482008-07-17 11:23:43 +0900404 '/merge:_PAGE=PAGE',
405 '/merge:_TEXT=.text',
406 '/section:INIT,d',
407 '/opt:ref',
408 '/opt:icf',
409 '/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221',
410 '/incremental:no',
411 '/fullbuild',
412 '/release',
413 '/nodefaultlib',
414 '/wx',
415 '/debug',
416 '/debugtype:cv',
417 '/version:5.1',
418 '/osversion:5.1',
419 '/functionpadmin:5',
420 '/safeseh',
421 '/pdbcompress',
422 '/stack:0x40000,0x1000',
423 '/driver',
424 '/align:0x80',
425 '/subsystem:native,5.01',
426 '/base:0x10000',
427
428 '/entry:DrvEnableDriver',
429 ]
José Fonseca46728032009-02-18 15:05:23 +0000430 if env['debug'] or env['profile']:
José Fonseca381e3482008-07-17 11:23:43 +0900431 linkflags += [
432 '/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
433 ]
434 if platform == 'wince':
435 linkflags += [
436 '/nodefaultlib',
437 #'/incremental:no',
438 #'/fullbuild',
439 '/entry:_DllMainCRTStartup',
440 ]
441 env.Append(LINKFLAGS = linkflags)
José Fonseca72ad0392009-06-28 10:54:23 +0100442 env.Append(SHLINKFLAGS = shlinkflags)
José Fonseca381e3482008-07-17 11:23:43 +0900443
José Fonsecac76787a2008-07-17 11:25:20 +0900444 # Default libs
445 env.Append(LIBS = [])
446
José Fonseca381e3482008-07-17 11:23:43 +0900447 # Custom builders and methods
José Fonseca97e2c5a2009-12-31 17:58:56 +0000448 env.Tool('custom')
José Fonseca52c2dd12008-09-08 07:54:15 +0900449 createInstallMethods(env)
José Fonseca381e3482008-07-17 11:23:43 +0900450
451 # for debugging
452 #print env.Dump()
José Fonsecab04aa712008-06-06 14:48:57 +0900453
454
455def exists(env):
José Fonseca381e3482008-07-17 11:23:43 +0900456 return 1