2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 ifeq (,$(MAKE_VERSION
))
8 $(error GNU Make is required
)
11 ifneq ($(make_min_ver
),$(firstword $(sort $(make_min_ver
) $(MAKE_VERSION
))))
12 $(error GNU Make
$(make_min_ver
) or higher is required
)
16 export TOPLEVEL_BUILD
:= 1
20 ifdef COMPILE_ENVIRONMENT
21 include $(topsrcdir
)/$(MOZ_BUILD_APP
)/build.mk
25 include $(topsrcdir
)/config
/config.mk
27 GARBAGE_DIRS
+= dist _javagen _profile staticlib
28 DIST_GARBAGE
= config.cache config.log config.status
* config-defs.h \
31 netwerk
/necko-config.h xpcom
/xpcom-config.h xpcom
/xpcom-private.h \
34 ifndef MOZ_PROFILE_USE
35 # We need to explicitly put backend.RecursiveMakeBackend.built here
36 # otherwise the rule in rules.mk doesn't run early enough.
37 libs binaries
export tools
:: CLOBBER
$(topsrcdir
)/configure config.status backend.RecursiveMakeBackend.built
39 libs binaries
export tools
:: js-config-status
43 CLOBBER
: $(topsrcdir
)/CLOBBER
44 @echo
"STOP! The CLOBBER file has changed."
45 @echo
"Please run the build through a sanctioned build wrapper, such as"
46 @echo
"'mach build' or client.mk."
49 $(topsrcdir
)/configure
: $(topsrcdir
)/configure.in
50 @echo
"STOP! configure.in has changed, and your configure is out of date."
51 @echo
"Please rerun autoconf and re-configure your build directory."
52 @echo
"To ignore this message, touch 'configure' in the source directory,"
53 @echo
"but your build might not succeed."
56 config.status
: $(topsrcdir
)/configure
57 @echo
"STOP! configure has changed and needs to be run in this build directory."
58 @echo
"Please rerun configure."
59 @echo
"To ignore this message, touch 'config.status' in the build directory,"
60 @echo
"but your build might not succeed."
64 .PHONY
: js-config-status
66 $(call SUBMAKE
,backend.RecursiveMakeBackend.built
,js
/src
,1)
69 install_manifests
:= bin idl
include public private sdk
70 install_manifest_depends
= \
72 $(topsrcdir
)/configure \
74 backend.RecursiveMakeBackend.built \
78 install_manifest_depends
+= js-config-status
81 .PHONY
: install-manifests
82 install-manifests
: $(addprefix install-dist-
,$(install_manifests
))
84 .PHONY
: $(addprefix install-dist-
,$(install_manifests
))
85 $(addprefix install-dist-
,$(install_manifests
)): install-dist-
%: $(install_manifest_depends
)
86 $(call py_action
,process_install_manifest
,$(if
$(NO_REMOVE
),--no-remove
)$(DIST
)/$* _build_manifests
/install/dist_
$* $(if
$(LIBXUL_SDK
),,js
/src
/_build_manifests
/install/dist_
$*))
89 install-manifests
: install-tests
90 install-tests
: $(install_manifest_depends
)
91 $(call py_action
,process_install_manifest
,$(if
$(NO_REMOVE
),--no-remove
)_tests _build_manifests
/install/tests js
/src
/_build_manifests
/install/tests
)
94 # _tests should be purged during cleaning. However, we don't want it purged
95 # during PGO builds because it contains some auto-generated files.
96 ifneq ($(filter-out maybe_clobber_profiledbuild
,$(MAKECMDGOALS
)),)
97 GARBAGE_DIRS
+= _tests
100 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
101 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
102 # process the install manifests as part of export.
103 ifdef MOZ_PROFILE_USE
104 ifndef NO_PROFILE_GUIDED_OPTIMIZE
105 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
106 export:: install-manifests
108 @
$(MAKE
) install-manifests NO_REMOVE
=1
111 else # !MOZ_PROFILE_USE (normal build)
112 export:: install-manifests
114 @
$(MAKE
) install-manifests NO_REMOVE
=1
117 # For historical reasons that are unknown, $(DIST)/sdk is always blown away
118 # with no regard for PGO passes. This decision could probably be revisited.
119 export:: install-dist-sdk
122 # Additional makefile targets to call automated test suites
123 include $(topsrcdir
)/testing
/testsuite-targets.mk
127 $(call BUILDSTATUS
,TIERS
export $(if
$(MOZ_PSEUDO_DERECURSE
),compile
)libs tools
)
129 include $(topsrcdir
)/config
/rules.mk
132 $(RM
) $(DIST_GARBAGE
)
134 ifeq ($(OS_ARCH
),WINNT
)
135 # we want to copy PDB files on Windows
136 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
138 MAKE_SYM_STORE_ARGS
+= -i
140 DUMP_SYMS_BIN ?
= $(topsrcdir
)/toolkit
/crashreporter
/tools
/win32
/dump_syms_vc
$(_MSC_VER
).exe
141 # PDB files don't get moved to dist, so we need to scan the whole objdir
142 MAKE_SYM_STORE_PATH
:= .
144 ifeq ($(OS_ARCH
),Darwin
)
145 # need to pass arch flags for universal builds
146 ifdef UNIVERSAL_BINARY
147 MAKE_SYM_STORE_ARGS
:= -c
-a
"i386 x86_64" --vcs-info
148 MAKE_SYM_STORE_PATH
:= $(DIST
)/universal
150 MAKE_SYM_STORE_ARGS
:= -c
-a
$(OS_TEST
) --vcs-info
151 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
153 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
155 ifeq (,$(filter-out Linux SunOS
,$(OS_ARCH
)))
156 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
157 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
158 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
161 SYM_STORE_SOURCE_DIRS
:= $(topsrcdir
)
163 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
165 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
166 EXTRA_BUILDID
:= -$(MOZ_SYMBOLS_EXTRA_BUILDID
)
169 SYMBOL_INDEX_NAME
= \
170 $(MOZ_APP_NAME
)-$(MOZ_APP_VERSION
)-$(OS_TARGET
)-$(BUILDID
)-$(CPU_ARCH
)$(EXTRA_BUILDID
)-symbols.txt
173 ifdef MOZ_CRASHREPORTER
174 echo building symbol store
175 $(RM
) -r
$(DIST
)/crashreporter-symbols
176 $(RM
) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
177 $(NSINSTALL
) -D
$(DIST
)/crashreporter-symbols
178 OBJCOPY
="$(OBJCOPY)" \
179 $(PYTHON
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/symbolstore.py \
180 $(MAKE_SYM_STORE_ARGS
) \
181 $(foreach dir,$(SYM_STORE_SOURCE_DIRS
),-s
$(dir)) \
183 $(DIST
)/crashreporter-symbols \
184 $(MAKE_SYM_STORE_PATH
) | grep
-iv
test > \
185 $(DIST
)/crashreporter-symbols
/$(SYMBOL_INDEX_NAME
)
187 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
188 cd
$(DIST
)/crashreporter-symbols
&& \
189 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" .
-x
"*test*" -x
"*Test*"
190 cd
$(DIST
)/crashreporter-symbols
&& \
191 grep
"sym" $(SYMBOL_INDEX_NAME
) > $(SYMBOL_INDEX_NAME
).tmp
&& \
192 mv
$(SYMBOL_INDEX_NAME
).tmp
$(SYMBOL_INDEX_NAME
)
193 cd
$(DIST
)/crashreporter-symbols
&& \
194 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
-i
"*.sym" -i
"*.txt" -x
"*test*" -x
"*Test*"
195 endif # MOZ_CRASHREPORTER
198 ifdef MOZ_CRASHREPORTER
199 $(SHELL
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.sh
$(SYMBOL_INDEX_NAME
) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
202 # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
203 # exporting it makes make run its $(shell) command for each invoked submake,
204 # so transform it to an immediate assignment.
205 MOZ_SOURCE_STAMP
:= $(MOZ_SOURCE_STAMP
)
206 export MOZ_SOURCE_STAMP
208 #XXX: this is a hack, since we don't want to clobber for MSVC
209 # PGO support, but we can't do this test in client.mk
210 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
211 # No point in clobbering if PGO has been explicitly disabled.
212 ifndef NO_PROFILE_GUIDED_OPTIMIZE
213 maybe_clobber_profiledbuild
: clean
215 maybe_clobber_profiledbuild
:
218 maybe_clobber_profiledbuild
:
219 $(RM
) $(DIST
)/bin
/*.pgc
220 find
$(DIST
)/$(MOZ_APP_NAME
) -name
"*.pgc" -exec mv
{} $(DIST
)/bin \
;
223 .PHONY
: maybe_clobber_profiledbuild
225 # Look for R_386_PC32 relocations in shared libs, these
226 # break x86_64 builds and SELinux users.
227 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
229 @relcount
=`find $(DIST)/bin -name "*.so" | xargs objdump -R | grep R_386_PC32 | wc -l` && if
test $$relcount -gt
0; then echo
"FAILED: R_386_PC32 relocations detected in a shared library. Did you use a system header without adding it to config/system-headers?"; exit
1; else echo
"PASSED"; fi
233 js
/src
/Makefile
: subsrcdir
:= js
/src
236 # Incorporate static tier directories into tests. This should be incorporated
237 # into moz.build files someday.
239 $(call SUBMAKE
,$@
,js
/src
)
242 ifdef MOZ_PSEUDO_DERECURSE
243 # Interdependencies for parallel export.
244 js
/xpconnect
/src
/export: dom
/bindings
/export
245 accessible
/src
/xpcom
/export: xpcom
/xpidl
/export
246 js
/src
/export: mfbt
/export
247 ifdef ENABLE_CLANG_PLUGIN
248 js
/src
/export config
/export: build
/clang-plugin
/export