merge mozilla-aurora to b2g44_2_5 a=merge
[gecko.git] / Makefile.in
blob95395677181d8a4bdb238b4d8832d932d6ee48e2
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 ifdef MOZ_BUILD_APP
19 include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
20 endif
22 include $(topsrcdir)/config/config.mk
24 GARBAGE_DIRS += _javagen _profile staticlib
25 DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
26 config/autoconf.mk \
27 mozilla-config.h \
28 netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
29 .mozconfig.mk
31 ifdef JS_STANDALONE
32 configure_dir = $(topsrcdir)/js/src
33 else
34 configure_dir = $(topsrcdir)
35 endif
37 ifndef MOZ_PROFILE_USE
38 # We need to explicitly put backend.RecursiveMakeBackend here
39 # otherwise the rule in rules.mk doesn't run early enough.
40 $(TIERS) binaries:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
41 ifndef JS_STANDALONE
42 ifdef COMPILE_ENVIRONMENT
43 $(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
44 endif
45 endif
46 endif
48 ifdef JS_STANDALONE
49 .PHONY: CLOBBER
50 CLOBBER:
51 else
52 CLOBBER: $(topsrcdir)/CLOBBER
53 @echo 'STOP! The CLOBBER file has changed.'
54 @echo 'Please run the build through a sanctioned build wrapper, such as'
55 @echo '"mach build" or client.mk.'
56 @exit 1
57 endif
59 $(topsrcdir)/configure: $(topsrcdir)/configure.in
60 $(topsrcdir)/js/src/configure: $(topsrcdir)/js/src/configure.in
61 $(topsrcdir)/configure $(topsrcdir)/js/src/configure:
62 @echo 'STOP! $^ has changed, and your configure is out of date.'
63 @echo 'Please rerun autoconf and re-configure your build directory.'
64 @echo 'To ignore this message, touch "$@",'
65 @echo 'but your build might not succeed.'
66 @exit 1
68 config.status: $(configure_dir)/configure
69 js/src/config.status: $(topsrcdir)/js/src/configure
70 config.status js/src/config.status:
71 @echo 'STOP! $^ has changed and needs to be run again.'
72 @echo 'Please rerun it.'
73 @echo 'To ignore this message, touch "$(CURDIR)/$@",'
74 @echo 'but your build might not succeed.'
75 @exit 1
77 # Regenerate the build backend if it is out of date. We only have this rule in
78 # this main make file because having it in rules.mk and applied to partial tree
79 # builds resulted in a world of hurt. Gory details are in bug 877308.
81 # The mach build driver will ensure the backend is up to date for partial tree
82 # builds. This cleanly avoids most of the pain.
84 backend.RecursiveMakeBackend:
85 @echo 'Build configuration changed. Regenerating backend.'
86 $(PYTHON) config.status
88 Makefile: backend.RecursiveMakeBackend
89 @$(TOUCH) $@
91 include backend.RecursiveMakeBackend.pp
93 default:: backend.RecursiveMakeBackend
95 install_manifests := \
96 $(addprefix dist/,bin branding idl include public private sdk xpi-stage) \
97 _tests \
98 $(NULL)
99 install_manifest_depends = \
100 CLOBBER \
101 $(configure_dir)/configure \
102 config.status \
103 backend.RecursiveMakeBackend \
104 $(NULL)
106 ifndef JS_STANDALONE
107 ifdef COMPILE_ENVIRONMENT
108 install_manifest_depends += \
109 $(topsrcdir)/js/src/configure \
110 js/src/config.status \
111 $(NULL)
112 endif
113 endif
115 .PHONY: install-manifests
116 install-manifests: $(addprefix install-,$(install_manifests))
118 # process_install_manifest needs to be invoked with --no-remove when building
119 # js as standalone because automated builds are building nspr separately and
120 # that would remove the resulting files.
121 # Eventually, a standalone js build would just be able to build nspr itself,
122 # removing the need for the former.
123 ifdef JS_STANDALONE
124 NO_REMOVE=1
125 endif
127 .PHONY: $(addprefix install-,$(install_manifests))
128 $(addprefix install-,$(filter dist/%,$(install_manifests))): install-dist/%: $(install_manifest_depends)
129 $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$(DIST)/$* _build_manifests/install/dist_$*)
131 # Dummy wrapper rule to allow the faster backend to piggy back
132 install-dist_%: install-dist/% ;
134 install-_tests: $(install_manifest_depends)
135 $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )_tests _build_manifests/install/tests)
137 # For compatibility
138 .PHONY: install-tests
139 install-tests: install-_tests
141 include $(topsrcdir)/build/moz-automation.mk
143 # dist and _tests should be purged during cleaning. However, we don't want them
144 # purged during PGO builds because they contain some auto-generated files.
145 ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
146 GARBAGE_DIRS += dist _tests
147 endif
149 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
150 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
151 # process the install manifests as part of export.
152 # For the binaries rule, not all the install manifests matter, so force only
153 # the interesting ones to be done.
154 ifdef MOZ_PROFILE_USE
155 ifndef NO_PROFILE_GUIDED_OPTIMIZE
156 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
157 export:: install-manifests
158 binaries::
159 @$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include
160 endif
161 endif
162 else # !MOZ_PROFILE_USE (normal build)
163 export:: install-manifests
164 binaries::
165 @$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include
166 endif
168 # For historical reasons that are unknown, $(DIST)/sdk is always blown away
169 # with no regard for PGO passes. This decision could probably be revisited.
170 export:: install-dist/sdk
172 ifndef JS_STANDALONE
173 ifdef ENABLE_TESTS
174 # Additional makefile targets to call automated test suites
175 include $(topsrcdir)/testing/testsuite-targets.mk
176 endif
177 endif
179 default all::
180 $(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
182 include $(topsrcdir)/config/rules.mk
184 distclean::
185 $(RM) $(DIST_GARBAGE)
187 ifeq ($(OS_ARCH),WINNT)
188 # we want to copy PDB files on Windows
189 MAKE_SYM_STORE_ARGS := -c --vcs-info
190 ifdef PDBSTR_PATH
191 MAKE_SYM_STORE_ARGS += -i
192 endif
193 DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe
194 # PDB files don't get moved to dist, so we need to scan the whole objdir
195 MAKE_SYM_STORE_PATH := .
196 endif
197 ifeq ($(OS_ARCH),Darwin)
198 # need to pass arch flags for universal builds
199 ifdef UNIVERSAL_BINARY
200 MAKE_SYM_STORE_ARGS := -c -a 'i386 x86_64' --vcs-info
201 MAKE_SYM_STORE_PATH := $(DIST)/universal
202 else
203 MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
204 MAKE_SYM_STORE_PATH := $(DIST)/bin
205 endif
206 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
207 endif
208 ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
209 MAKE_SYM_STORE_ARGS := -c --vcs-info
210 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
211 MAKE_SYM_STORE_PATH := $(DIST)/bin
212 endif
213 MAKE_SYM_STORE_ARGS += --install-manifest=$(DEPTH)/_build_manifests/install/dist_include,$(DIST)/include
215 SYM_STORE_SOURCE_DIRS := $(topsrcdir)
217 ifndef JS_STANDALONE
218 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
220 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
221 EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
222 endif
224 SYMBOL_INDEX_NAME = \
225 $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt
227 buildsymbols:
228 ifdef MOZ_CRASHREPORTER
229 echo building symbol store
230 $(RM) -r $(DIST)/crashreporter-symbols
231 $(RM) '$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip'
232 $(RM) '$(DIST)/$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
233 $(NSINSTALL) -D $(DIST)/crashreporter-symbols
234 OBJCOPY='$(OBJCOPY)' \
235 $(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
236 $(MAKE_SYM_STORE_ARGS) \
237 $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir)) \
238 $(DUMP_SYMS_BIN) \
239 $(DIST)/crashreporter-symbols \
240 $(MAKE_SYM_STORE_PATH) | grep -iv test > \
241 $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
242 echo packing symbols
243 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
244 cd $(DIST)/crashreporter-symbols && \
245 zip -r9D '../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' . -x '*test*' -x '*Test*'
246 cd $(DIST)/crashreporter-symbols && \
247 grep 'sym' $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
248 mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
249 cd $(DIST)/crashreporter-symbols && \
250 zip -r9D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt' -x '*test*' -x '*Test*'
251 endif # MOZ_CRASHREPORTER
253 uploadsymbols:
254 ifdef MOZ_CRASHREPORTER
255 ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE
256 $(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
257 else
258 $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
259 endif
260 endif
262 # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
263 # exporting it makes make run its $(shell) command for each invoked submake,
264 # so transform it to an immediate assignment.
265 MOZ_SOURCE_STAMP := $(MOZ_SOURCE_STAMP)
266 export MOZ_SOURCE_STAMP
267 endif
269 .PHONY: update-packaging
270 update-packaging:
271 $(MAKE) -C tools/update-packaging
273 .PHONY: pretty-package
274 pretty-package:
275 unset MOZ_SIGN_CMD && $(MAKE) package MOZ_PKG_PRETTYNAMES=1
277 .PHONY: pretty-package-tests
278 pretty-package-tests:
279 unset MOZ_SIGN_CMD && $(MAKE) package-tests MOZ_PKG_PRETTYNAMES=1
281 .PHONY: pretty-l10n-check
282 pretty-l10n-check:
283 unset MOZ_SIGN_CMD && $(MAKE) l10n-check MOZ_PKG_PRETTYNAMES=1
285 .PHONY: pretty-update-packaging
286 pretty-update-packaging:
287 unset MOZ_SIGN_CMD && $(MAKE) -C tools/update-packaging MOZ_PKG_PRETTYNAMES=1
289 .PHONY: pretty-installer
290 pretty-installer:
291 unset MOZ_SIGN_CMD && $(MAKE) installer MOZ_PKG_PRETTYNAMES=1
293 #XXX: this is a hack, since we don't want to clobber for MSVC
294 # PGO support, but we can't do this test in client.mk
295 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
296 # No point in clobbering if PGO has been explicitly disabled.
297 ifndef NO_PROFILE_GUIDED_OPTIMIZE
298 maybe_clobber_profiledbuild: clean
299 else
300 maybe_clobber_profiledbuild:
301 endif
302 else
303 maybe_clobber_profiledbuild:
304 $(RM) $(DIST)/bin/*.pgc
305 find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
306 endif
308 .PHONY: maybe_clobber_profiledbuild
310 # Look for R_386_PC32 relocations in shared libs, these
311 # break x86_64 builds and SELinux users.
312 ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
313 check::
314 @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
315 endif
317 ifdef JS_STANDALONE
318 # Delegate js-specific rules to js
319 check-%:
320 $(MAKE) -C js/src $@
322 source-package install:
323 $(MAKE) -C js/src $@
325 # Every export rule depends on config/export, but the rule for config/export
326 # doesn't exist when building js non-standalone.
327 .PHONY: config/export
328 config/export:
330 endif
332 # There used to be build interdependencies here. They are now in config/recurse.mk