diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-17 20:24:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-17 20:24:30 +0200 |
commit | f9048ed23d68c3a36060acd50c73c80d759c5a3f (patch) | |
tree | 78d12af6e99d9588e5e7770146e77ac5ba141225 /etc/environments/default | |
parent | 5cac5e17b1224e3f048058b26383f2cc15cf6282 (diff) |
Require target in environment scripts
Diffstat (limited to 'etc/environments/default')
-rwxr-xr-x | etc/environments/default | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/etc/environments/default b/etc/environments/default index f4a19aa..92bc5fd 100755 --- a/etc/environments/default +++ b/etc/environments/default @@ -4,7 +4,13 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : TBC; see accompanying LICENSE file +# # Environment setup script for C/C++ compilation. +# +# Note that we assume the compiler's default target is x86_64-* and, if +# requested, i?86-* can be selected with -m32. For other targets you will +# need to adjust the mode selection below. +# c=gcc cxx=g++ @@ -15,12 +21,20 @@ cxx=g++ set -e # Exit on errors. -t="$1" +# Based on target determine what we are building. +# +case "$1" in + x86_64-*) + mode= + ;; + i?86-*) + mode="config.cc.coptions+=-m32" + ;; + *) + echo "unknown target: '$1'" 1>&2 + exit 1 + ;; +esac shift -if test -n "$t"; then - echo "unknown target: $t" 1>&2 - exit 1 -fi - -exec "$@" cc config.c="$c" config.cxx="$cxx" +exec "$@" cc config.c="$c" config.cxx="$cxx" $mode |