shithub: mc

Download patch

ref: e2e4406e3e90fd6a1320fcbf1bf0eda2f3608c18
parent: c41cd605395a47c54f36795ef2fa0b54124a8ffa
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Sep 28 17:47:58 EDT 2014

Uses depend on their sources, even outside libs.

    We were omitting dependencies in some cases for usefiles that
    had no other pulled-in deps. This was causing missed files when
    building libraries.

--- a/build.myr
+++ b/build.myr
@@ -80,8 +80,11 @@
 }
 
 const buildlib = {lib, inputs
+	var archive
+	var u, l
 	var dg
 
+	archive = std.fmt("lib%s.a", lib)
 	if !myrdeps(&dg, lib, inputs, true)
 		std.fatal(1, "Could not load dependencies for %s\n", lib)
 	;;
@@ -88,10 +91,13 @@
 	if !std.hthas(dg.deps, lib)
 		std.fatal(1, "no target declared for %s\n", lib)
 	;;
-	if builddep(&dg, lib)
-		mergeuse(&dg, lib, inputs)
+	u = builddep(&dg, lib)
+	l = builddep(&dg, archive)
+	if  u || l
 		archivelib(&dg, lib, inputs)
+		mergeuse(&dg, lib, inputs)
 	;;
+	std.slfree(archive)
 }
 
 const builddep = {dg, out
@@ -126,7 +132,7 @@
 				std.fatal(1, "Unknown file type for %s\n", src)
 			;;
 		;;
-		std.htput(dg.updated, src, true)
+		std.htput(dg.updated, out, true)
 	| `std.None:
 	;;
 	-> stale
@@ -163,7 +169,7 @@
 			obj = swapsuffix(f, ".s", ".o")
 		else
 			std.fatal(1, "unknown file type for %s\n", f)
-			;;
+		;;
 		cmd = std.slpush(cmd, obj)
 	;;
 
@@ -225,9 +231,6 @@
 	run(cmd, "")
 	strlistfree(cmd)
 }
-
-
-
 
 const addlibs = {cmd, libgraph
 	var looped : std.htab(byte[:], bool)#
--- a/deps.myr
+++ b/deps.myr
@@ -40,17 +40,18 @@
 		out = std.sldup(targ)
 		useout = ""
 	;;
-	for l in leaves
-		obj = srcswapsuffix(l, ".o")
-		std.htput(dg.sources, obj, l)
+	for src in leaves
+		obj = srcswapsuffix(src, ".o")
+		usefile = srcswapsuffix(src, ".use")
+		std.htput(dg.sources, obj, src)
+		std.htput(dg.sources, usefile, src)
 		pushdep(dg, obj, out)
-		pushdep(dg, l, obj)
-		usefile = srcswapsuffix(l, ".use")
+		pushdep(dg, src, obj)
+		pushdep(dg, src, usefile)
 		if islib
 			pushdep(dg, usefile, useout)
-			std.htput(dg.sources, usefile, l)
 		;;
-		srcdeps(dg, seentab, donetab, l, obj, usefile)
+		srcdeps(dg, seentab, donetab, src, obj, usefile)
 	;;
 	dumpgraph(dg)
 	std.htfree(seentab)