<div>Hi all,</div><div><br></div><div>I learned a bit of Haskell and extended hake to be able to create libraries out of other libraries by extracting all object files of them and archive them on the new one. This is useful for newlib.</div>
<div><br></div><div>I basically changed the ArchDefault rule for archiving a library. You can see here the main change I did.</div><div><br></div><div><br></div><div>zeus.</div><br clear="all"><div><div>--- a/hake/ArchDefaults.hs</div>
<div>+++ b/hake/ArchDefaults.hs</div><div>@@ -250,14 +250,29 @@ assembler arch compiler opts src obj =</div><div> --</div><div> -- Create a library from a set of object files</div><div> --</div><div>-archive :: String -&gt; Options -&gt; [String] -&gt; String -&gt; [ RuleToken ]</div>
<div>-archive arch opts objs libname =</div><div>+archive :: String -&gt; Options -&gt; [String] -&gt; [String] -&gt; String -&gt; [ RuleToken ]</div><div>+archive arch opts objs libs libname =</div><div>     [ Str &quot;rm -f &quot;, Out arch libname ]</div>
<div>     ++ </div><div>     [ NL, Str &quot;ar cr &quot;, Out arch libname ] </div><div>     ++ </div><div>     [ In BuildTree arch o | o &lt;- objs ]</div><div>-    ++ </div><div>+    ++</div><div>+    if libs == [] then []</div>
<div>+                  else (</div><div>+      [ NL, Str &quot;rm -fr tmp; mkdir tmp&quot; ]</div><div>+      ++</div><div>+      [ NL, Str &quot;cd tmp; for i in &quot; ]</div><div>+      ++</div><div>+      [ In BuildTree arch a | a &lt;- libs ]</div>
<div>+      ++</div><div>+      [ Str &quot;; do ar x ../$$i; done&quot; ]</div><div>+      ++</div><div>+      [ NL, Str &quot;ar q &quot;, Out arch libname, Str &quot; tmp/*.o&quot; ]</div><div>+      ++</div><div>+      [ NL, Str &quot;rm -fr tmp&quot; ]</div>
<div>+    )</div><div>+    ++</div><div>     [ NL, Str &quot;ranlib &quot;, Out arch libname ]</div><div> </div><div> --</div></div><div><br></div>-- <br>Zeus Gómez Marmolejo<br>Barcelona Supercomputing Center<br>PhD student<br>
<a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br><br><br>