blob: 416b7729a5518918fde1626789e18c540a868ede [file] [log] [blame]
Alexander Afanasyev1dd37ed2013-08-14 18:08:09 -07001#! /usr/bin/env python
2# encoding: utf-8
3
4from waflib import Configure
5
6@Configure.conf
7def add_supported_cflags(self, cflags):
8 """
9 Check which cflags are supported by compiler and add them to env.CFLAGS variable
10 """
11 self.start_msg('Checking allowed flags for c compiler')
12
13 supportedFlags = []
14 for flag in cflags:
15 if self.check_cc (cflags=[flag], mandatory=False):
16 supportedFlags += [flag]
17
18 self.end_msg (' '.join (supportedFlags))
19 self.env.CFLAGS += supportedFlags
20
21def configure(conf):
22 conf.load ('gnu_dirs')
23
24 if conf.options.debug:
25 conf.define ('_DEBUG', 1)
26 conf.add_supported_cflags (cflags = ['-O0',
27 '-Wall',
28 '-Wno-unused-variable',
29 '-g3',
30 '-Wno-unused-private-field', # only clang supports
31 '-fcolor-diagnostics', # only clang supports
32 '-Qunused-arguments' # only clang supports
33 ])
34 else:
35 conf.add_supported_cflags (cflags = ['-O3', '-g'])
36
37def options(opt):
38 opt.load ('gnu_dirs')
39 opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')