about summary refs log tree commit diff
path: root/make/lib/find-includes.sh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-05-02T15·25+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-05-02T15·25+0000
commit36fb29f8f0317144a0074d7b6689912a4dc40325 (patch)
tree026fb03a97ca8b40a04ab38fa29759dbb0a9081e /make/lib/find-includes.sh
parent02f2da01426b338c75051397dcbdcb0c75913670 (diff)
* Merge remaining stuff from the nix-make branch.
* Add support for the creation of shared libraries to `compileC',
  `link', and `makeLibrary'.
* Enable the ATerm library to be made into a shared library.

Diffstat (limited to 'make/lib/find-includes.sh')
-rw-r--r--make/lib/find-includes.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/make/lib/find-includes.sh b/make/lib/find-includes.sh
new file mode 100644
index 000000000000..4824207c2917
--- /dev/null
+++ b/make/lib/find-includes.sh
@@ -0,0 +1,20 @@
+. $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