{"id":209,"date":"2008-05-02T07:38:11","date_gmt":"2008-05-02T11:38:11","guid":{"rendered":"http:\/\/benjamin.smedbergs.us\/blog\/2008-05-02\/tricks-of-the-mozilla-build-system-myconfigmk-and-myrulesmk\/"},"modified":"2008-05-02T07:38:11","modified_gmt":"2008-05-02T11:38:11","slug":"tricks-of-the-mozilla-build-system-myconfigmk-and-myrulesmk","status":"publish","type":"post","link":"http:\/\/benjamin.smedbergs.us\/blog\/2008-05-02\/tricks-of-the-mozilla-build-system-myconfigmk-and-myrulesmk\/","title":{"rendered":"Tricks of the Mozilla build system: myconfig.mk and myrules.mk"},"content":{"rendered":"<p>There are lots of hidden corners in the <a href=\"http:\/\/developer.mozilla.org\/en\/docs\/How_Mozilla%27s_build_system_works\">Mozilla build system<\/a>. I&#8217;m starting a little <a href=\"http:\/\/benjamin.smedbergs.us\/blog\/tag\/build-system\/\">series<\/a> about some of the cool and unexpected things you can do with it. Of course, the series is mostly going to be &#8220;see the document I just wrote on the Mozilla Developer Center&#8221;!<\/p>\n<p>First up: <a href=\"http:\/\/developer.mozilla.org\/en\/docs\/myrules.mk\">myconfig.mk and myrules.mk<\/a>. Did you know that you can add arbitrary rules and change arbitrary variables in the Mozilla build system without editing your source tree? You can, by simply dropping a myconfig.mk or myrules.mk file in the objdir\/config directory. Let&#8217;s say you want to define <a href=\"http:\/\/mxr.mozilla.org\/mozilla\/source\/xpcom\/glue\/pldhash.h#206\">PL_DHASHMETER<\/a> in all of Mozilla, so that you can then run Mozilla and collect hashing statistics.<\/p>\n<p>Copy the following file to <var>objdir<\/var>\/config\/myconfig.mk:<\/p>\n<pre>\r\nCFLAGS += -DPL_DHASHMETER\r\nCXXFLAGS += -DPL_DHASHMETER\r\n<\/pre>\n<p>This is not a very impressive example, because you could achieve the same effect by exporting CFLAGS and CXXFLAGS in your environment before configuring. So check out the <a href=\"http:\/\/developer.mozilla.org\/en\/docs\/myrules.mk\">Mozilla Developer Center article<\/a>, which has two additional examples adding a new makefile target and altering build rules to save static analysis output to disk.<\/p>\n<p>Brainstorm of possible improvement: load <tt><var>application<\/var>\/app-config.mk<\/tt> and <tt><var>application<\/var>\/app-rules.mk<\/tt> for application-specific build configuration and build rules.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are lots of hidden corners in the Mozilla build system. I&#8217;m starting a little series about some of the cool and unexpected things you can do with it. Of course, the series is mostly going to be &#8220;see the document I just wrote on the Mozilla Developer Center&#8221;! First up: myconfig.mk and myrules.mk. Did [&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,112,113],"class_list":["post-209","post","type-post","status-publish","format-standard","hentry","category-mozilla","tag-build-system","tag-myconfigmk","tag-myrulesmk"],"_links":{"self":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/209","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=209"}],"version-history":[{"count":0,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/209\/revisions"}],"wp:attachment":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/media?parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/categories?post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/tags?post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}