aboutsummaryrefslogtreecommitdiff
path: root/etc/environments/default
blob: cee5ed2647b679f93c2617b7e117c760f4ce8543 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

# file      : etc/environments/default
# copyright : Copyright (c) 2014-2019 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++

# $1  - target
# $2  - bbot executable
# $3+ - bbot options

set -e # Exit on errors.

# 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

exec "$@" cc config.c="$c" config.cxx="$cxx" $mode