[ovs-dev] [threaded-put 01/21] ovs-dev.py: Build with both GCC and Clang.

Joe Stringer joestringer at nicira.com
Thu Dec 12 22:55:44 UTC 2013


Looks good.

On 12 December 2013 14:40, Ethan Jackson <ethan at nicira.com> wrote:
> Here's an incremental.  I folded in some tweaks which make it slightly easier to
> build without clang or sparse.
>
> Still good?
> Ethan
>
> ---
>  .gitignore           |  6 ++----
>  utilities/ovs-dev.py | 19 +++++++++++++++----
>  2 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index 1c75f69..d80fc63 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -45,10 +45,8 @@
>  /missing-distfiles
>  /package.m4
>  /stamp-h1
> -/build_gcc
> -/build_clang
> -/_build
> -/build
> +/_build-gcc
> +/_build-clang
>  Module.symvers
>  TAGS
>  cscope.*
> diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
> index 9975d8d..c5445e2 100755
> --- a/utilities/ovs-dev.py
> +++ b/utilities/ovs-dev.py
> @@ -24,8 +24,8 @@ ENV = os.environ
>  HOME = ENV["HOME"]
>  OVS_SRC = HOME + "/ovs"
>  ROOT = HOME + "/root"
> -BUILD_GCC = OVS_SRC + "/build_gcc"
> -BUILD_CLANG = OVS_SRC + "/build_clang"
> +BUILD_GCC = OVS_SRC + "/_build-gcc"
> +BUILD_CLANG = OVS_SRC + "/_build-clang"
>  PATH = "%(ovs)s/utilities:%(ovs)s/ovsdb:%(ovs)s/vswitchd" % {"ovs": BUILD_GCC}
>
>  ENV["CFLAGS"] = "-g -O0"
> @@ -85,11 +85,17 @@ def conf():
>      _sh(*configure)
>
>      try:
> -        _sh("clang --version", capture=True)
> +        _sh("clang --version", check=True)
>          clang = True
>      except subprocess.CalledProcessError:
>          clang = False
>
> +    try:
> +        _sh("sparse --version", check=True)
> +        sparse = True
> +    except subprocess.CalledProcessError:
> +        sparse = False
> +
>      if clang:
>          try:
>              os.mkdir(BUILD_CLANG)
> @@ -100,6 +106,11 @@ def conf():
>          os.chdir(BUILD_CLANG)
>          _sh(*configure)
>
> +    if sparse:
> +        c1 = "C=1"
> +    else:
> +        c1 = ""
> +
>      os.chdir(OVS_SRC)
>
>      make_str = "\t$(MAKE) -C %s $@\n"
> @@ -108,7 +119,7 @@ def conf():
>      mf.write("all:\n%:\n")
>      if clang:
>          mf.write(make_str % BUILD_CLANG)
> -    mf.write("\t$(MAKE) -C %s C=1 $@\n" % BUILD_GCC)
> +    mf.write("\t$(MAKE) -C %s %s $@\n" % (BUILD_GCC, c1))
>      mf.write("\ncheck:\n")
>      mf.write(make_str % BUILD_GCC)
>      mf.close()
> --
> 1.8.1.2
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list