Tricks of the Mozilla build system: myconfig.mk and myrules.mk
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: myconfig.mk and myrules.mk. 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’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/myconfig.mk:
CFLAGS += -DPL_DHASHMETER CXXFLAGS += -DPL_DHASHMETER
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/app-config.mk and application/app-rules.mk for application-specific build configuration and build rules.
May 2nd, 2008 at 8:15 am
A wholehearted yes please to the application specific stuff!
May 2nd, 2008 at 3:54 pm
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
June 4th, 2008 at 11:21 am
app-config.mk/app-rules.mk filed as bug 437219 :)