about summary refs log tree commit diff
path: root/make/lib/make-library.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/make-library.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/make-library.sh')
-rw-r--r--make/lib/make-library.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/make/lib/make-library.sh b/make/lib/make-library.sh
new file mode 100644
index 000000000000..a486a7bf740c
--- /dev/null
+++ b/make/lib/make-library.sh
@@ -0,0 +1,28 @@
+. $stdenv/setup
+
+objs=
+for i in $objects; do
+    obj=$(echo $i/*.o)
+    objs="$objs $obj"
+done
+
+echo "archiving object files into library \`$libraryName'..."
+
+ensureDir $out
+
+if test -z "$sharedLib"; then
+
+    outPath=$out/lib${libraryName}.a
+
+    ar crs $outPath $objs
+    ranlib $outPath
+
+else
+
+    outPath=$out/lib${libraryName}.so
+
+    gcc -shared -o $outPath $objs
+
+fi    
+
+