X-Git-Url: https://hackdaworld.org/gitweb/?p=hdw-linux%2Fhdw-linux.git;a=blobdiff_plain;f=scripts%2FConfig;h=2804a1923475bb7ef10ba01aeb1eb9ce8834a988;hp=9e7d70406d8939c66bf06e51174d74985348c7a5;hb=054c7ecaf04f6aa5157d2709d36e38b8ed2b2e28;hpb=f7877e0735bd20cbcba2ab90a41d488aae205538 diff --git a/scripts/Config b/scripts/Config index 9e7d704..2804a19 100755 --- a/scripts/Config +++ b/scripts/Config @@ -48,8 +48,9 @@ else fi # lets see what root is: -[ "$hdw_status" = "2" -o "$hdw_status" = "3" ] && root="" -if [ "$hdw_status" -lt 2 -o "$hdw_crossbuild" != "0" ] ; then +root="" +if [ "$hdw_crossbuild" != "0" -a "$hdw_status" -lt "2" ] ; then + # check for properly configured build directory if [ -z "$hdw_build_dir" ] ; then echo "please set hdw_build_dir in ./Config!" exit 1 @@ -66,18 +67,33 @@ fi set +h umask 022 export LC_ALL=POSIX -[ "$hdw_status" -lt "2" ] && export PATH="$root/${s1_prefix}/bin:$PATH" +[ "$hdw_status" -lt "2" -o "$hdw_crossbuild" != "0" ] && \ + export PATH="$root/${s1_prefix}/bin:$PATH" # let's do optimization and care for crossbuilds -if [ ! -z "`uname --version | grep sh-utils`" ] ; then +# +# as gnu autoconf terminology has been confusing me again and again, +# there are a few comments following ;) +# +# ref: gcc docs - hardware models and configurations +# @ http://gcc.gnu.org/onlinedocs/ +# + +# --build: the system the actual executable is created on. uname will tell us. +# you may set hdw_real_build, or +# you may fake uname output using fake_utsname kernel module! +if [ -n "`uname --version | grep sh-utils`" ] ; then hdw_arch_build="`uname -m -p | tr " " -`-linux-gnu" else hdw_arch_build="`uname -m`-unknown-linux-gnu" fi +[ -n "$hdw_real_build" ] && hdw_arch_build="${hdw_real_build}-unknown-linux-gnu" + +# --target: the system for which the executable is going to produce code. case "$hdw_arch" in ia32) if [ -z "$hdw_arch_opt" ] ; then hdw_arch_target="i386-pc-linux-gnu" - elif [ ! -z "$hdw_arch_opt" ] ; then + else hdw_arch_target="${hdw_arch_opt}-pc-linux-gnu" hdw_cflags="-march=${hdw_arch_opt}" fi @@ -85,44 +101,45 @@ case "$hdw_arch" in sparc*) if [ -z "$hdw_arch_opt" ] ; then hdw_arch_target="$hdw_arch-unknown-linux-gnu" else - # hack this! :) - echo "pls hack sparc* opt. options and submit :)" - echo "no optimization used!" hdw_arch_target="$hdw_arch-unknown-linux-gnu" hdw_cflags="-march={hdw_arch_opt}" fi ;; ppc) hdw_arch_target="powerpc-unknown-linux-gnu" - [ ! -z "$hdw_arch_opt" ] && hdw_cflags="-march=${hdw_arch_opt}" + if [ -z "$hdw_arch_opt" ] ; then + hdw_cflags="-mcpu=common" + else + hdw_cflags="-mcpu=${hdw_arch_opt}" + fi hdw_arch_build=${hdw_arch_build//ppc/powerpc} ;; mips) hdw_arch_target="mips-unknown-linux-gnu" - [ ! -z "$hdw_arch_opt" ] && hdw_cflags="-march=${hdw_arch_opt}" - ;; - *) echo "not supported yet" + if [ -z "$hdw_arch_opt" ] ; then + echo "info: no optimization set" + else + hdw_cflags="-march=${hdw_arch_opt}" + fi ;; + *) echo "$hdw_arch_target not supported yet" echo "please choose a valid optimization and build platform." exit 1 ;; esac + +# --host: system where the created executable runs on. +hdw_arch_host=${hdw_arch_build} +[ "$hdw_status" != "0" ] && hdw_arch_host=${hdw_arch_target} + # -O flag -[ ! -z "$hdw_opt" ] && hdw_cflags="-O${hdw_opt} $hdw_cflags" +# optimization only at stages >= 1 +[ -n "$hdw_opt" ] && hdw_cflags="-O${hdw_opt} $hdw_cflags" # build tools to use -hdw_arch_prefix="" -if [ "$hdw_crossbuild" != "0" ] ; then - hdw_arch_prefix="$hdw_arch_target-" - if [ "$hdw_real_build" ] ; then - if [ "$hdw_arch" = "ia32" ] ; then - hdw_arch_build=${hdw_arch_build//$hdw_arch_opt/$hdw_real_build} - else - hdw_arch_build=${hdw_arch_build//$hdw_arch/$hdw_real_build} - fi - fi -fi -# test: actually we always use the compilers for target -# hdw_arch_prefix="$hdw_arch_target-" +# should be the same like host imho, right? +hdw_arch_prefix="$hdw_arch_host-" -# resume ... +# print decissions for debugging ... echo "hdw_arch_target variable set to $hdw_arch_target" echo "hdw_arch_build variable set to $hdw_arch_build" +echo "hdw_arch_host variable ste to $hdw_arch_host" +echo "hdw_arch_prefix variable set to $hdw_arch_prefix" echo "hdw_cflags variable set to $hdw_cflags" [ "$hdw_status" = "1" ] && echo "hdw_stage1_prefix set to '$s1_prefix'"