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
215 $(call BUILDSTATUS
,TIER_FINISH pgo_profile_generate
)
216 $(call BUILDSTATUS
,TIER_START pgo_package
)
217 $(MAKE
) package 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 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
"==================="
246 $(RM
) $(DIST_GARBAGE
)
248 ifdef MOZ_CRASHREPORTER
249 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
253 .PHONY
: prepsymbolsarchive
256 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
258 ifndef MOZ_AUTOMATION
259 prepsymbolsarchive
: recurse_syms
262 .PHONY
: symbolsfullarchive
263 symbolsfullarchive
: prepsymbolsarchive
264 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
265 $(call py_action
,symbols_archive
,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
266 $(abspath
$(DIST
)/crashreporter-symbols
) \
269 .PHONY
: symbolsarchive
270 symbolsarchive
: prepsymbolsarchive
271 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
272 $(call py_action
,symbols_archive
,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
273 $(abspath
$(DIST
)/crashreporter-symbols
))
275 ifdef MOZ_CRASHREPORTER
276 # Set MOZ_DISABLE_FULL_SYMBOLS to disable generation and upload of the full
277 # crashreporter symbols archives
278 ifdef MOZ_DISABLE_FULL_SYMBOLS
279 buildsymbols
: symbolsarchive
281 buildsymbols
: symbolsfullarchive symbolsarchive
282 endif # MOZ_DISABLE_FULL_SYMBOLS
288 ifdef MOZ_CRASHREPORTER
289 $(PYTHON
) -u
$(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.py
'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
292 .PHONY
: update-packaging
294 $(MAKE
) -C tools
/update-packaging
296 .PHONY
: package-generated-sources
297 package-generated-sources
:
298 $(call py_action
,package_generated_sources
,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
300 #XXX: this is a hack, since we don't want to clobber for MSVC
301 # PGO support, but we can't do this test in client.mk
302 # No point in clobbering if PGO has been explicitly disabled.
303 ifdef NO_PROFILE_GUIDED_OPTIMIZE
304 maybe_clobber_profiledbuild
:
306 ifneq ($(CC_TYPE
),msvc
)
307 maybe_clobber_profiledbuild
: clean
308 ifneq (,$(findstring clang
,$(CC_TYPE
)))
309 $(LLVM_PROFDATA
) merge
-o
$(DEPTH
)/merged.profdata
$(DEPTH
)/*.profraw
312 maybe_clobber_profiledbuild
:
313 $(RM
) $(DIST
)/bin
/*.pgc
314 find
$(DIST
)/$(MOZ_APP_NAME
) -name
'*.pgc' -exec mv
{} $(DIST
)/bin \
;
316 endif # NO_PROFILE_GUIDED_OPTIMIZE
318 .PHONY
: maybe_clobber_profiledbuild
320 # Look for R_386_PC32 relocations in shared libs, these
321 # break x86_64 builds and SELinux users.
322 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
324 @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
328 # Delegate js-specific rules to js
332 source-package
install:
335 # Every export rule depends on config/export, but the rule for config/export
336 # doesn't exist when building js non-standalone.
337 .PHONY
: config
/export
342 # There used to be build interdependencies here. They are now in config/recurse.mk