View | Details | Raw Unified | Return to bug 2938
Collapse All | Expand All

(-)a/doc/tutorial/source/getting-started.rst (-2 / +11 lines)
 Lines 592-598    Link Here 
592
There is also an intermediate build profile, ``release``.  ``-d`` is a
592
There is also an intermediate build profile, ``release``.  ``-d`` is a
593
synonym for ``--build-profile``.
593
synonym for ``--build-profile``.
594
594
595
The build profile controls the use of logging, assertions, and compiler optimization:
595
The build profile controls the use of logging, assertions, warnings, and compiler optimization:
596
596
597
+--------------------+---------------------------------+-----------------------------------------------------------------+
597
+--------------------+---------------------------------+-----------------------------------------------------------------+
598
| Feature            | Build Profile                                                                                     |
598
| Feature            | Build Profile                                                                                     |
 Lines 605-611    Link Here 
605
+--------------------+---------------------------------+-------------------------------+---------------------------------+
605
+--------------------+---------------------------------+-------------------------------+---------------------------------+
606
| Code Wrapper Macro | ``NS_BUILD_DEBUG(code)``        |  ``NS_BUILD_RELEASE(code)``   | ``NS_BUILD_OPTIMIZED(code)``    |
606
| Code Wrapper Macro | ``NS_BUILD_DEBUG(code)``        |  ``NS_BUILD_RELEASE(code)``   | ``NS_BUILD_OPTIMIZED(code)``    |
607
+--------------------+---------------------------------+-------------------------------+---------------------------------+
607
+--------------------+---------------------------------+-------------------------------+---------------------------------+
608
| Compiler Flags     | ``-O0 -ggdb -g3``               | ``-O3 -g0``                   | ``-O3 -g``                      |
608
| Compiler Flags     | ``-O0 -ggdb -g3``               | ``-O2 -g``                    | ``-O3 -g0``                     |
609
|                    | ``-Wall -Werror``               | ``-Wall``                     | ``-Wall``                       |
609
|                    |                                 | ``-fomit-frame-pointer``      | ``-fstrict-overflow``           |
610
|                    |                                 | ``-fomit-frame-pointer``      | ``-fstrict-overflow``           |
610
|                    |                                 |                               | ``-march=native``               |
611
|                    |                                 |                               | ``-march=native``               |
611
+--------------------+---------------------------------+-------------------------------+---------------------------------+
612
+--------------------+---------------------------------+-------------------------------+---------------------------------+
 Lines 624-629    Link Here 
624
  DoLongInvolvedComputation ();
625
  DoLongInvolvedComputation ();
625
  NS_BUILD_DEBUG (timer.Stop (); std::cout << "Done: " << timer << std::endl;)
626
  NS_BUILD_DEBUG (timer.Stop (); std::cout << "Done: " << timer << std::endl;)
626
627
628
If you are using an older ns-3 release on a newer system, the -Werror option (treating
629
all warnings as errors) may prevent a successful build.  This flag may be disabled
630
by passing the --disable-werror flag to Waf configuration:
631
632
::
633
634
  $ ./waf configure -d debug --disable-werror ...
635
627
By default Waf puts the build artifacts in the ``build`` directory.  
636
By default Waf puts the build artifacts in the ``build`` directory.  
628
You can specify a different output directory with the ``--out``
637
You can specify a different output directory with the ``--out``
629
option, e.g.
638
option, e.g.
(-)a/waf-tools/cflags.py (-2 / +11 lines)
 Lines 18-24    Link Here 
18
class GccTraits(CompilerTraits):
18
class GccTraits(CompilerTraits):
19
	def __init__(self):
19
	def __init__(self):
20
		super(GccTraits, self).__init__()
20
		super(GccTraits, self).__init__()
21
		# cumulative list of warnings per level
21
		# cumulative list of warnings per level:  levels 1, 2, 3
22
		self.warnings_flags = [['-Wall'], ['-Werror'], ['-Wextra']]
22
		self.warnings_flags = [['-Wall'], ['-Werror'], ['-Wextra']]
23
23
24
	def get_warnings_flags(self, level):
24
	def get_warnings_flags(self, level):
 Lines 159-164    Link Here 
159
	opt.add_option('--check-profile',
159
	opt.add_option('--check-profile',
160
		       help=('print out current build profile'),
160
		       help=('print out current build profile'),
161
		       default=False, dest='check_profile', action="store_true")
161
		       default=False, dest='check_profile', action="store_true")
162
	opt.add_option('--disable-werror',
163
		       help=('disable -Werror flag (warnings treated as errors'),
164
		       default=False, dest='disable_werror', action="store_true")
162
def configure(conf):
165
def configure(conf):
163
	cc = conf.env['COMPILER_CC'] or None
166
	cc = conf.env['COMPILER_CC'] or None
164
	cxx = conf.env['COMPILER_CXX'] or None
167
	cxx = conf.env['COMPILER_CXX'] or None
 Lines 181-187    Link Here 
181
	optimizations = compiler.get_optimization_flags(opt_level)
184
	optimizations = compiler.get_optimization_flags(opt_level)
182
	debug, debug_defs = compiler.get_debug_flags(dbg_level)
185
	debug, debug_defs = compiler.get_debug_flags(dbg_level)
183
	warnings = compiler.get_warnings_flags(warn_level)
186
	warnings = compiler.get_warnings_flags(warn_level)
184
	
187
188
	if Options.options.disable_werror:
189
		try:
190
			warnings.remove ('-Werror')
191
		except ValueError:
192
			pass
193
185
	if cc and not conf.env['CCFLAGS']:
194
	if cc and not conf.env['CCFLAGS']:
186
		conf.env.append_value('CCFLAGS', optimizations)
195
		conf.env.append_value('CCFLAGS', optimizations)
187
		conf.env.append_value('CCFLAGS', debug)
196
		conf.env.append_value('CCFLAGS', debug)
(-)a/wscript (-2 / +2 lines)
 Lines 54-61    Link Here 
54
cflags.profiles = {
54
cflags.profiles = {
55
    # profile name: [optimization_level, warnings_level, debug_level]
55
    # profile name: [optimization_level, warnings_level, debug_level]
56
    'debug':     [0, 2, 3],
56
    'debug':     [0, 2, 3],
57
    'optimized': [3, 2, 1],
57
    'optimized': [3, 1, 0],
58
    'release':   [3, 2, 0],
58
    'release':   [2, 1, 1],
59
    }
59
    }
60
cflags.default_profile = 'debug'
60
cflags.default_profile = 'debug'
61
61

Return to bug 2938