{"id":139,"date":"2006-11-22T17:51:41","date_gmt":"2006-11-22T21:51:41","guid":{"rendered":"http:\/\/benjamin.smedbergs.us\/blog\/2006-11-22\/depths-of-the-mozilla-build-system\/"},"modified":"2006-11-22T17:51:41","modified_gmt":"2006-11-22T21:51:41","slug":"depths-of-the-mozilla-build-system","status":"publish","type":"post","link":"http:\/\/benjamin.smedbergs.us\/blog\/2006-11-22\/depths-of-the-mozilla-build-system\/","title":{"rendered":"Depths of the Mozilla Build System"},"content":{"rendered":"<p>I should really be posting about some important plans for the Mozilla build system that I nailed down during the Firefox summit. But I don&#8217;t have time to give that a proper post, so instead I&#8217;m going to discuss one of the amazing things I&#8217;ve learned about the Mozilla build system over the past few days. Look at <a href=\"http:\/\/bonsai.mozilla.org\/cvsblame.cgi?file=mozilla\/config\/rules.mk&#038;rev=3.533&#038;mark=1879-1898#1876\">this snippet from rules.mk<\/a>. I&#8217;ve been the nominal owner of this code for almost two years, but didn&#8217;t really understand it until this week. This little piece of code is one of the things that makes our build system really great and horrible at the same time:<\/p>\n<ol>\n<li>Whenever people remove or alter the location of header files, this code keeps all the depend builds from going red.\n<li>It causes us to call stat() an extra 10,000+ times per depend build. Probably a lot more than that, actually, but I didn&#8217;t instrument it.\n<\/ol>\n<p>We do an end-run around the normal dependency checks done by GNU make: the <a href=\"http:\/\/lxr.mozilla.org\/mozilla\/source\/build\/unix\/mddepend.pl\">mddepend.pl<\/a> script stats and calculates the compiler-generated dependencies in advance. If the dependency is missing or new, it adds a FORCE dependency on the object file. Unfortunately, we do this calculation on each build pass: once for <tt>export<\/tt>, once for <tt>libs<\/tt>, once for <tt>tools<\/tt>, and perhaps another time for <tt>check<\/tt>. This causes us to check dependencies many many more times than we actually need to.<\/p>\n<p>What we really want to implement is an &#8220;optional dependency&#8221;: a directive that if a header has been updated, we should rebuild the object; but if the header doesn&#8217;t exist any more, we shouldn&#8217;t try to build it (because we don&#8217;t have any rules to generate such headers which were removed or relocated intentionally). This is probably not something I&#8217;m going to fix any time soon. But I may find time to write it up in detail to propose it as a feature for gmake 3.82.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I should really be posting about some important plans for the Mozilla build system that I nailed down during the Firefox summit. But I don&#8217;t have time to give that a proper post, so instead I&#8217;m going to discuss one of the amazing things I&#8217;ve learned about the Mozilla build system over the past few [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[30],"class_list":["post-139","post","type-post","status-publish","format-standard","hentry","category-mozilla","tag-build-system"],"_links":{"self":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/comments?post=139"}],"version-history":[{"count":0,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/139\/revisions"}],"wp:attachment":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/media?parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/categories?post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/tags?post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}