diff options
author | Yann Diorcet <diorcet.yann@gmail.com> | 2012-11-16 15:25:57 +0100 |
---|---|---|
committer | Yann Diorcet <diorcet.yann@gmail.com> | 2012-11-16 15:25:57 +0100 |
commit | b43fdf40f1f90c4c313dda5b74955cc725a88b40 (patch) | |
tree | 70c65d158f49bc2c50fdbc3e4a61a7f62cbe747b /scripts/build/cc | |
parent | 1af4a119d20cd1f806262f5a951ba0a356da3d8a (diff) | |
download | crosstool-ng-b43fdf40f1f90c4c313dda5b74955cc725a88b40.tar.gz crosstool-ng-b43fdf40f1f90c4c313dda5b74955cc725a88b40.tar.bz2 crosstool-ng-b43fdf40f1f90c4c313dda5b74955cc725a88b40.zip |
scripts: add BUILD/HOST extra cflags/ldflags
On some hosts, and for certain toolchains (eg. toolchain targetting
the upcoming Darwin), it may be necessary to pass arbitrary CFLAGS
and/or LDFLAGS when building the components.
And necessary infrastructure:
- EXTRA_{CFLAGS,LDFLAGS}_FOR_{BUILD,HOST} as config options
- pass those extra flags to components
Fix-up a slight typo in elf2flt at the same time (misnamed cflags).
Signed-off-by: Yann Diorcet <diorcet.yann@gmail.com>
Message-Id: <d24043276c9243a35421.1353077450@macbook-smorlat.local>
Patchwork-Id: 199645
Diffstat (limited to 'scripts/build/cc')
-rw-r--r-- | scripts/build/cc/gcc.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 03ffa3ad..d7ba6066 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -88,6 +88,7 @@ do_cc_core_pass_1() { core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) core_opts+=( "lang_list=c" ) CT_DoStep INFO "Installing pass-1 core C compiler" @@ -108,6 +109,7 @@ do_cc_core_pass_2() { core_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) core_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" ) core_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) core_opts+=( "lang_list=c" ) # Different conditions are at stake here: @@ -155,7 +157,8 @@ do_cc_core_pass_2() { # build_libstdcxx : build libstdc++ or not : bool : no # build_staticlinked : build statically linked or not : bool : no # build_manuals : whether to build manuals or not : bool : no -# cflags : host CFLAGS to use : string : (empty) +# cflags : cflags to use : string : (empty) +# ldflags : ldflags to use : string : (empty) # Usage: do_cc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] do_cc_core_backend() { local mode @@ -168,6 +171,7 @@ do_cc_core_backend() { local complibs local lang_list local cflags + local ldflags local tmp local -a host_libstdcxx_flags local -a extra_config @@ -227,6 +231,8 @@ do_cc_core_backend() { extra_config+=("--disable-__cxa_atexit") fi + core_LDFLAGS+=("${ldflags}") + # *** WARNING ! *** # Keep this full if-else-if-elif-fi-fi block in sync # with the same block in do_cc, below. @@ -521,6 +527,7 @@ do_cc_for_host() { final_opts+=( "prefix=${CT_PREFIX_DIR}" ) final_opts+=( "complibs=${CT_HOST_COMPLIBS_DIR}" ) final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) final_opts+=( "lang_list=$( cc_gcc_lang_list )" ) if [ "${CT_BUILD_MANUALS}" = "y" ]; then final_opts+=( "build_manuals=yes" ) @@ -553,7 +560,8 @@ do_cc_for_host() { # host : the host we run onto : tuple : (none) # prefix : the runtime prefix : dir : (none) # complibs : the companion libraries prefix : dir : (none) -# cflags : the host CFLAGS : string : (empty) +# cflags : cflags to use : string : (empty) +# ldflags : ldflags to use : string : (empty) # lang_list : the list of languages to build : string : (empty) # build_manuals : whether to build manuals or not : bool : no do_cc_backend() { @@ -561,6 +569,7 @@ do_cc_backend() { local prefix local complibs local cflags + local ldflags local lang_list local build_manuals local -a host_libstdcxx_flags @@ -628,6 +637,8 @@ do_cc_backend() { fi fi + final_LDFLAGS+=("${ldflags}") + # *** WARNING ! *** # Keep this full if-else-if-elif-fi-fi block in sync # with the same block in do_cc_core, above. |