# HG changeset patch # User "Yann E. MORIN" # Date 1310910507 -7200 # Node ID f1ad0445325c1dd5a4d95128da9c6395c31a4bf9 # Parent 17c162b426c6c587651c07ff6072c88d0a295bba cc/gcc: simplify calls to core backend The core backend is going to have more parameters in the upcoming patches, so it will be a bit complex to handle. Introduce an array-variable that is filled by the different code-paths with the required values. This makes the code easier to read and maintain. Signed-off-by: "Yann E. MORIN" diff -r 17c162b426c6 -r f1ad0445325c scripts/build/cc/gcc.sh --- a/scripts/build/cc/gcc.sh Mon Feb 13 22:56:45 2012 +0100 +++ b/scripts/build/cc/gcc.sh Sun Jul 17 15:48:27 2011 +0200 @@ -55,21 +55,39 @@ #------------------------------------------------------------------------------ # Core gcc pass 1 do_cc_core_pass_1() { + local -a core_opts + local do_core + # If we're building for bare metal, build the static core gcc, # with libgcc. # In case we're not bare metal and building a canadian compiler, do nothing # In case we're not bare metal, and we're NPTL, build the static core gcc. # In any other case, do nothing. case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in - y,*,*) do_cc_core mode=static;; - ,y,*) ;; - ,,nptl) do_cc_core mode=static;; - *) ;; + y,*,*) + do_core=y + core_opts+=( "mode=static" ) + ;; + ,y,*) + ;; + ,,nptl) + do_core=y + core_opts+=( "mode=static" ) + ;; + *) + ;; esac + + if [ "${do_core}" = "y" ]; then + do_cc_core "${core_opts[@]}" + fi } # Core gcc pass 2 do_cc_core_pass_2() { + local -a core_opts + local do_core + # In case we're building for bare metal, do nothing, we already have # our compiler. # In case we're not bare metal and building a canadian compiler, do nothing @@ -78,31 +96,43 @@ # also build the target libgcc. case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in y,*,*) + do_core=y + core_opts+=( "mode=baremetal" ) + core_opts+=( "build_libgcc=yes" ) + core_opts+=( "build_libstdcxx=yes" ) if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then - do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_staticlinked=yes build_manuals=yes - else - do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes build_manuals=yes + core_opts+=( "build_staticlinked=yes" ) fi + core_opts+=( "build_manuals=yes" ) ;; ,y,*) ;; ,,nptl) - do_cc_core mode=shared build_libgcc=yes + do_core=y + core_opts+=( "mode=shared" ) + core_opts+=( "build_libgcc=yes" ) ;; ,,win32) - do_cc_core mode=static build_libgcc=yes + do_core=y + core_opts+=( "mode=static" ) + core_opts+=( "build_libgcc=yes" ) ;; - *) if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then - do_cc_core mode=static build_libgcc=yes - else - do_cc_core mode=static + *) + do_core=y + core_opts+=( "mode=static" ) + if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then + core_opts+=( "build_libgcc=yes" ) fi ;; esac + + if [ "${do_core}" = "y" ]; then + do_cc_core "${core_opts[@]}" + fi } #------------------------------------------------------------------------------ # Build core gcc -# This function is used to build both the static and the shared core C conpiler, +# This function is used to build both the static and the shared core C compiler, # with or without the target libgcc. We need to know wether: # - we're building static, shared or bare metal: mode=[static|shared|baremetal] # - we need to build libgcc or not : build_libgcc=[yes|no] (default: no)