about summary refs log tree commit diff
path: root/make/examples/simple-header
diff options
context:
space:
mode:
Diffstat (limited to 'make/examples/simple-header')
-rw-r--r--make/examples/simple-header/default.nix11
-rw-r--r--make/examples/simple-header/hello.c9
-rw-r--r--make/examples/simple-header/hello.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/make/examples/simple-header/default.nix b/make/examples/simple-header/default.nix
new file mode 100644
index 000000000000..e943471aaa4c
--- /dev/null
+++ b/make/examples/simple-header/default.nix
@@ -0,0 +1,11 @@
+let {
+
+  inherit (import ../../lib) compileC link;
+
+  hello = link {objects = compileC {
+    main = ./hello.c;
+    localIncludes = [ [./hello.h "hello.h"] ];
+  };};
+
+  body = [hello];
+}
diff --git a/make/examples/simple-header/hello.c b/make/examples/simple-header/hello.c
new file mode 100644
index 000000000000..15f1ac714e10
--- /dev/null
+++ b/make/examples/simple-header/hello.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#include "hello.h"
+
+int main(int argc, char * * argv)
+{
+    printf("Hello " WHAT "\n");
+    return 0;
+}
diff --git a/make/examples/simple-header/hello.h b/make/examples/simple-header/hello.h
new file mode 100644
index 000000000000..4595fad98d43
--- /dev/null
+++ b/make/examples/simple-header/hello.h
@@ -0,0 +1 @@
+#define WHAT "World"