1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
14 # The Original Code is mozilla.org code.
16 # The Initial Developer of the Original Code is
17 # Netscape Communications Corporation.
18 # Portions created by the Initial Developer are Copyright (C) 1998
19 # the Initial Developer. All Rights Reserved.
23 # Benjamin Smedberg <bsmedberg@covad.net>
24 # Chase Phillips <chase@mozilla.org>
25 # Mark Mentovai <mark@moxienet.com>
27 # Alternatively, the contents of this file may be used under the terms of
28 # either the GNU General Public License Version 2 or later (the "GPL"), or
29 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
39 # ***** END LICENSE BLOCK *****
41 # Build a mozilla application.
43 # To checkout and build a tree,
44 # 1. cvs co mozilla/client.mk
46 # 3. create your .mozconfig file with
47 # mk_add_options MOZ_CO_PROJECT=
49 # 4. gmake -f client.mk
51 # This script will pick up the CVSROOT from the CVS/Root file. If you wish
52 # to use a different CVSROOT, you must set CVSROOT in your environment:
54 # export CVSROOT=:pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot
55 # export CVSROOT=:pserver:username%somedomain.org@cvs.mozilla.org:/cvsroot
57 # You must specify which products/modules you wish to checkout, with
58 # MOZ_CO_PROJECT and MOZ_CO_MODULE variables.
60 # MOZ_CO_PROJECT possibilities include the following:
61 # suite (Seamonkey suite)
62 # browser (aka Firefox)
63 # mail (aka Thunderbird)
64 # minimo (small browser for devices)
65 # composer (standalone composer, aka NVU)
66 # calendar (aka Sunbird, use this to build the calendar extensions also)
71 # Other common MOZ_CO_MODULE options include the following:
72 # mozilla/other-licenses/libart_lgpl
73 # mozilla/other-licenses/bsdiff
74 # mozilla/tools/codesighs
76 # Other targets (gmake -f client.mk [targets...]),
79 # clean (realclean is now the same as clean)
82 # See http://developer.mozilla.org/en/docs/Build_Documentation for
86 # MOZ_BUILD_PROJECTS - Build multiple projects in subdirectories
88 # MOZ_OBJDIR - Destination object directory
89 # MOZ_CO_DATE - Date tag to use for checkout (default: none)
90 # MOZ_CO_LOCALES_DATE - Date tag to use for locale checkout
91 # (default: MOZ_CO_DATE)
92 # MOZ_CO_MODULE - Module to checkout
93 # MOZ_CVS_FLAGS - Flags to pass cvs (default: -q -z3)
94 # MOZ_CO_FLAGS - Flags to pass after 'cvs co' (default: -P)
95 # MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
96 # MOZ_CO_LOCALES - localizations to pull (MOZ_CO_LOCALES="de-DE,pt-BR")
97 # MOZ_LOCALE_DIRS - directories which contain localizations
98 # LOCALES_CVSROOT - CVSROOT to use to pull localizations
99 # MOZ_PREFLIGHT_ALL } - Makefiles to run before any project in
100 # MOZ_PREFLIGHT } MOZ_BUILD_PROJECTS, before each project, after
101 # MOZ_POSTFLIGHT } each project, and after all projects; these
102 # MOZ_POSTFLIGHT_ALL } variables contain space-separated lists
103 # MOZ_UNIFY_BDATE - Set to use the same bdate for each project in
107 AVAILABLE_PROJECTS
= \
122 # Trailing / on top-level mozilla dir required to stop fast-update thinking
123 # it is a module name.
124 MODULES_NS_necko
:= \
133 mozilla
/modules
/libpref \
134 mozilla
/modules
/zlib \
137 mozilla
/tools
/test-harness \
141 $(MODULES_NS_necko
) \
162 mozilla
/memory
/jemalloc \
164 mozilla
/js
/src
/fdlibm \
165 mozilla
/js
/src
/liveconnect \
166 mozilla
/js
/src
/xpconnect \
168 mozilla
/modules
/lcms \
169 mozilla
/modules
/libimg \
170 mozilla
/modules
/libjar \
171 mozilla
/modules
/libpr0n \
172 mozilla
/modules
/libreg \
173 mozilla
/modules
/libutil \
174 mozilla
/modules
/oji \
175 mozilla
/modules
/plugin \
176 mozilla
/modules
/staticmod \
181 mozilla
/security
/manager \
184 mozilla
/modules
/libpr0n \
185 mozilla
/modules
/libmar \
186 mozilla
/modules
/libbz2 \
188 mozilla
/other-licenses
/atk-1.0 \
189 mozilla
/other-licenses
/ia2 \
190 mozilla
/security
/manager \
191 mozilla
/tools
/elf-dynstr-gc \
201 mozilla
/db
/morkreader \
202 mozilla
/testing
/crashtest \
203 mozilla
/testing
/mochitest \
216 mozilla
/browser
/config
/version.txt \
217 mozilla
/mail
/config
/version.txt \
218 mozilla
/calendar
/sunbird
/config
/version.txt \
219 mozilla
/suite
/config
/version.txt \
226 MODULES_NS_toolkit
:= \
241 BOOTSTRAP_toolkit
:= \
245 MODULES_NS_suite
:= \
246 $(MODULES_NS_toolkit
) \
251 mozilla
/directory
/xpcom \
254 mozilla
/other-licenses
/7zstub
/seamonkey \
261 extensions
/reporter \
262 extensions
/spellcheck \
266 $(BOOTSTRAP_toolkit
) \
269 MODULES_NS_browser
:= \
270 $(MODULES_NS_toolkit
) \
276 mozilla
/other-licenses
/branding
/firefox \
277 mozilla
/other-licenses
/7zstub
/firefox \
283 extensions
/reporter \
284 extensions
/spellcheck \
285 other-licenses
/branding
/firefox \
288 BOOTSTRAP_browser
:= \
289 $(BOOTSTRAP_toolkit
) \
290 mozilla
/browser
/config
/mozconfig \
293 MODULES_NS_minimo
:= \
294 $(MODULES_NS_toolkit
) \
302 BOOTSTRAP_minimo
:= \
303 $(BOOTSTRAP_toolkit
) \
307 $(MODULES_NS_toolkit
) \
312 mozilla
/directory
/xpcom \
315 mozilla
/other-licenses
/branding
/thunderbird \
316 mozilla
/other-licenses
/7zstub
/thunderbird \
322 other-licenses
/branding
/thunderbird \
324 extensions
/spellcheck \
328 $(BOOTSTRAP_toolkit
) \
329 mozilla
/mail
/config
/mozconfig \
332 MODULES_composer
:= \
337 MODULES_NS_calendar
:= \
338 $(MODULES_NS_toolkit
) \
341 MODULES_calendar
:= \
346 mozilla
/other-licenses
/branding
/sunbird \
347 mozilla
/other-licenses
/7zstub
/sunbird \
350 LOCALES_calendar
:= \
353 other-licenses
/branding
/sunbird \
356 BOOTSTRAP_calendar
:= \
357 $(BOOTSTRAP_toolkit
) \
358 mozilla
/calendar
/sunbird
/config
/mozconfig \
361 MODULES_NS_xulrunner
:= \
362 $(MODULES_NS_toolkit
) \
365 MODULES_xulrunner
:= \
370 LOCALES_xulrunner
:= \
374 BOOTSTRAP_xulrunner
:= \
375 $(BOOTSTRAP_toolkit
) \
376 mozilla
/xulrunner
/config
/mozconfig \
379 MODULES_NS_camino
:= \
380 $(MODULES_NS_toolkit
) \
389 BOOTSTRAP_camino
:= \
390 $(BOOTSTRAP_toolkit
) \
391 mozilla
/camino
/config
/mozconfig \
396 mozilla
/modules
/zlib \
400 mozilla
/other-licenses
/bsdiff \
401 mozilla
/other-licenses
/libart_lgpl \
402 mozilla
/tools
/trace-malloc \
403 mozilla
/tools
/jprof \
404 mozilla
/tools
/codesighs \
405 mozilla
/tools
/update-packaging \
408 #######################################################################
411 # For branches, uncomment the MOZ_CO_TAG line with the proper tag,
412 # and commit this file on that tag.
414 NSPR_CO_TAG
= NSPR_4_7_1_BETA2
415 NSS_CO_TAG
= NSS_3_12_BETA3
416 LDAPCSDK_CO_TAG
= LDAPCSDK_6_0_3_CLIENT_BRANCH
419 #######################################################################
426 ifneq (1,$(words $(CWD
)))
427 $(error The mozilla directory cannot be located in a path with spaces.
)
434 ifneq (, $(wildcard client.mk
))
435 # Ran from mozilla directory
436 ROOTDIR
:= $(shell dirname
$(CWD
))
439 # Ran from mozilla/.. directory (?)
441 TOPSRCDIR
:= $(CWD
)/mozilla
444 # on os2, TOPSRCDIR may have two forward slashes in a row, which doesn't
445 # work; replace first instance with one forward slash
446 TOPSRCDIR
:= $(shell echo
"$(TOPSRCDIR)" | sed
-e
's%//%/%')
449 TOPSRCDIR_MOZ
=$(TOPSRCDIR
)
452 # if ROOTDIR equals only drive letter (i.e. "C:"), set to "/"
453 DIRNAME
:= $(shell echo
"$(ROOTDIR)" | sed
-e
's/^.://')
467 CONFIG_GUESS_SCRIPT
:= $(wildcard $(TOPSRCDIR
)/build
/autoconf
/config.guess
)
468 ifdef CONFIG_GUESS_SCRIPT
469 CONFIG_GUESS
= $(shell $(CONFIG_GUESS_SCRIPT
))
471 _IS_FIRST_CHECKOUT
:= 1
474 ####################################
477 ifneq (,$(filter MINGW
%,$(shell uname
-s
)))
478 # check for CRLF line endings
479 ifneq (0,$(shell $(PERL
) -e
'binmode(STDIN); while (<STDIN>) { if (/\r/) { print "1"; exit } } print "0"' < $(TOPSRCDIR
)/client.mk
))
480 $(error This source tree appears to have Windows-style line endings. To \
481 convert it to Unix-style line endings
, run \
482 "python mozilla/build/win32/mozilla-dos2unix.py")
486 ####################################
489 # Add the CVS root to CVS_FLAGS if needed
490 CVS_ROOT_IN_TREE
:= $(shell cat
$(TOPSRCDIR
)/CVS
/Root
2>/dev
/null
)
491 ifneq ($(CVS_ROOT_IN_TREE
),)
492 ifneq ($(CVS_ROOT_IN_TREE
),$(CVSROOT
))
493 CVS_FLAGS
:= -d
$(CVS_ROOT_IN_TREE
)
497 CVS_CO_DATE_FLAGS
= $(if
$(MOZ_CO_DATE
),-D
"$(MOZ_CO_DATE)")
498 CVS_CO_LOCALES_DATE_FLAGS
= $(if
$(MOZ_CO_LOCALES_DATE
),-D
"$(MOZ_CO_LOCALES_DATE)")
499 CVSCO
= $(CVS
) $(CVS_FLAGS
) co $(MOZ_CO_FLAGS
) $(if
$(MOZ_CO_TAG
),-r
$(MOZ_CO_TAG
)) $(CVS_CO_DATE_FLAGS
)
501 MOZ_CO_LOCALES_DATE ?
= $(MOZ_CO_DATE
)
503 CVSCO_LOGFILE
:= $(ROOTDIR
)/cvsco.log
504 CVSCO_LOGFILE
:= $(shell echo
$(CVSCO_LOGFILE
) | sed s
%//%/%)
506 # if LOCALES_CVSROOT is not specified, set it here
507 # (and let mozconfig override it)
508 LOCALES_CVSROOT ?
= :pserver
:anonymous
:anonymous@cvs-mirror.mozilla.org
:/l10n
510 ####################################
511 # Load mozconfig Options
513 # See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
515 MOZCONFIG_LOADER
:= mozilla
/build
/autoconf
/mozconfig2client-mk
516 MOZCONFIG_FINDER
:= mozilla
/build
/autoconf
/mozconfig-find
517 MOZCONFIG_MODULES
:= mozilla
/build
/unix
/uniq.pl
518 run_for_side_effects
:= \
519 $(shell cd
$(ROOTDIR
); \
520 if
test "$(_IS_FIRST_CHECKOUT)"; then \
521 $(CVSCO
) $(MOZCONFIG_FINDER
) $(MOZCONFIG_LOADER
) $(MOZCONFIG_MODULES
); \
524 $(MOZCONFIG_LOADER
) $(TOPSRCDIR
) mozilla
/.mozconfig.mk
> mozilla
/.mozconfig.out
)
525 include $(TOPSRCDIR
)/.mozconfig.mk
527 ####################################
528 # Options that may come from mozconfig
530 MOZ_PROJECT_LIST
:= $(subst $(comma
), ,$(MOZ_CO_PROJECT
))
531 MOZ_PROJECT_LIST
:= $(subst macbrowser
,camino
,$(MOZ_PROJECT_LIST
))
533 ifneq (,$(filter-out $(AVAILABLE_PROJECTS
),$(MOZ_PROJECT_LIST
)))
534 $(error MOZ_CO_PROJECT contains an unrecognized project.
)
537 ifeq (all,$(filter all,$(MOZ_PROJECT_LIST
)))
538 MOZ_PROJECT_LIST
:= $(AVAILABLE_PROJECTS
)
541 MOZ_MODULE_LIST
:= $(subst $(comma
), ,$(MOZ_CO_MODULE
)) $(foreach project
,$(MOZ_PROJECT_LIST
),$(MODULES_
$(project
)))
542 MOZ_MODULE_LIST_NS
:= $(foreach project
,$(MOZ_PROJECT_LIST
),$(MODULES_NS_
$(project
)))
543 LOCALE_DIRS
:= $(MOZ_LOCALE_DIRS
) $(foreach project
,$(MOZ_PROJECT_LIST
),$(LOCALES_
$(project
)))
545 MOZCONFIG_MODULES
+= $(foreach project
,$(MOZ_PROJECT_LIST
),$(BOOTSTRAP_
$(project
)))
547 # Using $(sort) here because it also removes duplicate entries.
548 MOZ_MODULE_LIST
:= $(sort $(MOZ_MODULE_LIST
))
549 LOCALE_DIRS
:= $(sort $(LOCALE_DIRS
))
550 MOZCONFIG_MODULES
:= $(sort $(MOZCONFIG_MODULES
))
552 # Change CVS flags if anonymous root is requested
553 ifdef MOZ_CO_USE_MIRROR
554 CVS_FLAGS
:= -d
:pserver
:anonymous
:anonymous@cvs-mirror.mozilla.org
:/cvsroot
557 # MOZ_CVS_FLAGS - Basic CVS flags
558 ifeq "$(origin MOZ_CVS_FLAGS)" "undefined"
559 CVS_FLAGS
:= $(CVS_FLAGS
) -q
-z
3
561 CVS_FLAGS
:= $(MOZ_CVS_FLAGS
)
564 ifdef MOZ_BUILD_PROJECTS
567 $(error When MOZ_BUILD_PROJECTS is set
, you must set MOZ_OBJDIR
)
569 ifdef MOZ_CURRENT_PROJECT
570 OBJDIR
= $(MOZ_OBJDIR
)/$(MOZ_CURRENT_PROJECT
)
571 MOZ_MAKE
= $(MAKE
) $(MOZ_MAKE_FLAGS
) -C
$(OBJDIR
)
572 BUILD_PROJECT_ARG
= MOZ_BUILD_APP
=$(MOZ_CURRENT_PROJECT
)
574 OBJDIR
= $(error Cannot find the OBJDIR when MOZ_CURRENT_PROJECT is not set.
)
575 MOZ_MAKE
= $(error Cannot build in the OBJDIR when MOZ_CURRENT_PROJECT is not set.
)
578 else # MOZ_BUILD_PROJECTS
581 OBJDIR
= $(MOZ_OBJDIR
)
582 MOZ_MAKE
= $(MAKE
) $(MOZ_MAKE_FLAGS
) -C
$(OBJDIR
)
584 OBJDIR
:= $(TOPSRCDIR
)
585 MOZ_MAKE
:= $(MAKE
) $(MOZ_MAKE_FLAGS
)
588 endif # MOZ_BUILD_PROJECTS
590 ####################################
591 # CVS defines for NSS
595 mozilla
/security
/nss \
596 mozilla
/security
/coreconf \
597 mozilla
/security
/dbm \
602 NSS_CO_FLAGS
:= $(MOZ_CO_FLAGS
)
604 NSS_CO_FLAGS
:= $(NSS_CO_FLAGS
) $(if
$(NSS_CO_TAG
),-r
$(NSS_CO_TAG
),-A
)
606 # Can only pull the tip or branch tags by date
607 ifeq (,$(filter-out HEAD
%BRANCH
,$(NSS_CO_TAG
)))
608 CVSCO_NSS
= $(CVS
) $(CVS_FLAGS
) co $(NSS_CO_FLAGS
) $(CVS_CO_DATE_FLAGS
) $(NSS_CO_MODULE
)
610 CVSCO_NSS
= $(CVS
) $(CVS_FLAGS
) co $(NSS_CO_FLAGS
) $(NSS_CO_MODULE
)
613 ####################################
614 # CVS defines for NSPR
616 NSPR_CO_MODULE
= mozilla
/nsprpub
619 NSPR_CO_FLAGS
:= $(MOZ_CO_FLAGS
)
621 NSPR_CO_FLAGS
:= $(NSPR_CO_FLAGS
) $(if
$(NSPR_CO_TAG
),-r
$(NSPR_CO_TAG
),-A
)
623 # Can only pull the tip or branch tags by date
624 ifeq (,$(filter-out HEAD
%BRANCH
,$(NSPR_CO_TAG
)))
625 CVSCO_NSPR
= $(CVS
) $(CVS_FLAGS
) co $(NSPR_CO_FLAGS
) $(CVS_CO_DATE_FLAGS
) $(NSPR_CO_MODULE
)
627 CVSCO_NSPR
= $(CVS
) $(CVS_FLAGS
) co $(NSPR_CO_FLAGS
) $(NSPR_CO_MODULE
)
630 ####################################
631 # CVS defines for the C LDAP SDK
633 LDAPCSDK_CO_MODULE
= mozilla
/directory
/c-sdk
634 LDAPCSDK_CO_FLAGS
:= -P
636 LDAPCSDK_CO_FLAGS
:= $(MOZ_CO_FLAGS
)
638 LDAPCSDK_CO_FLAGS
:= $(LDAPCSDK_CO_FLAGS
) $(if
$(LDAPCSDK_CO_TAG
),-r
$(LDAPCSDK_CO_TAG
),-A
)
640 # Can only pull the tip or branch tags by date
641 ifeq (,$(filter-out HEAD
%BRANCH
,$(LDAPCSDK_CO_TAG
)))
642 CVSCO_LDAPCSDK
= $(CVS
) $(CVS_FLAGS
) co $(LDAPCSDK_CO_FLAGS
) $(CVS_CO_DATE_FLAGS
) $(LDAPCSDK_CO_MODULE
)
644 CVSCO_LDAPCSDK
= $(CVS
) $(CVS_FLAGS
) co $(LDAPCSDK_CO_FLAGS
) $(LDAPCSDK_CO_MODULE
)
647 ####################################
648 # Error on obsolete variables.
652 $(warning MOZ_MAPINFO is obsolete
, use MOZ_CO_MODULE
=mozilla
/tools
/codesighs instead.
)
653 MOZ_MODULE_LIST
+= mozilla
/tools
/codesighs
655 ifdef MOZ_INTERNAL_LIBART_LGPL
656 $(error MOZ_INTERNAL_LIBART_LGPL is obsolete
, use MOZ_CO_MODULE
=mozilla
/other-licenses
/libart_lgpl instead.
)
659 $(warning MOZ_PHOENIX is obsolete.
)
660 MOZ_MODULE_LIST
+= $(MODULES_browser
)
661 # $(error MOZ_PHOENIX is obsolete, use MOZ_CO_PROJECT=browser and --enable-application=browser)
663 ifdef MOZ_THUNDERBIRD
664 $(warning MOZ_THUNDERBIRD is obsolete.
)
665 MOZ_MODULE_LIST
+= $(MODULES_mail
)
666 # $(error MOZ_THUNDERBIRD is obsolete, use MOZ_CO_PROJECT=mail and --enable-application=mail)
669 ###################################
670 # Checkout main modules
673 # sort is used to remove duplicates.
674 MOZ_MODULE_LIST
:= $(sort $(MOZ_MODULE_LIST
))
675 MOZ_MODULE_LIST_NS
:= $(sort $(MOZ_MODULE_LIST_NS
))
677 ####################################
678 # Suppress standalone modules if they're not needed.
680 CONFIGURES
:= $(TOPSRCDIR
)/configure
681 ifeq (,$(filter mozilla
/xpcom
,$(MOZ_MODULE_LIST
)))
684 CONFIGURES
+= $(TOPSRCDIR
)/nsprpub
/configure
687 ifeq (,$(filter mozilla
/security
/manager
,$(MOZ_MODULE_LIST
)))
690 ifeq (,$(filter mozilla
/directory
/xpcom
,$(MOZ_MODULE_LIST
)))
693 CONFIGURES
+= $(TOPSRCDIR
)/directory
/c-sdk
/configure
696 MODULES_CO_FLAGS
:= -P
698 MODULES_CO_FLAGS
:= $(MOZ_CO_FLAGS
)
700 MODULES_CO_FLAGS
:= $(MODULES_CO_FLAGS
) $(if
$(MOZ_CO_TAG
),-r
$(MOZ_CO_TAG
),-A
)
702 CVSCO_MODULES_NS
= $(CVS
) $(CVS_FLAGS
) co $(MODULES_CO_FLAGS
) $(CVS_CO_DATE_FLAGS
) -l
$(MOZ_MODULE_LIST_NS
)
704 ifeq (,$(strip $(MOZ_MODULE_LIST
)))
705 FASTUPDATE_MODULES
= $(error No modules or projects were specified. Use MOZ_CO_PROJECT to specify a project for checkout.
)
706 CHECKOUT_MODULES
= $(error No modules or projects were specified. Use MOZ_CO_PROJECT to specify a project for checkout.
)
708 FASTUPDATE_MODULES
:= fast_update
$(CVS
) $(CVS_FLAGS
) co $(MODULES_CO_FLAGS
) $(CVS_CO_DATE_FLAGS
) $(MOZ_MODULE_LIST
)
709 CHECKOUT_MODULES
:= cvs_co
$(CVS
) $(CVS_FLAGS
) co $(MODULES_CO_FLAGS
) $(CVS_CO_DATE_FLAGS
) $(MOZ_MODULE_LIST
);
711 ifeq (,$(MOZ_MODULE_LIST_NS
))
712 FASTUPDATE_MODULES_NS
:= true
713 CHECKOUT_MODULES_NS
:= true
715 FASTUPDATE_MODULES_NS
:= fast_update
$(CVSCO_MODULES_NS
)
716 CHECKOUT_MODULES_NS
:= cvs_co
$(CVSCO_MODULES_NS
)
719 ###################################
720 # CVS defines for locales
723 LOCALES_CO_FLAGS
:= -P
725 LOCALES_CO_FLAGS
:= $(MOZ_CO_FLAGS
)
727 LOCALES_CO_FLAGS
:= $(LOCALES_CO_FLAGS
) $(if
$(LOCALES_CO_TAG
),-r
$(LOCALES_CO_TAG
),-A
)
729 ifndef MOZ_CO_LOCALES
730 FASTUPDATE_LOCALES
:= true
731 CHECKOUT_LOCALES
:= true
734 override MOZ_CO_LOCALES
:= $(subst $(comma
), ,$(MOZ_CO_LOCALES
))
736 ifeq (all,$(MOZ_CO_LOCALES
))
737 MOZCONFIG_MODULES
+= $(foreach project
,$(MOZ_PROJECT_LIST
),mozilla
/$(project
)/locales
/all-locales
)
739 LOCALE_CO_DIRS
:= $(sort $(foreach project
,$(MOZ_PROJECT_LIST
),$(foreach locale
,$(shell cat mozilla
/$(project
)/locales
/all-locales
),l10n
/$(locale
)/)))
740 else # MOZ_CO_LOCALES != all
741 LOCALE_CO_DIRS
= $(sort $(foreach locale
,$(MOZ_CO_LOCALES
),l10n
/$(locale
)/))
744 CVSCO_LOCALES
:= $(CVS
) $(CVS_FLAGS
) -d
$(LOCALES_CVSROOT
) co $(LOCALES_CO_FLAGS
) $(CVS_CO_LOCALES_DATE_FLAGS
) $(LOCALE_CO_DIRS
)
746 FASTUPDATE_LOCALES
:= fast_update
$(CVSCO_LOCALES
)
747 CHECKOUT_LOCALES
:= cvs_co
$(CVSCO_LOCALES
)
748 endif #MOZ_CO_LOCALES
750 #######################################################################
754 # Print out any options loaded from mozconfig.
755 all build checkout
clean depend
distclean export libs
install realclean::
756 @if
test -f .mozconfig.out
; then \
757 cat .mozconfig.out
; \
758 rm -f .mozconfig.out
; \
762 ifdef _IS_FIRST_CHECKOUT
765 all:: checkout alldep
768 # Windows equivalents
771 build_all_dep
: alldep
772 build_all_depend
: alldep
773 clobber clobber_all
: clean
774 pull_and_build_all
: checkout alldep
776 # Do everything from scratch
777 everything
: checkout
clean build
779 ####################################
783 # @: Backup the last checkout log.
784 @if
test -f
$(CVSCO_LOGFILE
) ; then \
785 mv
$(CVSCO_LOGFILE
) $(CVSCO_LOGFILE
).old
; \
788 ifdef RUN_AUTOCONF_LOCALLY
789 @echo
"Removing local configures" ; \
791 $(RM
) -f
$(CONFIGURES
)
793 @echo
"checkout start: "`date` | tee
$(CVSCO_LOGFILE
)
794 @echo
'$(CVSCO) mozilla/client.mk $(MOZCONFIG_MODULES)'; \
796 $(CVSCO
) mozilla
/client.mk
$(MOZCONFIG_MODULES
)
797 @cd
$(ROOTDIR
) && $(MAKE
) -f mozilla
/client.mk real_checkout
799 # Start the checkout. Split the output to the tty and a log file.
803 cvs_co
() { set
-e
; echo
"$$@" ; \
804 "$$@" 2>&1 | tee
-a
$(CVSCO_LOGFILE
); }; \
805 cvs_co
$(CVSCO_NSPR
); \
806 cvs_co
$(CVSCO_NSS
); \
807 cvs_co
$(CVSCO_LDAPCSDK
); \
808 $(CHECKOUT_MODULES_NS
); \
809 $(CHECKOUT_MODULES
) \
811 @echo
"checkout finish: "`date` | tee
-a
$(CVSCO_LOGFILE
)
812 # update the NSS checkout timestamp, if we checked PSM out
813 @if
test -d
$(TOPSRCDIR
)/security
/manager
-a \
814 `egrep -c '^(U|C) mozilla/security/(nss|coreconf)' $(CVSCO_LOGFILE) 2>/dev/null` != 0; then \
815 touch
$(TOPSRCDIR
)/security
/manager
/.nss.checkout
; \
817 ifdef RUN_AUTOCONF_LOCALLY
819 $(RM
) -f
$(CONFIGURES
)
821 # @: Check the log for conflicts. ;
822 @conflicts
=`egrep "^C " $(CVSCO_LOGFILE)` ;\
823 if
test "$$conflicts" ; then \
824 echo
"$(MAKE): *** Conflicts during checkout." ;\
825 echo
"$$conflicts" ;\
826 echo
"$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
832 # @: Backup the last checkout log.
833 @if
test -f
$(CVSCO_LOGFILE
) ; then \
834 mv
$(CVSCO_LOGFILE
) $(CVSCO_LOGFILE
).old
; \
837 ifdef RUN_AUTOCONF_LOCALLY
838 @echo
"Removing local configures" ; \
840 $(RM
) -f
$(CONFIGURES
)
842 @echo
"checkout start: "`date` | tee
$(CVSCO_LOGFILE
)
843 @echo
'$(CVSCO) mozilla/client.mk $(MOZCONFIG_MODULES)'; \
845 $(CVSCO
) mozilla
/client.mk
$(MOZCONFIG_MODULES
)
846 @cd
$(TOPSRCDIR
) && \
847 $(MAKE
) -f client.mk real_fast-update
849 # Start the update. Split the output to the tty and a log file.
852 fast_update
() { set
-e
; config
/cvsco-fast-update.pl
$$@
2>&1 | tee
-a
$(CVSCO_LOGFILE
); }; \
853 cvs_co
() { set
-e
; echo
"$$@" ; \
854 "$$@" 2>&1 | tee
-a
$(CVSCO_LOGFILE
); }; \
855 fast_update
$(CVSCO_NSPR
); \
857 cvs_co
$(CVSCO_NSS
); \
859 fast_update
$(CVSCO_LDAPCSDK
); \
860 $(FASTUPDATE_MODULES
); \
861 $(FASTUPDATE_MODULES_NS
); \
862 $(FASTUPDATE_LOCALES
);
863 @echo
"fast_update finish: "`date` | tee
-a
$(CVSCO_LOGFILE
)
864 # update the NSS checkout timestamp
865 @if
test `egrep -c '^(U|C) mozilla/security/(nss|coreconf)' $(CVSCO_LOGFILE) 2>/dev/null` != 0; then \
866 touch
$(TOPSRCDIR
)/security
/manager
/.nss.checkout
; \
868 ifdef RUN_AUTOCONF_LOCALLY
870 $(RM
) -f
$(CONFIGURES
)
872 # @: Check the log for conflicts. ;
873 @conflicts
=`egrep "^C " $(CVSCO_LOGFILE)` ;\
874 if
test "$$conflicts" ; then \
875 echo
"$(MAKE): *** Conflicts during fast-update." ;\
876 echo
"$$conflicts" ;\
877 echo
"$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
882 CVSCO_LOGFILE_L10N
:= $(ROOTDIR
)/cvsco-l10n.log
883 CVSCO_LOGFILE_L10N
:= $(shell echo
$(CVSCO_LOGFILE_L10N
) | sed s
%//%/%)
886 # @: Backup the last checkout log.
887 @if
test -f
$(CVSCO_LOGFILE_L10N
) ; then \
888 mv
$(CVSCO_LOGFILE_L10N
) $(CVSCO_LOGFILE_L10N
).old
; \
891 @echo
"checkout start: "`date` | tee
$(CVSCO_LOGFILE_L10N
)
892 @echo
'$(CVSCO) mozilla/client.mk $(MOZCONFIG_MODULES)'; \
894 $(CVSCO
) mozilla
/client.mk
$(MOZCONFIG_MODULES
)
895 @cd
$(ROOTDIR
) && $(MAKE
) -f mozilla
/client.mk real_l10n-checkout
897 FULL_EN_US_DIRS
:= toolkit \
899 $(MOZ_PROJECT_LIST
) \
902 EN_US_LOCALE_DIRS
:= $(foreach dir, \
903 $(filter-out toolkit extensions
/% $(MOZ_PROJECT_LIST
), $(LOCALE_DIRS
)), \
904 mozilla
/$(dir)/locales
)
906 EN_US_CO_DIRS
:= $(EN_US_LOCALE_DIRS
) \
907 $(foreach mod
,$(FULL_EN_US_DIRS
),mozilla
/$(mod
)) \
910 mozilla
/configure.in \
911 mozilla
/allmakefiles.sh \
916 # Start the checkout. Split the output to the tty and a log file.
919 cvs_co
() { set
-e
; echo
"$$@" ; \
920 "$$@" 2>&1 | tee
-a
$(CVSCO_LOGFILE_L10N
); }; \
921 cvs_co
$(CVS
) $(CVS_FLAGS
) co $(MODULES_CO_FLAGS
) $(CVS_CO_DATE_FLAGS
) $(EN_US_CO_DIRS
); \
922 cvs_co
$(CVSCO_LOCALES
)
923 @echo
"checkout finish: "`date` | tee
-a
$(CVSCO_LOGFILE_L10N
)
924 # @: Check the log for conflicts. ;
925 @conflicts
=`egrep "^C " $(CVSCO_LOGFILE_L10N)` ;\
926 if
test "$$conflicts" ; then \
927 echo
"$(MAKE): *** Conflicts during checkout." ;\
928 echo
"$$conflicts" ;\
929 echo
"$(MAKE): Refer to $(CVSCO_LOGFILE_L10N) for full log." ;\
934 ####################################
935 # Profile-Guided Optimization
936 # To use this, you should set the following variables in your mozconfig
937 # mk_add_options PROFILE_GEN_SCRIPT=/path/to/profile-script
939 # The profile script should exercise the functionality to be included
940 # in the profile feedback.
942 # This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this
943 # is usable in multi-pass builds, where you might not have a runnable
944 # application until all the build passes and postflight scripts have run.
946 PGO_OBJDIR
= $(MOZ_OBJDIR
)
948 PGO_OBJDIR
:= $(TOPSRCDIR
)
952 $(MAKE
) -f
$(TOPSRCDIR
)/client.mk build MOZ_PROFILE_GENERATE
=1
953 OBJDIR
=${PGO_OBJDIR} $(PROFILE_GEN_SCRIPT
)
954 $(MAKE
) -f
$(TOPSRCDIR
)/client.mk maybe_clobber_profiledbuild
955 $(MAKE
) -f
$(TOPSRCDIR
)/client.mk build MOZ_PROFILE_USE
=1
958 #####################################################
961 ifdef _IS_FIRST_CHECKOUT
962 # First time, do build target in a new process to pick up new files.
964 $(MAKE
) -f
$(TOPSRCDIR
)/client.mk build
967 #####################################################
968 # After First Checkout
970 #####################################################
971 # Build date unification
973 ifdef MOZ_UNIFY_BDATE
974 ifndef MOZ_BUILD_DATE
975 ifdef MOZ_BUILD_PROJECTS
976 MOZ_BUILD_DATE
= $(shell $(PYTHON
) $(TOPSRCDIR
)/toolkit
/xre
/make-platformini.py
--print-buildid
)
977 export MOZ_BUILD_DATE
982 #####################################################
983 # Preflight, before building any project
985 build alldep preflight_all
::
986 ifeq (,$(MOZ_CURRENT_PROJECT
)$(if
$(MOZ_PREFLIGHT_ALL
),,1))
987 # Don't run preflight_all for individual projects in multi-project builds
988 # (when MOZ_CURRENT_PROJECT is set.)
989 ifndef MOZ_BUILD_PROJECTS
990 # Building a single project, OBJDIR is usable.
992 for mkfile in
$(MOZ_PREFLIGHT_ALL
); do \
993 $(MAKE
) -f
$(TOPSRCDIR
)/$$mkfile preflight_all TOPSRCDIR
=$(TOPSRCDIR
) OBJDIR
=$(OBJDIR
) MOZ_OBJDIR
=$(MOZ_OBJDIR
); \
996 # OBJDIR refers to the project-specific OBJDIR, which is not available at
997 # this point when building multiple projects. Only MOZ_OBJDIR is available.
999 for mkfile in
$(MOZ_PREFLIGHT_ALL
); do \
1000 $(MAKE
) -f
$(TOPSRCDIR
)/$$mkfile preflight_all TOPSRCDIR
=$(TOPSRCDIR
) MOZ_OBJDIR
=$(MOZ_OBJDIR
) MOZ_BUILD_PROJECTS
="$(MOZ_BUILD_PROJECTS)"; \
1005 # If we're building multiple projects, but haven't specified which project,
1006 # loop through them.
1008 ifeq (,$(MOZ_CURRENT_PROJECT
)$(if
$(MOZ_BUILD_PROJECTS
),,1))
1009 configure depend build
install export libs
clean realclean distclean alldep preflight postflight maybe_clobber_profiledbuild
::
1011 for app in
$(MOZ_BUILD_PROJECTS
); do \
1012 $(MAKE
) -f
$(TOPSRCDIR
)/client.mk
$@ MOZ_CURRENT_PROJECT
=$$app; \
1017 # MOZ_CURRENT_PROJECT: either doing a single-project build, or building an
1018 # individual project in a multi-project build.
1020 ####################################
1023 CONFIG_STATUS
= $(wildcard $(OBJDIR
)/config.status
)
1024 CONFIG_CACHE
= $(wildcard $(OBJDIR
)/config.cache
)
1026 ifdef RUN_AUTOCONF_LOCALLY
1027 EXTRA_CONFIG_DEPS
:= \
1028 $(TOPSRCDIR
)/aclocal.m4 \
1029 $(wildcard $(TOPSRCDIR
)/build
/autoconf
/*.m4
) \
1032 $(TOPSRCDIR
)/configure
: $(TOPSRCDIR
)/configure.in
$(EXTRA_CONFIG_DEPS
)
1033 @echo Generating
$@ using autoconf
1034 cd
$(TOPSRCDIR
); $(AUTOCONF
)
1036 $(TOPSRCDIR
)/nsprpub
/configure
: $(TOPSRCDIR
)/nsprpub
/configure.in
$(EXTRA_CONFIG_DEPS
)
1037 @echo Generating
$@ using autoconf
1038 cd
$(TOPSRCDIR
)/nsprpub
; $(AUTOCONF
)
1040 $(TOPSRCDIR
)/directory
/c-sdk
/configure
: $(TOPSRCDIR
)/directory
/c-sdk
/configure.in
$(EXTRA_CONFIG_DEPS
)
1041 @echo Generating
$@ using autoconf
1042 cd
$(TOPSRCDIR
)/directory
/c-sdk
; $(AUTOCONF
)
1045 CONFIG_STATUS_DEPS
:= \
1046 $(TOPSRCDIR
)/configure \
1047 $(TOPSRCDIR
)/.mozconfig.mk \
1048 $(wildcard $(TOPSRCDIR
)/nsprpub
/configure
) \
1049 $(wildcard $(TOPSRCDIR
)/directory
/c-sdk
/configure
) \
1050 $(wildcard $(TOPSRCDIR
)/config
/milestone.txt
) \
1051 $(wildcard $(TOPSRCDIR
)/config
/chrome-versions.sh
) \
1052 $(wildcard $(addsuffix confvars.sh
,$(wildcard $(TOPSRCDIR
)/*/))) \
1055 # configure uses the program name to determine @srcdir@. Calling it without
1056 # $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
1057 # path of $(TOPSRCDIR).
1058 ifeq ($(TOPSRCDIR
),$(OBJDIR
))
1059 CONFIGURE
= .
/configure
1061 CONFIGURE
= $(TOPSRCDIR
)/configure
1065 CONFIGURE
= $(TOPSRCDIR
)/configure
1068 configure
:: $(CONFIGURES
)
1069 ifdef MOZ_BUILD_PROJECTS
1070 @if
test ! -d
$(MOZ_OBJDIR
); then
$(MKDIR
) $(MOZ_OBJDIR
); else true
; fi
1072 @if
test ! -d
$(OBJDIR
); then
$(MKDIR
) $(OBJDIR
); else true
; fi
1074 @echo
$(CONFIGURE
) $(CONFIGURE_ARGS
)
1075 @cd
$(OBJDIR
) && $(BUILD_PROJECT_ARG
) $(CONFIGURE_ENV_ARGS
) $(CONFIGURE
) $(CONFIGURE_ARGS
) \
1076 ||
( echo
"*** Fix above errors and then restart with\
1077 \"$(MAKE) -f client.mk build\"" && exit
1 )
1078 @touch
$(OBJDIR
)/Makefile
1080 $(OBJDIR
)/Makefile
$(OBJDIR
)/config.status
: $(CONFIG_STATUS_DEPS
)
1081 @
$(MAKE
) -f
$(TOPSRCDIR
)/client.mk configure
1083 ifneq (,$(CONFIG_STATUS
))
1084 $(OBJDIR
)/config
/autoconf.mk
: $(TOPSRCDIR
)/config
/autoconf.mk.in
1086 CONFIG_FILES
=config
/autoconf.mk .
/config.status
1090 ####################################
1093 depend
:: $(OBJDIR
)/Makefile
$(OBJDIR
)/config.status
1094 $(MOZ_MAKE
) export && $(MOZ_MAKE
) depend
1096 ####################################
1099 build alldep preflight
::
1102 for mkfile in
$(MOZ_PREFLIGHT
); do \
1103 $(MAKE
) -f
$(TOPSRCDIR
)/$$mkfile preflight TOPSRCDIR
=$(TOPSRCDIR
) OBJDIR
=$(OBJDIR
) MOZ_OBJDIR
=$(MOZ_OBJDIR
); \
1107 ####################################
1110 build
:: $(OBJDIR
)/Makefile
$(OBJDIR
)/config.status
1113 ####################################
1116 # Pass these target onto the real build system
1117 install export libs
clean realclean distclean alldep maybe_clobber_profiledbuild
:: $(OBJDIR
)/Makefile
$(OBJDIR
)/config.status
1120 ####################################
1123 build alldep postflight
::
1124 ifdef MOZ_POSTFLIGHT
1126 for mkfile in
$(MOZ_POSTFLIGHT
); do \
1127 $(MAKE
) -f
$(TOPSRCDIR
)/$$mkfile postflight TOPSRCDIR
=$(TOPSRCDIR
) OBJDIR
=$(OBJDIR
) MOZ_OBJDIR
=$(MOZ_OBJDIR
); \
1131 endif # MOZ_CURRENT_PROJECT
1133 ####################################
1134 # Postflight, after building all projects
1136 build alldep postflight_all
::
1137 ifeq (,$(MOZ_CURRENT_PROJECT
)$(if
$(MOZ_POSTFLIGHT_ALL
),,1))
1138 # Don't run postflight_all for individual projects in multi-project builds
1139 # (when MOZ_CURRENT_PROJECT is set.)
1140 ifndef MOZ_BUILD_PROJECTS
1141 # Building a single project, OBJDIR is usable.
1143 for mkfile in
$(MOZ_POSTFLIGHT_ALL
); do \
1144 $(MAKE
) -f
$(TOPSRCDIR
)/$$mkfile postflight_all TOPSRCDIR
=$(TOPSRCDIR
) OBJDIR
=$(OBJDIR
) MOZ_OBJDIR
=$(MOZ_OBJDIR
); \
1147 # OBJDIR refers to the project-specific OBJDIR, which is not available at
1148 # this point when building multiple projects. Only MOZ_OBJDIR is available.
1150 for mkfile in
$(MOZ_POSTFLIGHT_ALL
); do \
1151 $(MAKE
) -f
$(TOPSRCDIR
)/$$mkfile postflight_all TOPSRCDIR
=$(TOPSRCDIR
) MOZ_OBJDIR
=$(MOZ_OBJDIR
) MOZ_BUILD_PROJECTS
="$(MOZ_BUILD_PROJECTS)"; \
1158 if
[ -f Makefile
]; then \
1159 $(MAKE
) distclean ; \
1161 echo
"Removing object files from srcdir..."; \
1162 rm -fr
`find . -type d \( -name .deps -print -o -name CVS \
1163 -o -exec test ! -d {}/CVS \; \) -prune \
1164 -o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
1165 build
/autoconf
/clean-config.sh
; \
1168 # (! IS_FIRST_CHECKOUT)
1174 .PHONY
: checkout real_checkout depend build profiledbuild maybe_clobber_profiledbuild
export libs alldep
install clean realclean distclean cleansrcdir pull_all build_all
clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all