about summary refs log tree commit diff
path: root/make/examples/aterm
diff options
context:
space:
mode:
Diffstat (limited to 'make/examples/aterm')
-rw-r--r--make/examples/aterm/aterm/default.nix34
-rw-r--r--make/examples/aterm/default.nix1
-rw-r--r--make/examples/aterm/test/default.nix18
3 files changed, 53 insertions, 0 deletions
diff --git a/make/examples/aterm/aterm/default.nix b/make/examples/aterm/aterm/default.nix
new file mode 100644
index 000000000000..8b139219e916
--- /dev/null
+++ b/make/examples/aterm/aterm/default.nix
@@ -0,0 +1,34 @@
+{sharedLib ? true}:
+
+rec {
+
+  inherit (import ../../../lib) compileC makeLibrary;
+
+  sources = [
+    ./afun.c
+    ./aterm.c
+    ./bafio.c
+    ./byteio.c
+    ./gc.c
+    ./hash.c
+    ./list.c
+    ./make.c
+    ./md5c.c
+    ./memory.c
+    ./tafio.c
+    ./version.c
+  ];
+
+  compile = fn: compileC {
+    main = fn;
+    localIncludes = "auto";
+    forSharedLib = sharedLib;
+  };
+
+  libATerm = makeLibrary {
+    libraryName = "ATerm";
+    objects = map compile sources;
+    inherit sharedLib;
+  };
+
+}
diff --git a/make/examples/aterm/default.nix b/make/examples/aterm/default.nix
new file mode 100644
index 000000000000..edaac40aa499
--- /dev/null
+++ b/make/examples/aterm/default.nix
@@ -0,0 +1 @@
+import test/default.nix
\ No newline at end of file
diff --git a/make/examples/aterm/test/default.nix b/make/examples/aterm/test/default.nix
new file mode 100644
index 000000000000..b7a9dd361977
--- /dev/null
+++ b/make/examples/aterm/test/default.nix
@@ -0,0 +1,18 @@
+let {
+
+  inherit (import ../../../lib) compileC link;
+
+  inherit (import ../aterm {}) libATerm;
+
+  compile = fn: compileC {
+    main = fn;
+    localIncludes = "auto";
+    cFlags = "-I../aterm";
+  };
+
+  fib = link {objects = compile ./fib.c; libraries = libATerm;};
+
+  primes = link {objects = compile ./primes.c; libraries = libATerm;};
+  
+  body = [fib primes];
+}