shithub: mc

Download patch

ref: a7c11c4d0a52661a299a90b47d9a68be8e11312f
parent: dc338852ab7da15657147df7df25eec078e09aa1
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jun 24 20:53:47 EDT 2017

Allow '.o' and '.6' files in inputs.

	Generating an object makes sense, if you want to
	do weird things like generating OpenGL bindings.

--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -210,8 +210,12 @@
 
 	match std.htget(dg.deps, out)
 	| `std.Some deps:
+		std.put("deps: {} => {}\n", out, deps)
 		for d in deps
-			if builddep(b, dg, d, incs)
+			if std.sleq(out, d)
+				continue
+			;;
+			if std.sleq(out, d) || builddep(b, dg, d, incs)
 				stale = true
 			;;
 			match std.htget(b.gensrc, d)
@@ -280,6 +284,8 @@
 			std.slpush(&cmd, flg)
 		;;
 		run(cmd)
+	elif std.hassuffix(src, ".o") || std.hassuffix(src, ".6")
+		/* nothing to do with object files*/
 	else
 		std.fatal("Unknown file type for {}\n", src)
 	;;
--- a/mbld/util.myr
+++ b/mbld/util.myr
@@ -64,7 +64,7 @@
 	platf = ""
 	suff = ""
 
-	match std.strfind(src, "/")
+	match std.strrfind(src, "/")
 	| `std.Some i:	fbase = i
 	| `std.None:	fbase = 0
 	;;
@@ -103,6 +103,8 @@
 		-> std.strcat(base, new)
 	elif std.hassuffix(suff, ".glue.c")
 		-> std.strjoin([base, ".glue", new][:], "")
+	elif std.hassuffix(src, ".o") || std.hassuffix(src, ".6")
+		-> std.sldup(src)
 	else
 		std.fatal("unrecognized source {}\n", src)
 	;;