Added buddy allocation algorithm.
[marionette.git] / SConstruct
blobc569cd21e2a2095ef5b560e468c2dfcece051328
1 import os.path
3 opts = Options('scache.conf')
4 ### These options are global defaults.
5 ### If you want to change your options locally,
6 ### give them to SCons on the command line, or
7 ### edit scache.conf. Don't edit them here.
8 opts.AddOptions(
9 ('CC', 'Set the C compiler to use'),
10 ('AS', 'Set the assembler to use'),
11 ('LINK', 'Set the linker to use'),
12 ('CFLAGS', 'Set the C compiler flags', '-ffreestanding -m32 -O3 -Wall -std=c99 -pedantic'),
13 ('ASFLAGS', 'Set the assembler flags', ''),
14 ('LINKFLAGS', 'Set the linker flags', '-ffreestanding -nostdlib -Wl,--gc-sections,-m,elf_i386'),
15 ('BUILDDIR', 'Set the sub-directory to put object files in', 'build'),
16 BoolOption('verbose', 'Show full commands during the build process', False),
19 env = Environment(options = opts, tools=['default'])
20 Help(opts.GenerateHelpText(env))
21 opts.Save('scache.conf', env)
23 class OurTests:
24 def check_stack_prot(context):
25 """check whether gcc supports -fno-stack-protector"""
26 context.Message('Checking for -fno-stack-protector... ')
27 context.env['CFLAGS'] = '-fno-stack-protector'
28 result = context.TryCompile('', '.c')
29 context.Result(result)
30 return result
32 old_env = env.Clone()
34 if not env.GetOption('clean'):
35 ### RUN TESTS AND CONFIGURE ENVIRONMENT ###
36 conf = Configure(env, custom_tests = OurTests.__dict__)
38 # If the compiler has -fno-stack-protector, we need to disable
39 # it to stop gcc inserting stack protection code (which doesn't
40 # work in a kernel)
41 if conf.check_stack_prot():
42 env['CFLAGS'] = old_env['CFLAGS'] + ' -fno-stack-protector'
43 else:
44 env['CFLAGS'] = old_env['CFLAGS']
46 env = conf.Finish()
48 # set nice pretty messages
49 if not env['verbose']:
50 env['CCCOMSTR'] = ' Compiling \e[32m$TARGET\e[0m'
51 env['ASPPCOMSTR'] = ' Assembling \e[32m$TARGET\e[0m'
52 env['LINKCOMSTR'] = ' Linking \e[32m$TARGET\e[0m'
53 env['ARCOMSTR'] = ' Archiving \e[32m$TARGET\e[0m'
54 env['RANLIBCOMSTR'] = ' Indexing \e[32m$TARGET\e[0m'
55 env['NMCOMSTR'] = ' Creating map \e[32m$TARGET\e[0m'
57 SConscript('SConscript',
58 exports = ['env'],
59 build_dir = env['BUILDDIR'],
60 duplicate = 0)
62 # clean config data
63 env.Clean('.', ['config.log', '.sconf_temp'])