Bug 1368920. Part 4 - Enable Report Site Issue button for DevEdition and Nightly...
[gecko.git] / Makefile.in
blobce798c497e88284d01a3774ad2a05f0cdfbe8e5b
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)
8 endif
9 make_min_ver := 3.81
10 ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
11 $(error GNU Make $(make_min_ver) or higher is required)
12 endif
14 export TOPLEVEL_BUILD := 1
16 default::
18 ifndef TEST_MOZBUILD
19 ifdef MOZ_BUILD_APP
20 include $(wildcard $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk)
21 endif
22 endif
24 include $(topsrcdir)/config/config.mk
26 GARBAGE_DIRS += _javagen _profile staticlib
27 DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
28 config/autoconf.mk \
29 mozilla-config.h \
30 netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
31 .mozconfig.mk
33 ifndef MOZ_PROFILE_USE
34 buildid.h source-repo.h: FORCE
35 endif
37 ifdef JS_STANDALONE
38 configure_dir = $(topsrcdir)/js/src
39 else
40 configure_dir = $(topsrcdir)
41 endif
43 BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS)))
45 ifndef TEST_MOZBUILD
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)
50 ifndef JS_STANDALONE
51 ifdef COMPILE_ENVIRONMENT
52 $(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
53 endif
54 endif
55 endif
56 endif
58 ifdef JS_STANDALONE
59 .PHONY: CLOBBER
60 CLOBBER:
61 else
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.'
66 @exit 1
67 endif
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.'
76 @exit 1
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.'
85 @exit 1
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.
94 ifndef TEST_MOZBUILD
96 .PHONY: backend
97 backend: $(BUILD_BACKEND_FILES)
99 include $(topsrcdir)/build/rebuild-backend.mk
101 Makefile: $(BUILD_BACKEND_FILES)
102 @$(TOUCH) $@
104 default:: $(BUILD_BACKEND_FILES)
105 endif
107 install_manifests := \
108 $(addprefix dist/,branding idl include public private sdk xpi-stage) \
109 _tests \
110 $(NULL)
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
117 endif
118 install_manifest_depends = \
119 CLOBBER \
120 $(configure_dir)/configure \
121 config.status \
122 $(BUILD_BACKEND_FILES) \
123 $(NULL)
125 ifndef JS_STANDALONE
126 ifdef COMPILE_ENVIRONMENT
127 install_manifest_depends += \
128 $(topsrcdir)/js/src/configure \
129 js/src/config.status \
130 $(NULL)
131 endif
132 endif
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
143 .PHONY: faster
144 faster: install-dist/idl
145 $(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
146 endif
148 .PHONY: tup
149 tup:
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.
163 ifdef JS_STANDALONE
164 NO_REMOVE=1
165 endif
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
171 endif
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 $*)))
180 endif
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
191 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
200 endif
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
211 binaries::
212 @$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include
213 endif
214 endif
215 else # !MOZ_PROFILE_USE (normal build)
216 recurse_pre-export:: install-manifests
217 binaries::
218 @$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include
219 endif
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
225 recurse_artifact:
226 $(topsrcdir)/mach --log-no-times artifact install
228 ifndef JS_STANDALONE
229 ifdef ENABLE_TESTS
230 # Additional makefile targets to call automated test suites
231 include $(topsrcdir)/testing/testsuite-targets.mk
232 endif
233 endif
235 default all::
236 $(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
238 include $(topsrcdir)/config/rules.mk
240 ifdef SCCACHE_VERBOSE_STATS
241 default::
242 -$(CCACHE) --show-stats --stats-format=json > sccache-stats.json
243 @echo "===SCCACHE STATS==="
244 -$(CCACHE) --show-stats
245 @echo "==================="
246 endif
248 distclean::
249 $(RM) $(DIST_GARBAGE)
251 ifdef MOZ_CRASHREPORTER
252 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
254 endif
256 .PHONY: prepsymbolsarchive
257 prepsymbolsarchive:
258 echo packing symbols
259 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
261 ifndef MOZ_AUTOMATION
262 prepsymbolsarchive: recurse_syms
263 endif
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) \
270 --exclude '*test*' \
271 --exclude '*Test*' \
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
283 else
284 buildsymbols:
285 endif
287 uploadsymbols:
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'
291 endif
292 endif
294 .PHONY: update-packaging
295 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
304 else
305 maybe_clobber_profiledbuild:
306 endif
307 else
308 maybe_clobber_profiledbuild:
309 $(RM) $(DIST)/bin/*.pgc
310 find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
311 endif
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)
318 check::
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
320 endif
322 ifdef JS_STANDALONE
323 # Delegate js-specific rules to js
324 check-%:
325 $(MAKE) -C js/src $@
327 source-package install:
328 $(MAKE) -C js/src $@
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
333 config/export:
335 endif
337 # There used to be build interdependencies here. They are now in config/recurse.mk