Tricks of the Mozilla build system: and

There are lots of hidden corners in the Mozilla build system. I’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 “see the document I just wrote on the Mozilla Developer Center”!

First up: and 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 or file in the objdir/config directory. Let’s say you want to define PL_DHASHMETER in all of Mozilla, so that you can then run Mozilla and collect hashing statistics.

Copy the following file to objdir/config/


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 Mozilla Developer Center article, which has two additional examples adding a new makefile target and altering build rules to save static analysis output to disk.

Brainstorm of possible improvement: load application/ and application/ for application-specific build configuration and build rules.

Atom Feed for Comments 3 Responses to “Tricks of the Mozilla build system: and”

  1. Mossop Says:

    A wholehearted yes please to the application specific stuff!

  2. Preed Says:

    A wholehearted “yes plz” to more of these articles!

    I think this is one thing that makes the Mozilla Build system so unapproachable; there’s tons of really good code there to do a bunch of awesome things, but it’s all pretty undocumented, and in lots of places, pretty hairy.

    I’ve come to this conclusion after finishing up week three of jemalloc integration. :-p

  3. Robert Kaiser Says: filed as bug 437219 :)

Leave a Reply