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
36 # developer builds. Tests always need a new buildid as well.
37 ifneq (,$(MOZ_AUTOMATION
)$(MOZ_BUILD_DATE
)$(TEST_MOZBUILD
))
38 $(MDDEPDIR
)/buildid.h.stub
$(MDDEPDIR
)/source-repo.h.stub
: FORCE
40 # Additionally, provide a dummy target during tests, because
41 # faster/rules.mk will expect these targets to exist.
43 source-repo.h
: $(MDDEPDIR
)/source-repo.h.stub
44 buildid.h
: $(MDDEPDIR
)/buildid.h.stub
49 configure_dir
= $(topsrcdir
)/js
/src
51 configure_dir
= $(topsrcdir
)
54 BUILD_BACKEND_FILES
:= $(addprefix backend.
,$(addsuffix Backend
,$(BUILD_BACKENDS
)))
57 ifndef MOZ_PROFILE_USE
58 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
59 # rules.mk doesn't run early enough.
60 $(TIERS
) binaries
:: CLOBBER
$(configure_dir
)/configure config.status
$(BUILD_BACKEND_FILES
)
61 ifdef MOZ_WIDGET_TOOLKIT
62 ifdef COMPILE_ENVIRONMENT
63 $(TIERS
) binaries
:: $(topsrcdir
)/js
/src
/configure js
/src
/config.status
73 CLOBBER
: $(topsrcdir
)/CLOBBER
74 @echo
'STOP! The CLOBBER file has changed.'
75 @echo
'Please run the build through "mach build".'
79 config.status
: $(configure_dir
)/configure
$(configure_dir
)/old-configure
80 js
/src
/config.status
: $(topsrcdir
)/js
/src
/configure
$(topsrcdir
)/js
/src
/old-configure
81 config.status js
/src
/config.status
:
82 @echo
'STOP! $? has changed and needs to be run again.'
83 @echo
'Please rerun it.'
84 @echo
'To ignore this message, touch "$(CURDIR)/$@",'
85 @echo
'but your build might not succeed.'
88 # Regenerate the build backend if it is out of date. We only have this rule in
89 # this main make file because having it in rules.mk and applied to partial tree
90 # builds resulted in a world of hurt. Gory details are in bug 877308.
92 # The mach build driver will ensure the backend is up to date for partial tree
93 # builds. This cleanly avoids most of the pain.
98 backend
: $(BUILD_BACKEND_FILES
)
100 include $(topsrcdir
)/build
/rebuild-backend.mk
102 Makefile
: $(BUILD_BACKEND_FILES
)
105 default
:: $(BUILD_BACKEND_FILES
)
108 install_manifests
:= \
109 $(addprefix dist/,branding
include public private xpi-stage
) \
112 # Skip the dist/bin install manifest when using the hybrid
113 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
114 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
115 # install manifest non-existent (non-existent manifests being skipped)
116 ifeq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
117 install_manifests
+= dist/bin
119 install_manifest_depends
= \
121 $(configure_dir
)/configure \
123 $(BUILD_BACKEND_FILES
) \
126 ifdef MOZ_WIDGET_TOOLKIT
127 ifdef COMPILE_ENVIRONMENT
128 install_manifest_depends
+= \
129 $(topsrcdir
)/js
/src
/configure \
130 js
/src
/config.status \
135 .PHONY
: install-manifests
136 install-manifests
: $(addprefix install-
,$(install_manifests
))
138 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
139 # to recurse in the faster/ directory in parallel of install manifests.
140 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
141 install-manifests
: faster
144 $(MAKE
) -C faster FASTER_RECURSIVE_MAKE
=1
147 .PHONY
: $(addprefix install-
,$(install_manifests
))
148 $(addprefix install-
,$(install_manifests
)): install-
%: $(install_manifest_depends
)
149 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
150 @
# If we're using the hybrid FasterMake/RecursiveMake backend, we want
151 @
# to ensure the FasterMake end doesn't have install manifests for the
152 @
# same directory, because that would blow up
153 $(if
$(wildcard _build_manifests
/install/$(subst /,_
,$*)),$(if
$(wildcard faster
/install_
$(subst /,_
,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle
$*)))
155 $(addprefix $(call py_action
,process_install_manifest
,--track install_
$(subst /,_
,$*).track
$*) ,$(wildcard _build_manifests
/install/$(subst /,_
,$*)))
157 # Dummy wrapper rule to allow the faster backend to piggy back
158 $(addprefix install-
,$(subst /,_
,$(filter dist/%,$(install_manifests
)))): install-dist_
%: install-dist
/% ;
160 .PHONY
: install-tests
161 install-tests
: install-test-files
163 .PHONY
: install-test-files
165 $(call py_action
,process_install_manifest
,--track install__test_files.track _tests _build_manifests
/install/_test_files
)
167 include $(topsrcdir
)/build
/moz-automation.mk
169 # dist and _tests should be purged during cleaning. However, we don't want them
170 # purged during PGO builds because they contain some auto-generated files.
171 ifneq ($(filter-out maybe_clobber_profiledbuild
,$(MAKECMDGOALS
)),)
172 GARBAGE_DIRS
+= dist _tests
175 # Dummy rule for the cases below where we don't depend on dist/include
178 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
179 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
180 # process the install manifests as part of export.
181 # For the binaries rule, not all the install manifests matter, so force only
182 # the interesting ones to be done.
183 ifdef MOZ_PROFILE_USE
184 ifndef NO_PROFILE_GUIDED_OPTIMIZE
185 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
186 recurse_pre-export
:: install-manifests
188 @
$(MAKE
) install-manifests install_manifests
=dist/include
191 else # !MOZ_PROFILE_USE (normal build)
192 recurse_pre-export
:: install-manifests
194 @
$(MAKE
) install-manifests install_manifests
=dist/include
198 $(topsrcdir
)/mach
--log-no-times artifact
install
200 ifdef MOZ_WIDGET_TOOLKIT
202 # Additional makefile targets to call automated test suites
203 include $(topsrcdir
)/testing
/testsuite-targets.mk
208 $(call BUILDSTATUS
,TIERS
$(TIERS
) $(if
$(MOZ_AUTOMATION
),$(MOZ_AUTOMATION_TIERS
)))
212 $(call BUILDSTATUS
,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use
)
213 $(call BUILDSTATUS
,TIER_START pgo_profile_generate
)
214 $(MAKE
) default MOZ_PROFILE_GENERATE
=1 MOZ_PGO_INSTRUMENTED
=1
215 $(call BUILDSTATUS
,TIER_FINISH pgo_profile_generate
)
216 $(call BUILDSTATUS
,TIER_START pgo_package
)
217 $(MAKE
) package MOZ_PGO_INSTRUMENTED
=1 MOZ_INTERNAL_SIGNING_FORMAT
= MOZ_EXTERNAL_SIGNING_FORMAT
=
218 rm -f jarlog
/en-US.log
219 $(call BUILDSTATUS
,TIER_FINISH pgo_package
)
220 $(call BUILDSTATUS
,TIER_START pgo_profile
)
221 MOZ_PGO_INSTRUMENTED
=1 JARLOG_FILE
=jarlog
/en-US.log
$(PYTHON
) $(topsrcdir
)/build
/pgo
/profileserver.py
10
222 $(call BUILDSTATUS
,TIER_FINISH pgo_profile
)
223 $(call BUILDSTATUS
,TIER_START pgo_clobber
)
224 $(MAKE
) maybe_clobber_profiledbuild
225 $(call BUILDSTATUS
,TIER_FINISH pgo_clobber
)
226 $(call BUILDSTATUS
,TIER_START pgo_profile_use
)
227 $(MAKE
) default MOZ_PROFILE_USE
=1 $(if
$(CLANG_CL
),MOZ_PROFILE_ORDER_FILE
=$(topobjdir
)/cygprofile.txt
)
228 $(call BUILDSTATUS
,TIER_FINISH pgo_profile_use
)
230 # Change default target to PGO build if PGO is enabled.
232 OVERRIDE_DEFAULT_GOAL
:= profiledbuild
235 include $(topsrcdir
)/config
/rules.mk
237 ifdef SCCACHE_VERBOSE_STATS
239 -$(CCACHE
) --show-stats
--stats-format
=json
> sccache-stats.json
240 @echo
"===SCCACHE STATS==="
241 -$(CCACHE
) --show-stats
242 @echo
"==================="
243 ifndef MOZ_PROFILE_GENERATE
244 # Ideally we'd do that in the same file as we set the sccache.log location for
245 # sccache, but it's too late in the build.
246 -gzip
-9 $(DIST
)/sccache.log
251 $(RM
) $(DIST_GARBAGE
)
253 ifdef MOZ_CRASHREPORTER
254 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
258 .PHONY
: prepsymbolsarchive
261 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
263 ifndef MOZ_AUTOMATION
264 prepsymbolsarchive
: recurse_syms
267 .PHONY
: symbolsfullarchive
268 symbolsfullarchive
: prepsymbolsarchive
269 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
270 $(call py_action
,symbols_archive
,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
271 $(abspath
$(DIST
)/crashreporter-symbols
) \
274 --compress
'**/*.sym')
276 .PHONY
: symbolsarchive
277 symbolsarchive
: prepsymbolsarchive
278 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
279 $(call py_action
,symbols_archive
,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
280 $(abspath
$(DIST
)/crashreporter-symbols
) \
281 --include '**/*.sym')
283 ifdef MOZ_CRASHREPORTER
284 buildsymbols
: symbolsfullarchive symbolsarchive
290 ifdef MOZ_CRASHREPORTER
291 $(PYTHON
) -u
$(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.py
'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
294 .PHONY
: update-packaging
296 $(MAKE
) -C tools
/update-packaging
298 .PHONY
: package-generated-sources
299 package-generated-sources
:
300 $(call py_action
,package_generated_sources
,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
302 #XXX: this is a hack, since we don't want to clobber for MSVC
303 # PGO support, but we can't do this test in client.mk
304 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
305 # No point in clobbering if PGO has been explicitly disabled.
306 ifndef NO_PROFILE_GUIDED_OPTIMIZE
307 maybe_clobber_profiledbuild
: clean
309 maybe_clobber_profiledbuild
:
313 maybe_clobber_profiledbuild
: clean
315 maybe_clobber_profiledbuild
:
316 $(RM
) $(DIST
)/bin
/*.pgc
317 find
$(DIST
)/$(MOZ_APP_NAME
) -name
'*.pgc' -exec mv
{} $(DIST
)/bin \
;
321 .PHONY
: maybe_clobber_profiledbuild
323 # Look for R_386_PC32 relocations in shared libs, these
324 # break x86_64 builds and SELinux users.
325 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
327 @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
331 # Delegate js-specific rules to js
335 source-package
install:
338 # Every export rule depends on config/export, but the rule for config/export
339 # doesn't exist when building js non-standalone.
340 .PHONY
: config
/export
345 # There used to be build interdependencies here. They are now in config/recurse.mk