mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
17e20716c0
* The linker can link against libraries. * C flags can be passed to the C compiler.
20 lines
367 B
Bash
20 lines
367 B
Bash
. $stdenv/setup
|
|
|
|
objs=
|
|
for i in $objects; do
|
|
obj=$(echo $i/*.o)
|
|
objs="$objs $obj"
|
|
done
|
|
|
|
libs=
|
|
for i in $libraries; do
|
|
lib=$(echo $i/*.a)
|
|
name=$(echo $(basename $lib) | sed -e 's/^lib//' -e 's/.a$//')
|
|
libs="$libs -L$(dirname $lib) -l$name"
|
|
done
|
|
|
|
echo "linking object files into \`$programName'..."
|
|
|
|
mkdir $out
|
|
gcc -o $out/$programName $objs $libs
|