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.
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),
23 Help(opts
.GenerateHelpText(env
))
24 opts
.Save('scache.conf', env
)
27 def check_stack_prot(context
):
28 """check whether gcc supports -fno-stack-protector"""
29 context
.Message('Checking for -fno-stack-protector... ')
30 context
.env
['CFLAGS'] = '-fno-stack-protector'
31 result
= context
.TryCompile('', '.c')
32 context
.Result(result
)
37 if not env
.GetOption('clean'):
38 ### RUN TESTS AND CONFIGURE ENVIRONMENT ###
39 conf
= Configure(env
, custom_tests
= OurTests
.__dict
__)
41 # If the compiler has -fno-stack-protector, we need to disable
42 # it to stop gcc inserting stack protection code (which doesn't
44 if conf
.check_stack_prot():
45 env
['CFLAGS'] = old_env
['CFLAGS'] + ' -fno-stack-protector'
47 env
['CFLAGS'] = old_env
['CFLAGS']
51 # set nice pretty messages
52 if not env
['verbose']:
53 env
['CCCOMSTR'] = ' Compiling \e[32m$TARGET\e[0m'
54 env
['ASPPCOMSTR'] = ' Assembling \e[32m$TARGET\e[0m'
55 env
['LINKCOMSTR'] = ' Linking \e[32m$TARGET\e[0m'
56 env
['ARCOMSTR'] = ' Archiving \e[32m$TARGET\e[0m'
57 env
['RANLIBCOMSTR'] = ' Indexing \e[32m$TARGET\e[0m'
58 env
['NMCOMSTR'] = ' Creating map \e[32m$TARGET\e[0m'
60 SConscript('SConscript',
62 build_dir
= env
['BUILDDIR'],
66 env
.Clean('.', ['config.log', '.sconf_temp'])