about summary refs log tree commit diff
path: root/make/lib/link.sh
blob: a48f750f41d6a593d780f6d0292dd3bccd7d8ecb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
. $stdenv/setup

shopt -s nullglob

objs=
for i in $objects; do
    obj=$(echo $i/*.o)
    objs="$objs $obj"
done

libs=
for i in $libraries; do
    lib=$(echo $i/*.a; echo $i/*.so)
    name=$(echo $(basename $lib) | sed -e 's/^lib//' -e 's/.a$//' -e 's/.so$//')
    libs="$libs -L$(dirname $lib) -l$name" 
done

echo "linking object files into \`$programName'..."

mkdir $out
gcc -o $out/$programName $objs $libs