File: SConstruct

package info (click to toggle)
csstidy 1.4-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 388 kB
  • sloc: cpp: 2,570; makefile: 5
file content (39 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import SCons.Util
import os

#This file is adapted from http://www.scons.org/wiki/SconstructMultiple

#get the mode flag from the command line
#default to 'release' if the user didn't specify
mymode = ARGUMENTS.get('mode', 'release')   #holds current mode

#check if the user has been naughty: only 'debug' or 'release' allowed
if not (mymode in ['debug', 'release']):
    print("Error: expected 'debug' or 'release', found: " + mymode)
    Exit(1)

#tell the user what we're doing
print('**** Compiling in ' + mymode + ' mode...')

debugcflags = ['-Wall', '-g', '-pedantic']   #extra compile flags for debug
releasecflags = ['-O2']         #extra compile flags for release

env = Environment()

if 'CPPFLAGS' in os.environ:
    env.Append(CPPFLAGS = SCons.Util.CLVar(os.environ['CPPFLAGS']))
if 'CXXFLAGS' in os.environ:
    env.Append(CCFLAGS = SCons.Util.CLVar(os.environ['CXXFLAGS']))
if 'LDFLAGS' in os.environ:
    env.Append(LINKFLAGS = SCons.Util.CLVar(os.environ['LDFLAGS']))

#make sure the sconscripts can get to the variables
Export('env', 'mymode', 'debugcflags', 'releasecflags')

#put all .sconsign files in one place
env.SConsignFile()

#specify the sconscript for CSSTidy
project = 'csstidy'
SConscript(project + '/SConscript', exports=['project'])