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 buildid.h source-repo.h
: FORCE
38 configure_dir
= $(topsrcdir
)/js
/src
40 configure_dir
= $(topsrcdir
)
43 BUILD_BACKEND_FILES
:= $(addprefix backend.
,$(addsuffix Backend
,$(BUILD_BACKENDS
)))
46 ifndef MOZ_PROFILE_USE
47 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
48 # rules.mk doesn't run early enough.
49 $(TIERS
) binaries
:: CLOBBER
$(configure_dir
)/configure config.status
$(BUILD_BACKEND_FILES
)
51 ifdef COMPILE_ENVIRONMENT
52 $(TIERS
) binaries
:: $(topsrcdir
)/js
/src
/configure js
/src
/config.status
62 CLOBBER
: $(topsrcdir
)/CLOBBER
63 @echo
'STOP! The CLOBBER file has changed.'
64 @echo
'Please run the build through a sanctioned build wrapper, such as'
65 @echo
'"mach build" or client.mk.'
69 $(topsrcdir
)/configure
: $(topsrcdir
)/configure.in
$(topsrcdir
)/old-configure.in
70 $(topsrcdir
)/js
/src
/configure
: $(topsrcdir
)/js
/src
/configure.in
$(topsrcdir
)/js
/src
/old-configure.in
71 $(topsrcdir
)/configure
$(topsrcdir
)/js
/src
/configure
:
72 @echo
'STOP! $? has changed, and your configure is out of date.'
73 @echo
'Please rerun autoconf and re-configure your build directory.'
74 @echo
'To ignore this message, touch "$@",'
75 @echo
'but your build might not succeed.'
78 config.status
: $(configure_dir
)/configure
$(configure_dir
)/old-configure
79 js
/src
/config.status
: $(topsrcdir
)/js
/src
/configure
$(topsrcdir
)/js
/src
/old-configure
80 config.status js
/src
/config.status
:
81 @echo
'STOP! $? has changed and needs to be run again.'
82 @echo
'Please rerun it.'
83 @echo
'To ignore this message, touch "$(CURDIR)/$@",'
84 @echo
'but your build might not succeed.'
87 # Regenerate the build backend if it is out of date. We only have this rule in
88 # this main make file because having it in rules.mk and applied to partial tree
89 # builds resulted in a world of hurt. Gory details are in bug 877308.
91 # The mach build driver will ensure the backend is up to date for partial tree
92 # builds. This cleanly avoids most of the pain.
97 backend
: $(BUILD_BACKEND_FILES
)
99 include $(topsrcdir
)/build
/rebuild-backend.mk
101 Makefile
: $(BUILD_BACKEND_FILES
)
104 default
:: $(BUILD_BACKEND_FILES
)
107 install_manifests
:= \
108 $(addprefix dist/,branding idl
include public private sdk xpi-stage
) \
111 # Skip the dist/bin install manifest when using the hybrid
112 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
113 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
114 # install manifest non-existent (non-existent manifests being skipped)
115 ifeq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
116 install_manifests
+= dist/bin
118 install_manifest_depends
= \
120 $(configure_dir
)/configure \
122 $(BUILD_BACKEND_FILES
) \
126 ifdef COMPILE_ENVIRONMENT
127 install_manifest_depends
+= \
128 $(topsrcdir
)/js
/src
/configure \
129 js
/src
/config.status \
134 .PHONY
: install-manifests
135 install-manifests
: $(addprefix install-
,$(install_manifests
))
137 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
138 # to recurse in the faster/ directory in parallel of install manifests.
139 # But dist/idl needs to happen before (cf. dependencies in
140 # config/faster/rules.mk)
141 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
142 install-manifests
: faster
144 faster
: install-dist
/idl
145 $(MAKE
) -C faster FASTER_RECURSIVE_MAKE
=1
150 $(call BUILDSTATUS
,TIERS make tup
)
151 $(call BUILDSTATUS
,TIER_START make
)
152 $(MAKE
) buildid.h source-repo.h
153 $(call BUILDSTATUS
,TIER_FINISH make
)
154 $(call BUILDSTATUS
,TIER_START tup
)
155 @
$(TUP
) $(if
$(findstring s
,$(filter-out --%,$(MAKEFLAGS
))),,--verbose
)
156 $(call BUILDSTATUS
,TIER_FINISH tup
)
158 # process_install_manifest needs to be invoked with --no-remove when building
159 # js as standalone because automated builds are building nspr separately and
160 # that would remove the resulting files.
161 # Eventually, a standalone js build would just be able to build nspr itself,
162 # removing the need for the former.
167 # For an artifact build, _tests will already be partly populated, so run
168 # this install manifest with NO_REMOVE set in this case.
169 ifdef MOZ_ARTIFACT_BUILDS
170 install-_tests
: NO_REMOVE
=1
173 .PHONY
: $(addprefix install-
,$(subst /,_
,$(install_manifests
)))
174 $(addprefix install-
,$(install_manifests
)): install-
%: $(install_manifest_depends
)
175 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
176 @
# If we're using the hybrid FasterMake/RecursiveMake backend, we want
177 @
# to ensure the FasterMake end doesn't have install manifests for the
178 @
# same directory, because that would blow up
179 $(if
$(wildcard _build_manifests
/install/$(subst /,_
,$*)),$(if
$(wildcard faster
/install_
$(subst /,_
,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle
$*)))
181 $(addprefix $(call py_action
,process_install_manifest
,$(if
$(NO_REMOVE
),--no-remove
)$*) ,$(wildcard _build_manifests
/install/$(subst /,_
,$*)))
183 # Dummy wrapper rule to allow the faster backend to piggy back
184 $(addprefix install-
,$(subst /,_
,$(filter dist/%,$(install_manifests
)))): install-dist_
%: install-dist
/% ;
186 .PHONY
: install-tests
187 install-tests
: install-test-files
189 # Force --no-remove, because $objdir/_tests is handled by multiple manifests.
190 .PHONY
: install-test-files
192 $(call py_action
,process_install_manifest
,--no-remove _tests _build_manifests
/install/_test_files
)
194 include $(topsrcdir
)/build
/moz-automation.mk
196 # dist and _tests should be purged during cleaning. However, we don't want them
197 # purged during PGO builds because they contain some auto-generated files.
198 ifneq ($(filter-out maybe_clobber_profiledbuild
,$(MAKECMDGOALS
)),)
199 GARBAGE_DIRS
+= dist _tests
202 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
203 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
204 # process the install manifests as part of export.
205 # For the binaries rule, not all the install manifests matter, so force only
206 # the interesting ones to be done.
207 ifdef MOZ_PROFILE_USE
208 ifndef NO_PROFILE_GUIDED_OPTIMIZE
209 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
210 recurse_pre-export
:: install-manifests
212 @
$(MAKE
) install-manifests NO_REMOVE
=1 install_manifests
=dist/include
215 else # !MOZ_PROFILE_USE (normal build)
216 recurse_pre-export
:: install-manifests
218 @
$(MAKE
) install-manifests NO_REMOVE
=1 install_manifests
=dist/include
221 # For historical reasons that are unknown, $(DIST)/sdk is always blown away
222 # with no regard for PGO passes. This decision could probably be revisited.
223 recurse_pre-export
:: install-dist
/sdk
226 $(topsrcdir
)/mach
--log-no-times artifact
install
230 # Additional makefile targets to call automated test suites
231 include $(topsrcdir
)/testing
/testsuite-targets.mk
236 $(call BUILDSTATUS
,TIERS
$(TIERS
) $(if
$(MOZ_AUTOMATION
),$(MOZ_AUTOMATION_TIERS
)))
238 include $(topsrcdir
)/config
/rules.mk
240 ifdef SCCACHE_VERBOSE_STATS
242 -$(CCACHE
) --show-stats
--stats-format
=json
> sccache-stats.json
243 @echo
"===SCCACHE STATS==="
244 -$(CCACHE
) --show-stats
245 @echo
"==================="
249 $(RM
) $(DIST_GARBAGE
)
251 ifdef MOZ_CRASHREPORTER
252 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
256 .PHONY
: prepsymbolsarchive
259 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
261 ifndef MOZ_AUTOMATION
262 prepsymbolsarchive
: recurse_syms
265 .PHONY
: symbolsfullarchive
266 symbolsfullarchive
: prepsymbolsarchive
267 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
268 $(call py_action
,symbols_archive
,$(abspath
'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip') \
269 $(abspath
$(DIST
)/crashreporter-symbols
) \
272 --compress
'**/*.sym')
274 .PHONY
: symbolsarchive
275 symbolsarchive
: prepsymbolsarchive
276 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
277 $(call py_action
,symbols_archive
,$(abspath
'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip') \
278 $(abspath
$(DIST
)/crashreporter-symbols
) \
279 --include '**/*.sym')
281 ifdef MOZ_CRASHREPORTER
282 buildsymbols
: symbolsfullarchive symbolsarchive
288 ifdef MOZ_CRASHREPORTER
289 ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE
290 $(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 #XXX: this is a hack, since we don't want to clobber for MSVC
299 # PGO support, but we can't do this test in client.mk
300 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
301 # No point in clobbering if PGO has been explicitly disabled.
302 ifndef NO_PROFILE_GUIDED_OPTIMIZE
303 maybe_clobber_profiledbuild
: clean
305 maybe_clobber_profiledbuild
:
308 maybe_clobber_profiledbuild
:
309 $(RM
) $(DIST
)/bin
/*.pgc
310 find
$(DIST
)/$(MOZ_APP_NAME
) -name
'*.pgc' -exec mv
{} $(DIST
)/bin \
;
313 .PHONY
: maybe_clobber_profiledbuild
315 # Look for R_386_PC32 relocations in shared libs, these
316 # break x86_64 builds and SELinux users.
317 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
319 @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
323 # Delegate js-specific rules to js
327 source-package
install:
330 # Every export rule depends on config/export, but the rule for config/export
331 # doesn't exist when building js non-standalone.
332 .PHONY
: config
/export
337 # There used to be build interdependencies here. They are now in config/recurse.mk