about summary refs log tree commit diff
path: root/pkgs/stdenv-linux/gcc-wrapper.sh
blob: 66dc5b348bebc690480a7ab03e57886a62ad2a6b (plain) (blame)
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
#! /usr/local/bin/bash

IFS=

realgcc=@GCC@

justcompile=0
for i in $@; do
    if test "$i" == "-c"; then
        justcompile=1
    fi
    if test "$i" == "-S"; then
        justcompile=1
    fi
    if test "$i" == "-E"; then
        justcompile=1
    fi
done

IFS=" "
extra=($NIX_CFLAGS)
if test "$justcompile" != "1"; then
    extra=(${extra[@]} $NIX_LDFLAGS)
fi

if test "$NIX_DEBUG" == "1"; then
  echo "extra gcc flags:"
  for i in ${extra[@]}; do
      echo "  $i"
  done
fi

IFS=
exec $realgcc $@ ${extra[@]}