<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 -> Options -> [String] -> String -> [ RuleToken ]</div>
<div>-archive arch opts objs libname =</div><div>+archive :: String -> Options -> [String] -> [String] -> String -> [ RuleToken ]</div><div>+archive arch opts objs libs libname =</div><div> [ Str "rm -f ", Out arch libname ]</div>
<div> ++ </div><div> [ NL, Str "ar cr ", Out arch libname ] </div><div> ++ </div><div> [ In BuildTree arch o | o <- objs ]</div><div>- ++ </div><div>+ ++</div><div>+ if libs == [] then []</div>
<div>+ else (</div><div>+ [ NL, Str "rm -fr tmp; mkdir tmp" ]</div><div>+ ++</div><div>+ [ NL, Str "cd tmp; for i in " ]</div><div>+ ++</div><div>+ [ In BuildTree arch a | a <- libs ]</div>
<div>+ ++</div><div>+ [ Str "; do ar x ../$$i; done" ]</div><div>+ ++</div><div>+ [ NL, Str "ar q ", Out arch libname, Str " tmp/*.o" ]</div><div>+ ++</div><div>+ [ NL, Str "rm -fr tmp" ]</div>
<div>+ )</div><div>+ ++</div><div> [ NL, Str "ranlib ", 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>