Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

With the move to mach, moz.build, and non-recursive builds, much of this page is out of date. Use with caution!

Now that you have set up and built your source tree for the first time, you're ready to start your own development cycle.

The best way to proceed is to use an Objdir approach. For example, if you're enhancing Mozilla storage and have made changes to mozStorageConnection.cpp.

Assuming that your Objdir has already been built and you used separate shared libraries build options, you will find that the corresponding components folder (for Thunderbird in this example) contains these files that include compiled mozStorageConnection.cpp functions (note that "obj-i686-pc-cygwin" might be different in your case):

/c/mozilla/obj-i686-pc-cygwin/dist/bin/components:
...
storage.xpt
strgcmps.dll
...

To incrementally rebuild Mozilla Storage component to reflect your changes in mozStorageConnection.cpp, you need to run make in the corresponding Objdir subfolder:

cd /c/mozilla/obj-i686-pc-cygwin/storage
make

Note that there's a time stamp change on the components files after make completes:

/c/mozilla/obj-i686-pc-cygwin/dist/bin/components:
...
storage.xpt
strgcmps.dll
...

Now you should be able to run your updated Thunderbird:

/c/mozilla/obj-i686-pc-cygwin/dist/bin/thunderbird.exe

If you will be performing incremental builds, it is also recommended that you use ccache to speed up subsequent compilation times. See en/ccache for info on configuring ccache.

Two-stage build

Many components build in sections, with a master build subdirectory that links the component together. Usually this build subdirectory lives under the component's main directory, but not always. When modifying files in subfolders of uriloader you also need to make in /c/mozilla/docshell/build and when modifying files in subfolders of content, dom, editor or view you also need to make in /c/mozilla/layout/build (except when building versions prior to 1.9 where editor has its own build subdirectory). In case you have built with --enable-libxul, in addition to the above steps you need to make in <path-to-obj-dir>/toolkit/library so that the newly created component libraries are linked into libxul.

The smartmake script (introduced here) is a convenient way to generate the necessary make commands for an incremental build. It takes the modified directories as arguments and uses its knowledge of basic dependencies to determine the required build commands.

Using sourcedir builds

Note that sourcedir builds are suggested against, and support will be removed eventually.

When using a srcdir build you're typically editing in a subdirectory of the component's main directory. However you can leverage the two-stage build to your benefit. Simply run make in the current directory to compile the modified source files, then run make in the component's build directory or in the alternative build directory in the cases listed above to link the component. This is particularly convenient when your editor invokes make and processes any error output.

Build times

To give you a rough idea, here some build times on an “average Windows XP PC”:

  • full build: 2 hrs (make clean; make all; - from top of source tree)
  • full dependency build: 30 min (make deps; - from top of source tree)
  • local incremental build: 1 min (make; - from <objdir>/storage)

Document Tags and Contributors

 Last updated by: stephaniehobson,