diff options
Diffstat (limited to 'sofort')
-rw-r--r-- | sofort/ccenv/ccenv.in | 1 | ||||
-rw-r--r-- | sofort/ccenv/ccenv.sh | 51 | ||||
-rw-r--r-- | sofort/ccenv/ccswitch.strs | 47 |
3 files changed, 99 insertions, 0 deletions
diff --git a/sofort/ccenv/ccenv.in b/sofort/ccenv/ccenv.in index 4037952..a7f2056 100644 --- a/sofort/ccenv/ccenv.in +++ b/sofort/ccenv/ccenv.in @@ -87,3 +87,4 @@ CFLAGS_OS += -DOS_LIB_SUFFIX=\"@ccenv_os_lib_suffix@\" CFLAGS_OS += @ccenv_cflags_os@ CFLAGS_PIC += @ccenv_cflags_pic@ +# @ccenv_cfgtype@ cflags: supported compiler switches diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh index 8fc5033..868ad1a 100644 --- a/sofort/ccenv/ccenv.sh +++ b/sofort/ccenv/ccenv.sh @@ -1435,6 +1435,55 @@ ccenv_output_defs() eval 'ccenv_'${ccenv_cfgtype}'_cc'=\'$ccenv_cc\' } +ccenv_set_cc_switch_vars() +{ + if [ -f $mb_project_dir/project/config/ccswitch.strs ]; then + ccenv_switch_vars=$(grep -v '^#' \ + $mb_project_dir/sofort/ccenv/ccswitch.strs \ + $mb_project_dir/project/config/ccswitch.strs \ + | sort -u) + else + ccenv_switch_vars=$(grep -v '^#' \ + $mb_project_dir/sofort/ccenv/ccswitch.strs \ + | sort -u) + fi + + if [ $ccenv_cfgtype = 'host' ]; then + # ccenv_host_cc="$ccenv_cc" + ccenv_makevar_prefix='_CFLAGS_' + cfgtest_host_section + else + # ccenv_native_cc="$ccenv_cc" + ccenv_makevar_prefix='_NATIVE_CFLAGS_' + cfgtest_native_section + fi + + for ccenv_switch_var in $(printf '%s' "$ccenv_switch_vars"); do + ccenv_make_var=${ccenv_switch_var%=} + ccenv_make_var=${ccenv_make_var%,} + + ccenv_make_var=${ccenv_make_var##---} + ccenv_make_var=${ccenv_make_var##--} + ccenv_make_var=${ccenv_make_var##-} + + ccenv_make_var=$(printf '%s' "$ccenv_make_var" \ + | sed -e 's/=/_/g' -e 's/-/_/g' -e 's/,/_/g') + + ccenv_make_var="${ccenv_makevar_prefix}${ccenv_make_var}" + + if cfgtest_compiler_switch "$ccenv_switch_var"; then + ccenv_switch_var=${ccenv_switch_var%=} + ccenv_switch_var=${ccenv_switch_var%,} + + printf '%-31s = %s\n' "${ccenv_make_var}" "${ccenv_switch_var}" \ + >> "$ccenv_mk" + else + printf '%-31s =\n' "${ccenv_make_var}" \ + >> "$ccenv_mk" + fi + done +} + ccenv_dso_verify() { ccenv_str='int foo(int x){return ++x;}' @@ -1544,6 +1593,8 @@ ccenv_set_toolchain_variables() ccenv_output_defs ccenv_clean_up + + ccenv_set_cc_switch_vars } ccenv_set_host_variables() diff --git a/sofort/ccenv/ccswitch.strs b/sofort/ccenv/ccswitch.strs new file mode 100644 index 0000000..f27fe62 --- /dev/null +++ b/sofort/ccenv/ccswitch.strs @@ -0,0 +1,47 @@ +# ccswitch.strs: project-agnostic list of compiler switches, +# for which support is tested by default. + +# when -foo is supported by the host or native compiler, add +# ``CFLAGS_foo = -foo'' to the respective ccenv variable file +# (that is, ccenv/host.mk or ccenv/native.mk). + +# the make variable prefix is _CFLAGS_ or _NATIVE_CFLAGS_, +# to which the compiler-switch, minus leading dashes and +# trailing equal-sign or comma, is appended; non-leading +# dashes and non-trailing equal-signs and commas are then +# substituted with underscores. + +# the project-agnostic list below can be supplemented by a +# project-specific one, named project/config/ccswitch.strs. + +# toolchain switches +-dumpmachine +-print-file-name= + +# flavors and variants +-std=c89 +-std=c99 +-std=c11 + +# linker switches +-Wl,--no-undefined + +# errors and warnings +-Wall +-Werror +-Wextra +-Wundef + +# debugging +-g +-g0 +-g1 +-g2 +-g3 + +# optimization +-O0 +-O1 +-O2 +-O3 +-Os |