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/.
6 ifeq (,$(MAKE_VERSION
))
7 $(error GNU Make is required
)
10 ifneq ($(make_min_ver
),$(firstword $(sort $(make_min_ver
) $(MAKE_VERSION
))))
11 $(error GNU Make
$(make_min_ver
) or higher is required
)
14 export TOPLEVEL_BUILD
:= 1
20 include $(wildcard $(topsrcdir
)/$(MOZ_BUILD_APP
)/build.mk
)
24 include $(topsrcdir
)/config
/config.mk
26 GARBAGE_DIRS
+= _javagen _profile staticlib
27 DIST_GARBAGE
= config.cache config.log config.status
* config-defs.h \
30 netwerk
/necko-config.h xpcom
/xpcom-config.h xpcom
/xpcom-private.h \
33 ifndef MOZ_PROFILE_USE
34 # Automation builds should always have a new buildid, but for the sake of not
35 # re-linking libxul on every incremental build we do not enforce this for
37 ifneq (,$(MOZ_AUTOMATION
)$(MOZ_BUILD_DATE
))
38 buildid.h source-repo.h
: FORCE
43 configure_dir
= $(topsrcdir
)/js
/src
45 configure_dir
= $(topsrcdir
)
48 BUILD_BACKEND_FILES
:= $(addprefix backend.
,$(addsuffix Backend
,$(BUILD_BACKENDS
)))
51 ifndef MOZ_PROFILE_USE
52 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
53 # rules.mk doesn't run early enough.
54 $(TIERS
) binaries
:: CLOBBER
$(configure_dir
)/configure config.status
$(BUILD_BACKEND_FILES
)
55 ifdef MOZ_WIDGET_TOOLKIT
56 ifdef COMPILE_ENVIRONMENT
57 $(TIERS
) binaries
:: $(topsrcdir
)/js
/src
/configure js
/src
/config.status
67 CLOBBER
: $(topsrcdir
)/CLOBBER
68 @echo
'STOP! The CLOBBER file has changed.'
69 @echo
'Please run the build through "mach build".'
73 $(topsrcdir
)/configure
: $(topsrcdir
)/configure.in
$(topsrcdir
)/old-configure.in
74 $(topsrcdir
)/js
/src
/configure
: $(topsrcdir
)/js
/src
/configure.in
$(topsrcdir
)/js
/src
/old-configure.in
75 $(topsrcdir
)/configure
$(topsrcdir
)/js
/src
/configure
:
76 @echo
'STOP! $? has changed, and your configure is out of date.'
77 @echo
'Please rerun autoconf and re-configure your build directory.'
78 @echo
'To ignore this message, touch "$@",'
79 @echo
'but your build might not succeed.'
82 config.status
: $(configure_dir
)/configure
$(configure_dir
)/old-configure
83 js
/src
/config.status
: $(topsrcdir
)/js
/src
/configure
$(topsrcdir
)/js
/src
/old-configure
84 config.status js
/src
/config.status
:
85 @echo
'STOP! $? has changed and needs to be run again.'
86 @echo
'Please rerun it.'
87 @echo
'To ignore this message, touch "$(CURDIR)/$@",'
88 @echo
'but your build might not succeed.'
91 # Regenerate the build backend if it is out of date. We only have this rule in
92 # this main make file because having it in rules.mk and applied to partial tree
93 # builds resulted in a world of hurt. Gory details are in bug 877308.
95 # The mach build driver will ensure the backend is up to date for partial tree
96 # builds. This cleanly avoids most of the pain.
101 backend
: $(BUILD_BACKEND_FILES
)
103 include $(topsrcdir
)/build
/rebuild-backend.mk
105 Makefile
: $(BUILD_BACKEND_FILES
)
108 default
:: $(BUILD_BACKEND_FILES
)
111 install_manifests
:= \
112 $(addprefix dist/,branding idl
include public private xpi-stage
) \
115 # Skip the dist/bin install manifest when using the hybrid
116 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
117 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
118 # install manifest non-existent (non-existent manifests being skipped)
119 ifeq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
120 install_manifests
+= dist/bin
122 install_manifest_depends
= \
124 $(configure_dir
)/configure \
126 $(BUILD_BACKEND_FILES
) \
129 ifdef MOZ_WIDGET_TOOLKIT
130 ifdef COMPILE_ENVIRONMENT
131 install_manifest_depends
+= \
132 $(topsrcdir
)/js
/src
/configure \
133 js
/src
/config.status \
138 .PHONY
: install-manifests
139 install-manifests
: $(addprefix install-
,$(install_manifests
))
141 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
142 # to recurse in the faster/ directory in parallel of install manifests.
143 # But dist/idl needs to happen before (cf. dependencies in
144 # config/faster/rules.mk)
145 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
146 install-manifests
: faster
148 faster
: install-dist
/idl
149 $(MAKE
) -C faster FASTER_RECURSIVE_MAKE
=1
152 .PHONY
: $(addprefix install-
,$(install_manifests
))
153 $(addprefix install-
,$(install_manifests
)): install-
%: $(install_manifest_depends
)
154 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
155 @
# If we're using the hybrid FasterMake/RecursiveMake backend, we want
156 @
# to ensure the FasterMake end doesn't have install manifests for the
157 @
# same directory, because that would blow up
158 $(if
$(wildcard _build_manifests
/install/$(subst /,_
,$*)),$(if
$(wildcard faster
/install_
$(subst /,_
,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle
$*)))
160 $(addprefix $(call py_action
,process_install_manifest
,--track install_
$(subst /,_
,$*).track
$*) ,$(wildcard _build_manifests
/install/$(subst /,_
,$*)))
162 # Dummy wrapper rule to allow the faster backend to piggy back
163 $(addprefix install-
,$(subst /,_
,$(filter dist/%,$(install_manifests
)))): install-dist_
%: install-dist
/% ;
165 .PHONY
: install-tests
166 install-tests
: install-test-files
168 .PHONY
: install-test-files
170 $(call py_action
,process_install_manifest
,--track install__test_files.track _tests _build_manifests
/install/_test_files
)
172 include $(topsrcdir
)/build
/moz-automation.mk
174 # dist and _tests should be purged during cleaning. However, we don't want them
175 # purged during PGO builds because they contain some auto-generated files.
176 ifneq ($(filter-out maybe_clobber_profiledbuild
,$(MAKECMDGOALS
)),)
177 GARBAGE_DIRS
+= dist _tests
180 # Dummy rule for the cases below where we don't depend on dist/include
183 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
184 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
185 # process the install manifests as part of export.
186 # For the binaries rule, not all the install manifests matter, so force only
187 # the interesting ones to be done.
188 ifdef MOZ_PROFILE_USE
189 ifndef NO_PROFILE_GUIDED_OPTIMIZE
190 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
191 recurse_pre-export
:: install-manifests
193 @
$(MAKE
) install-manifests install_manifests
=dist/include
196 else # !MOZ_PROFILE_USE (normal build)
197 recurse_pre-export
:: install-manifests
199 @
$(MAKE
) install-manifests install_manifests
=dist/include
203 $(topsrcdir
)/mach
--log-no-times artifact
install
205 ifdef MOZ_WIDGET_TOOLKIT
207 # Additional makefile targets to call automated test suites
208 include $(topsrcdir
)/testing
/testsuite-targets.mk
213 $(call BUILDSTATUS
,TIERS
$(TIERS
) $(if
$(MOZ_AUTOMATION
),$(MOZ_AUTOMATION_TIERS
)))
217 $(call BUILDSTATUS
,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use
)
218 $(call BUILDSTATUS
,TIER_START pgo_profile_generate
)
219 $(MAKE
) default MOZ_PROFILE_GENERATE
=1 MOZ_PGO_INSTRUMENTED
=1
220 $(call BUILDSTATUS
,TIER_FINISH pgo_profile_generate
)
221 $(call BUILDSTATUS
,TIER_START pgo_package
)
222 $(MAKE
) package MOZ_PGO_INSTRUMENTED
=1 MOZ_INTERNAL_SIGNING_FORMAT
= MOZ_EXTERNAL_SIGNING_FORMAT
=
223 rm -f jarlog
/en-US.log
224 $(call BUILDSTATUS
,TIER_FINISH pgo_package
)
225 $(call BUILDSTATUS
,TIER_START pgo_profile
)
226 MOZ_PGO_INSTRUMENTED
=1 JARLOG_FILE
=jarlog
/en-US.log
$(PYTHON
) $(topsrcdir
)/build
/pgo
/profileserver.py
10
227 $(call BUILDSTATUS
,TIER_FINISH pgo_profile
)
228 $(call BUILDSTATUS
,TIER_START pgo_clobber
)
229 $(MAKE
) maybe_clobber_profiledbuild
230 $(call BUILDSTATUS
,TIER_FINISH pgo_clobber
)
231 $(call BUILDSTATUS
,TIER_START pgo_profile_use
)
232 $(MAKE
) default MOZ_PROFILE_USE
=1
233 $(call BUILDSTATUS
,TIER_FINISH pgo_profile_use
)
235 # Change default target to PGO build if PGO is enabled.
237 OVERRIDE_DEFAULT_GOAL
:= profiledbuild
240 include $(topsrcdir
)/config
/rules.mk
242 ifdef SCCACHE_VERBOSE_STATS
244 -$(CCACHE
) --show-stats
--stats-format
=json
> sccache-stats.json
245 @echo
"===SCCACHE STATS==="
246 -$(CCACHE
) --show-stats
247 @echo
"==================="
248 ifndef MOZ_PROFILE_GENERATE
249 # Ideally we'd do that in the same file as we set the sccache.log location for
250 # sccache, but it's too late in the build.
251 -gzip
-9 $(DIST
)/sccache.log
256 $(RM
) $(DIST_GARBAGE
)
258 ifdef MOZ_CRASHREPORTER
259 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
263 .PHONY
: prepsymbolsarchive
266 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
268 ifndef MOZ_AUTOMATION
269 prepsymbolsarchive
: recurse_syms
272 .PHONY
: symbolsfullarchive
273 symbolsfullarchive
: prepsymbolsarchive
274 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
275 $(call py_action
,symbols_archive
,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
276 $(abspath
$(DIST
)/crashreporter-symbols
) \
279 --compress
'**/*.sym')
281 .PHONY
: symbolsarchive
282 symbolsarchive
: prepsymbolsarchive
283 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
284 $(call py_action
,symbols_archive
,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
285 $(abspath
$(DIST
)/crashreporter-symbols
) \
286 --include '**/*.sym')
288 ifdef MOZ_CRASHREPORTER
289 buildsymbols
: symbolsfullarchive symbolsarchive
295 ifdef MOZ_CRASHREPORTER
296 $(PYTHON
) -u
$(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.py
'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
299 .PHONY
: update-packaging
301 $(MAKE
) -C tools
/update-packaging
303 .PHONY
: package-generated-sources
304 package-generated-sources
:
305 $(call py_action
,package_generated_sources
,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
307 #XXX: this is a hack, since we don't want to clobber for MSVC
308 # PGO support, but we can't do this test in client.mk
309 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
310 # No point in clobbering if PGO has been explicitly disabled.
311 ifndef NO_PROFILE_GUIDED_OPTIMIZE
312 maybe_clobber_profiledbuild
: clean
314 maybe_clobber_profiledbuild
:
317 maybe_clobber_profiledbuild
:
318 $(RM
) $(DIST
)/bin
/*.pgc
319 find
$(DIST
)/$(MOZ_APP_NAME
) -name
'*.pgc' -exec mv
{} $(DIST
)/bin \
;
322 .PHONY
: maybe_clobber_profiledbuild
324 # Look for R_386_PC32 relocations in shared libs, these
325 # break x86_64 builds and SELinux users.
326 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
328 @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
332 # Delegate js-specific rules to js
336 source-package
install:
339 # Every export rule depends on config/export, but the rule for config/export
340 # doesn't exist when building js non-standalone.
341 .PHONY
: config
/export
346 # There used to be build interdependencies here. They are now in config/recurse.mk