aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/make.rb21
-rw-r--r--test/testprog.c6
2 files changed, 27 insertions, 0 deletions
diff --git a/test/make.rb b/test/make.rb
new file mode 100755
index 0000000..e1a6fff
--- /dev/null
+++ b/test/make.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+
+require '../rubymake'
+
+to(/test(.*).h/, "make.rb") do |target|
+ File.open(target, ?w) do |f|
+ f.puts "#define STRING \"This is a string\""
+ end
+end
+
+to(/test(.*)(?!\.c)/, "test$1.c", "test$1.h") do |target, froms|
+ `gcc -o #{target} #{froms[0]}`
+end
+
+to("clean", phony: true) do |target|
+ `rm -f testprog testprog.h`
+end
+
+default "testprog"
+
+Make.make!
diff --git a/test/testprog.c b/test/testprog.c
new file mode 100644
index 0000000..cfeb3d6
--- /dev/null
+++ b/test/testprog.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+#include "testprog.h"
+
+void main() {
+ printf(STRING "\n");
+}