36fb29f8f0
* Add support for the creation of shared libraries to `compileC', `link', and `makeLibrary'. * Enable the ATerm library to be made into a shared library.
20 lines
435 B
Bash
20 lines
435 B
Bash
. $stdenv/setup
|
|
|
|
echo "finding includes of \`$(basename $main)'..."
|
|
|
|
makefile=$NIX_BUILD_TOP/makefile
|
|
|
|
mainDir=$(dirname $main)
|
|
(cd $mainDir && gcc $cFlags -MM $(basename $main) -MF $makefile) || false
|
|
|
|
echo "[" >$out
|
|
|
|
while read line; do
|
|
line=$(echo "$line" | sed 's/.*://')
|
|
for i in $line; do
|
|
fullPath=$(readlink -f $mainDir/$i)
|
|
echo " [ $fullPath \"$i\" ]" >>$out
|
|
done
|
|
done < $makefile
|
|
|
|
echo "]" >>$out
|