Difference between revisions of "Development:Building:Common make Targets"
(initial version of these tips) |
(→Other useful <code>make</code> tricks: tweak to more than build) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | You can run <code>make</code> with | + | You can run <code>make</code> with a number of different targets to perform various tasks. Most interesting <code>make</code> targets can be found in <code>[http://mxr.mozilla.org/mozilla/source/client.mk mozilla/client.mk]</code> and various Makefiles, such as <code>[http://mxr.mozilla.org/mozilla/source/camino/Makefile.in mozilla/camino/Makefile.in]</code> and <code>[http://mxr.mozilla.org/mozilla/source/camino/installer/Makefile.in mozilla/camino/installer/Makefile.in]</code>. |
− | ==<code>client.mk</code> | + | ==Targets== |
− | + | ''Targets are valid for both Camino Makefiles (and any other Makefile in the tree) and for <code>client.mk</code>, unless otherwise noted. All targets can be used with both <code>make</code> in the <code>$OBJDIR</code> or <code>make</code> in the <code>$SRCDIR</code> in a srcdir build (after the initial <code>client.mk</code>-driven build). Running <code>make</code> with a target at the root of the OBJDIR (or srcdir, after a <code>client.mk</code>-driven build) will run that target recursively throughout the entire tree, including for Camino.'' | |
− | * <code>build</code> - This target triggers a full Mozilla build without performing a checkout (or update) first | + | * <code>build</code> - This target triggers a full Mozilla build without performing a checkout (or update) first |
+ | ** This can only be used with <code>make -f client.mk</code> in the <code>$SRCDIR</code>; at the root of the <code>$OBJDIR</code>, <code>make</code> with no target is the equivalent. | ||
− | * <code>checkout</code> - This target triggers a Mozilla cvs checkout (or update of an existing checkout) without subsequently performing a build | + | * <code>checkout</code> - This target triggers a Mozilla cvs checkout (or update of an existing checkout) without subsequently performing a build. |
+ | ** For obvious reasons, this can only be used with <code>make -f client.mk</code> in the <code>$SRCDIR</code>. | ||
− | * <code>clean</code> - Removes the object files and other generated files, as well as any files or directories in the <code>GARBAGE</code> or <code>GARBAGE_DIRS</code> Makefile variables | + | * <code>clean</code> - Removes the object files and other generated files, as well as any files or directories in the <code>GARBAGE</code> or <code>GARBAGE_DIRS</code> Makefile variables; it runs recursively from the point in the directory hierarchy where it is called. When run for Camino, <code>clean</code> also removes the <code>build/</code> directory. |
+ | ** This target can be used in the <code>$OBJDIR</code> in OBJDIR builds and in the <code>$SRCDIR</code> in non-OBJDIR builds (or with <code>make -f client.mk</code>). | ||
− | * <code>distclean</code> - Like <code>clean</code>, this removes intermediate build products (like object files), but it also removes any and all final build products in <code>dist/</code> (can | + | * <code>distclean</code> - Like <code>clean</code>, this removes intermediate build products (like object files), but it also removes Makefiles as well as any and all final build products in <code>dist/</code>; it runs recursively from the point in the directory hierarchy where it is called. When run for Camino, this removes Camino’s intermediate build products (like object files and the <code>build/</code> directory), as well as any of Camino's final build products in <code>dist/</code>. |
+ | ** This target can be used in the <code>$OBJDIR</code> in OBJDIR builds and in the <code>$SRCDIR</code> in non-OBJDIR builds (or with <code>make -f client.mk</code>). | ||
− | * <code>export</code> - <code>export</code> is usually the first target run by <code>build</code> or a stand-alone <code>make</code>; it configures the build, generates headers from IDL files, and exports various headers to locations where other parts of the build process can find them. There are few situations where you would run this target by itself in a full Mozilla build. | + | * <code>export</code> - <code>export</code> is usually the first target run by <code>build</code> or a stand-alone <code>make</code>; it configures the build, generates headers from IDL files, and exports various headers to locations where other parts of the build process can find them. There are few situations where you would run this target by itself in a full Mozilla build. For Camino, when first called by <code>client.mk</code>’s <code>export</code> target, the <code>export</code> target sets up the Camino part of the OBJDIR. This involves generating the Makefile from <code>Makefile.in</code>, symlinking the <code>wallet</code> files and most source directories, and copying the project files without clobbering the personal settings contained within. You should re-run this target in your <code>$OBJDIR</code> each time the project file is updated, when the Makefile itself changes (it will update itself in the OBJDIR), or when a new subdirectory is added to <code>mozilla/camino</code>. |
− | + | * <code>libs</code> - This target is rarely called directly, either in a full Mozilla build or for Camino; however, it is the meat of a Camino build. In Camino, the targets <code>libs</code> depends on generate all of the Camino files that require on preprocessing (''e.g.'', <code>all-camino.js</code>, <code>Info.plist</code>, and all of the <code>Localizable.strings</code> and other <code>.strings</code> files. This target is also responsible for the <code>embed-replacements</code> system, for calling <code>xcodebuild</code> in the initial Mozilla build and in command-line Camino builds, for copying the final Camino application to <code>dist/</code>, and for handling the <code>xpt</code> files. After any <code>.strings</code> file changes, any updates to the Gecko milestone, or any Camino version number change, the various dependent targets need to be re-run; the simplest way to do this is to simply <code>make</code> in <code>$OBJDIR/camino</CODE> (or <code>mozilla/camino</CODE> in a srcdir build). | |
− | |||
− | |||
− | * <code> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
** '''''N.B.''''' Camino also has certain “external” pieces of code that are built only by recursive <code>make</code> and not by separate Camino Makefile targets or by project-related dependencies. If you do not <code>make</code> in Camino after these pieces of code are added or modified, your Xcode build will fail or will not pick up the changes. | ** '''''N.B.''''' Camino also has certain “external” pieces of code that are built only by recursive <code>make</code> and not by separate Camino Makefile targets or by project-related dependencies. If you do not <code>make</code> in Camino after these pieces of code are added or modified, your Xcode build will fail or will not pick up the changes. | ||
− | + | ==Other useful <code>make</code> tricks== | |
− | <code>make</code> is also capable of | + | <code>make</code> is also capable of processing directories selectively using <code>-C ''directory''</code> rather than performing a full recursive pass through the tree. Some scenarios where this is useful include: |
* Widget code - You've made changes to Cocoa widget code; as described in [[Development:Building#Widget code|the build instructions]], you can <code>make</code> in the Widget directory and then Camino to get the Widget changes into your build. From the root of your <code>$OBJDIR</code>, run the following command: <code>make -C widget/src/cocoa; make -C embedding/config; make -C camino</code> | * Widget code - You've made changes to Cocoa widget code; as described in [[Development:Building#Widget code|the build instructions]], you can <code>make</code> in the Widget directory and then Camino to get the Widget changes into your build. From the root of your <code>$OBJDIR</code>, run the following command: <code>make -C widget/src/cocoa; make -C embedding/config; make -C camino</code> | ||
Line 35: | Line 30: | ||
* Rebuilding an “external” piece of Camino - Some “external” Camino dependencies (those bits of code in directories sitting directly in <code>mozilla/camino</code> rather than in <code>mozilla/camino/src</code>) have their own makefiles and can be built separately (they are normally built by recursive <code>make</code> from <code>camino</code>). If you were hacking on the feedhandlers or Flashblock, you may wish to check your changes by simply rebuilding them rather than all of Camino; from <code>$OBJDIR/camino</code>, run <code>make -C feedhandlers</code> or <code>make -C flashblock</code> to build these pieces. External pieces that are built using Xcode projects can generally ''not'' be built in this manner. | * Rebuilding an “external” piece of Camino - Some “external” Camino dependencies (those bits of code in directories sitting directly in <code>mozilla/camino</code> rather than in <code>mozilla/camino/src</code>) have their own makefiles and can be built separately (they are normally built by recursive <code>make</code> from <code>camino</code>). If you were hacking on the feedhandlers or Flashblock, you may wish to check your changes by simply rebuilding them rather than all of Camino; from <code>$OBJDIR/camino</code>, run <code>make -C feedhandlers</code> or <code>make -C flashblock</code> to build these pieces. External pieces that are built using Xcode projects can generally ''not'' be built in this manner. | ||
+ | |||
+ | * Cleaning a single directory - Any directory with its own Makefile can be <code>clean</code>ed or <code>distclean</code>ed separately. For instance, you may want to clean up just <code>striptease</code>; in that case, from <code>$OBJDIR/camino</code>, run <code>make -C striptease clean</code>. '''N.B.''' If you <code>distclean</code> a directory, you will need to run its parent’s <code>export</code> target or <code>make -f client.mk</code> from <code>mozilla</code> in order to regenerate that directory's Makefile. |
Latest revision as of 14:41, 24 January 2009
You can run make
with a number of different targets to perform various tasks. Most interesting make
targets can be found in mozilla/client.mk
and various Makefiles, such as mozilla/camino/Makefile.in
and mozilla/camino/installer/Makefile.in
.
Targets
Targets are valid for both Camino Makefiles (and any other Makefile in the tree) and for client.mk
, unless otherwise noted. All targets can be used with both make
in the $OBJDIR
or make
in the $SRCDIR
in a srcdir build (after the initial client.mk
-driven build). Running make
with a target at the root of the OBJDIR (or srcdir, after a client.mk
-driven build) will run that target recursively throughout the entire tree, including for Camino.
build
- This target triggers a full Mozilla build without performing a checkout (or update) first- This can only be used with
make -f client.mk
in the$SRCDIR
; at the root of the$OBJDIR
,make
with no target is the equivalent.
- This can only be used with
checkout
- This target triggers a Mozilla cvs checkout (or update of an existing checkout) without subsequently performing a build.- For obvious reasons, this can only be used with
make -f client.mk
in the$SRCDIR
.
- For obvious reasons, this can only be used with
clean
- Removes the object files and other generated files, as well as any files or directories in theGARBAGE
orGARBAGE_DIRS
Makefile variables; it runs recursively from the point in the directory hierarchy where it is called. When run for Camino,clean
also removes thebuild/
directory.- This target can be used in the
$OBJDIR
in OBJDIR builds and in the$SRCDIR
in non-OBJDIR builds (or withmake -f client.mk
).
- This target can be used in the
distclean
- Likeclean
, this removes intermediate build products (like object files), but it also removes Makefiles as well as any and all final build products indist/
; it runs recursively from the point in the directory hierarchy where it is called. When run for Camino, this removes Camino’s intermediate build products (like object files and thebuild/
directory), as well as any of Camino's final build products indist/
.- This target can be used in the
$OBJDIR
in OBJDIR builds and in the$SRCDIR
in non-OBJDIR builds (or withmake -f client.mk
).
- This target can be used in the
export
-export
is usually the first target run bybuild
or a stand-alonemake
; it configures the build, generates headers from IDL files, and exports various headers to locations where other parts of the build process can find them. There are few situations where you would run this target by itself in a full Mozilla build. For Camino, when first called byclient.mk
’sexport
target, theexport
target sets up the Camino part of the OBJDIR. This involves generating the Makefile fromMakefile.in
, symlinking thewallet
files and most source directories, and copying the project files without clobbering the personal settings contained within. You should re-run this target in your$OBJDIR
each time the project file is updated, when the Makefile itself changes (it will update itself in the OBJDIR), or when a new subdirectory is added tomozilla/camino
.
libs
- This target is rarely called directly, either in a full Mozilla build or for Camino; however, it is the meat of a Camino build. In Camino, the targetslibs
depends on generate all of the Camino files that require on preprocessing (e.g.,all-camino.js
,Info.plist
, and all of theLocalizable.strings
and other.strings
files. This target is also responsible for theembed-replacements
system, for callingxcodebuild
in the initial Mozilla build and in command-line Camino builds, for copying the final Camino application todist/
, and for handling thexpt
files. After any.strings
file changes, any updates to the Gecko milestone, or any Camino version number change, the various dependent targets need to be re-run; the simplest way to do this is to simplymake
in$OBJDIR/camino
(ormozilla/camino
in a srcdir build).- N.B. Camino also has certain “external” pieces of code that are built only by recursive
make
and not by separate Camino Makefile targets or by project-related dependencies. If you do notmake
in Camino after these pieces of code are added or modified, your Xcode build will fail or will not pick up the changes.
- N.B. Camino also has certain “external” pieces of code that are built only by recursive
Other useful make
tricks
make
is also capable of processing directories selectively using -C directory
rather than performing a full recursive pass through the tree. Some scenarios where this is useful include:
- Widget code - You've made changes to Cocoa widget code; as described in the build instructions, you can
make
in the Widget directory and then Camino to get the Widget changes into your build. From the root of your$OBJDIR
, run the following command:make -C widget/src/cocoa; make -C embedding/config; make -C camino
- Packaging a build - If you have a static build you want to distribute, you need to make in
camino/installer
to invoke the packaging mechanism. After making sure you have run a command-line build in Camino (to ensure all of the steps in thelibs
target have run,make -C installer; open ../dist
from$OBJDIR/camino
to generate the disk image and open thedist/
directory. (If you have a Universal build and you only want to package one half, ensure you are in the appropriate architecture subdirectory—$OBJDIR/ppc/camino
or$OBJDIR/i386/camino
—and runmake -C installer UNIVERSAL_BINARY=
.) N.B. There is some situation in which you will need to do a full build frommake -f client.mk build
before performing packaging; I can't remember what that is right now, though.
- Rebuilding an “external” piece of Camino - Some “external” Camino dependencies (those bits of code in directories sitting directly in
mozilla/camino
rather than inmozilla/camino/src
) have their own makefiles and can be built separately (they are normally built by recursivemake
fromcamino
). If you were hacking on the feedhandlers or Flashblock, you may wish to check your changes by simply rebuilding them rather than all of Camino; from$OBJDIR/camino
, runmake -C feedhandlers
ormake -C flashblock
to build these pieces. External pieces that are built using Xcode projects can generally not be built in this manner.
- Cleaning a single directory - Any directory with its own Makefile can be
clean
ed ordistclean
ed separately. For instance, you may want to clean up juststriptease
; in that case, from$OBJDIR/camino
, runmake -C striptease clean
. N.B. If youdistclean
a directory, you will need to run its parent’sexport
target ormake -f client.mk
frommozilla
in order to regenerate that directory's Makefile.