Used Variables instead of Options, in SConstruct
[mcc.git] / SConstruct
blob23dcc0709788af6eb2bdeb28bccc8735b69d1736
1 # Build options
2 opts = Variables('scache.conf')
3 opts.AddVariables(
4 PathVariable('PREFIX', 'Set the install "prefix"', '/usr/local'),
5 PathVariable('DESTDIR', 'Set the installation root', '/'),
6 ('BUILDDIR', 'Set the sub-directory to put object files in', 'build'),
7 ('INCLUDE_DIRS', 'Set the default include directories to build into the compiler', '/include:/usr/include:/usr/local/include:/opt/include'),
8 ('CC', 'Set the C compiler to use'),
9 ('LINK', 'Set the linker to use'),
10 ('CFLAGS', 'Change the flags for the compiler', '-Wall -std=c99 -pedantic -O3 -g -ffunction-sections -fdata-sections'),
11 ('LINKFLAGS', 'Change the flags for the linker', '-Wl,--gc-sections'),
12 BoolVariable('verbose', 'Show full commands during the build process', False),
15 env = Environment(options = opts)
16 Help(opts.GenerateHelpText(env))
17 opts.Save('scache.conf', env)
19 env['LIBS'] = ['m']
21 # Pretty coloured output
22 if not env['verbose']:
23 env['CCCOMSTR'] = ' Compiling \e[32m$TARGET\e[0m'
24 env['LINKCOMSTR'] = ' Linking \e[32m$TARGET\e[0m'
25 env['ARCOMSTR'] = ' Archiving \e[32m$TARGET\e[0m'
26 env['RANLIBCOMSTR'] = ' Indexing \e[32m$TARGET\e[0m'
28 SConscript('SConscript',
29 exports = ['env'],
30 build_dir = env['BUILDDIR'],
31 duplicate = 0)