ovs-dev.py: Add support for clang builds.
authorEthan Jackson <ethan@nicira.com>
Sat, 27 Jul 2013 00:06:15 +0000 (17:06 -0700)
committerEthan Jackson <ethan@nicira.com>
Mon, 29 Jul 2013 21:13:07 +0000 (14:13 -0700)
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
utilities/ovs-dev.py

index f3a1ba9..c10ca7d 100755 (executable)
@@ -52,6 +52,9 @@ def uname():
 
 def conf():
     tag()
+    if options.clang:
+        ENV["CC"] = "clang"
+
     configure = ["./configure", "--prefix=" + ROOT, "--localstatedir=" + ROOT,
                  "--with-logdir=%s/log" % ROOT, "--with-rundir=%s/run" % ROOT,
                  "--with-linux=/lib/modules/%s/build" % uname(),
@@ -75,7 +78,11 @@ def make(args=""):
     make = "make -s -j 8 " + args
     try:
         _sh("cgcc", "--version", capture=True)
-        make += " C=1"
+        # XXX: For some reason the clang build doesn't place nicely with
+        # sparse.  At some point this needs to be figured out and this check
+        # removed.
+        if not options.clang:
+            make += " C=1"
     except OSError:
         pass
     _sh(make)
@@ -275,6 +282,8 @@ def main():
                      help="run ovs-vswitchd under gdb")
     group.add_option("--valgrind", dest="valgrind", action="store_true",
                      help="run ovs-vswitchd under valgrind")
+    group.add_option("--clang", dest="clang", action="store_true",
+                     help="build ovs-vswitchd with clang")
     parser.add_option_group(group)
 
     options, args = parser.parse_args()