add waf --check-profile option
authorTom Henderson <tomh@tomh.org>
Wed, 06 Jan 2016 09:11:14 -0800
changeset 11805 391bf90839ed
parent 11804 9de4cc0ea0ad
child 11806 db1587056c4f
add waf --check-profile option
CHANGES.html
doc/tutorial/source/getting-started.rst
waf-tools/cflags.py
wscript
--- a/CHANGES.html	Wed Jan 06 07:34:48 2016 -0800
+++ b/CHANGES.html	Wed Jan 06 09:11:14 2016 -0800
@@ -75,6 +75,7 @@
 <h2>Changes to build system:</h2>
 <ul>
   <li> Waf was upgraded to 1.8.13</li>
+  <li> A new waf build option, --check-profile, was added to allow users to check the currently active build profile.  It is discussed in bug 2202 in the tracker.</li>
 </ul>
 <h2>Changed behavior:</h2>
 This section is for behavioral changes to the models that were not due to a bug fix.
--- a/doc/tutorial/source/getting-started.rst	Wed Jan 06 07:34:48 2016 -0800
+++ b/doc/tutorial/source/getting-started.rst	Wed Jan 06 09:11:14 2016 -0800
@@ -504,6 +504,13 @@
 Okay, sorry, I made you build the |ns3| part of the system twice,
 but now you know how to change the configuration and build optimized code.
 
+A command exists for checking which profile is currently active
+for an already configured project:
+
+  $ ./waf --check-profile
+  Waf: Entering directory `/path/to/ns-3-allinone/ns-3.24/build'
+  Build profile: debug
+
 The build.py script discussed above supports also the ``--enable-examples``
 and ``enable-tests`` arguments, but in general, does not directly support
 other waf options; for example, this will not work:
--- a/waf-tools/cflags.py	Wed Jan 06 07:34:48 2016 -0800
+++ b/waf-tools/cflags.py	Wed Jan 06 09:11:14 2016 -0800
@@ -152,11 +152,13 @@
 		       help=("Specify the build profile.  "
 			     "Build profiles control the default compilation flags"
 			     " used for C/C++ programs, if CCFLAGS/CXXFLAGS are not"
-			     " set set in the environment. [Allowed Values: %s]"
+			     " set in the environment. [Allowed Values: %s]"
 			     % ", ".join([repr(p) for p in list(profiles.keys())])),
 		       choices=list(profiles.keys()),
 		       dest='build_profile')
-
+        opt.add_option('--check-profile',
+                       help=('print out current build profile'),
+                       default=False, dest='check_profile', action="store_true")
 def configure(conf):
 	cc = conf.env['COMPILER_CC'] or None
 	cxx = conf.env['COMPILER_CXX'] or None
--- a/wscript	Wed Jan 06 07:34:48 2016 -0800
+++ b/wscript	Wed Jan 06 09:11:14 2016 -0800
@@ -746,6 +746,11 @@
 def build(bld):
     env = bld.env
 
+    if Options.options.check_profile:
+        print("Build profile: %s" % Options.options.build_profile)
+        raise SystemExit(0)
+        return
+
     # If --enabled-modules option was given, then print a warning
     # message and exit this function.
     if Options.options.enable_modules: