shithub: mc

Download patch

ref: ce78898fbea0dbe6d3aa2d1af64357a589a031c7
parent: abf4c98dec102c7a60607ea8128536f232f4219e
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Jan 1 17:05:51 EST 2015

Add an explicit 'gen' command.

--- a/build.myr
+++ b/build.myr
@@ -10,6 +10,7 @@
 
 pkg bld =
 	const buildall	: (p : parser# -> bool)
+	const genall	: (p : parser# -> bool)
 	const test	: (p : parser# -> bool)
 	const build	: (p : parser#, target : byte[:] -> bool)
 	const buildbin	: (p : parser#, bt : myrtarg# -> void)
@@ -31,6 +32,17 @@
 			/* nothing needed */
 		;;
 	;;
+	-> true
+}
+
+const genall = {p
+	for t in p.targs
+		match t
+		| `Gen gt: run(gt.cmd, "")
+		| _:	/* skip */
+		;;
+	;;
+	/* genfiles will exit if the build fails; always return true */
 	-> true
 }
 
--- a/main.myr
+++ b/main.myr
@@ -82,6 +82,7 @@
 			for cmd in optctx.args
 				match cmd
 				| "all":	bld.buildall(p)
+				| "gen":	bld.genall(p)
 				| "clean":	bld.cleanall(p)
 				| "install":	bld.install(p)
 				| "uninstall":	bld.uninstall(p)