Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / Makefile.in
blobb72fcf6e8cb7c9215b9f4e88c991e8c64c3caf24
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 += dist _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 libs binaries export tools:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
41 ifndef JS_STANDALONE
42 ifndef LIBXUL_SDK
43 libs binaries export tools:: $(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 := bin idl include public private sdk
96 install_manifest_depends = \
97 CLOBBER \
98 $(configure_dir)/configure \
99 config.status \
100 backend.RecursiveMakeBackend \
101 $(NULL)
103 ifndef JS_STANDALONE
104 ifndef LIBXUL_SDK
105 install_manifest_depends += \
106 $(topsrcdir)/js/src/configure \
107 js/src/config.status \
108 $(NULL)
109 endif
110 endif
112 .PHONY: install-manifests
113 install-manifests: $(addprefix install-dist-,$(install_manifests))
115 # process_install_manifest needs to be invoked with --no-remove when building
116 # js as standalone because automated builds are building nspr separately and
117 # that would remove the resulting files.
118 # Eventually, a standalone js build would just be able to build nspr itself,
119 # removing the need for the former.
120 ifdef JS_STANDALONE
121 NO_REMOVE=1
122 endif
124 .PHONY: $(addprefix install-dist-,$(install_manifests))
125 $(addprefix install-dist-,$(install_manifests)): install-dist-%: $(install_manifest_depends)
126 $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$(DIST)/$* _build_manifests/install/dist_$*)
128 .PHONY: install-tests
129 install-manifests: install-tests
130 install-tests: $(install_manifest_depends)
131 $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )_tests _build_manifests/install/tests)
133 include $(topsrcdir)/build/moz-automation.mk
135 # _tests should be purged during cleaning. However, we don't want it purged
136 # during PGO builds because it contains some auto-generated files.
137 ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
138 GARBAGE_DIRS += _tests
139 endif
141 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
142 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
143 # process the install manifests as part of export.
144 ifdef MOZ_PROFILE_USE
145 ifndef NO_PROFILE_GUIDED_OPTIMIZE
146 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
147 export:: install-manifests
148 binaries::
149 @$(MAKE) install-manifests NO_REMOVE=1
150 endif
151 endif
152 else # !MOZ_PROFILE_USE (normal build)
153 export:: install-manifests
154 binaries::
155 @$(MAKE) install-manifests NO_REMOVE=1
156 endif
158 # For historical reasons that are unknown, $(DIST)/sdk is always blown away
159 # with no regard for PGO passes. This decision could probably be revisited.
160 export:: install-dist-sdk
162 ifndef JS_STANDALONE
163 ifdef ENABLE_TESTS
164 # Additional makefile targets to call automated test suites
165 include $(topsrcdir)/testing/testsuite-targets.mk
166 endif
167 endif
169 default all::
170 $(call BUILDSTATUS,TIERS export $(if $(COMPILE_ENVIRONMENT),compile )libs tools $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
172 include $(topsrcdir)/config/rules.mk
174 distclean::
175 $(RM) $(DIST_GARBAGE)
177 ifeq ($(OS_ARCH),WINNT)
178 # we want to copy PDB files on Windows
179 MAKE_SYM_STORE_ARGS := -c --vcs-info
180 ifdef PDBSTR_PATH
181 MAKE_SYM_STORE_ARGS += -i
182 endif
183 DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe
184 # PDB files don't get moved to dist, so we need to scan the whole objdir
185 MAKE_SYM_STORE_PATH := .
186 endif
187 ifeq ($(OS_ARCH),Darwin)
188 # need to pass arch flags for universal builds
189 ifdef UNIVERSAL_BINARY
190 MAKE_SYM_STORE_ARGS := -c -a 'i386 x86_64' --vcs-info
191 MAKE_SYM_STORE_PATH := $(DIST)/universal
192 else
193 MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
194 MAKE_SYM_STORE_PATH := $(DIST)/bin
195 endif
196 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
197 endif
198 ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
199 MAKE_SYM_STORE_ARGS := -c --vcs-info
200 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
201 MAKE_SYM_STORE_PATH := $(DIST)/bin
202 endif
203 MAKE_SYM_STORE_ARGS += --install-manifest=$(DEPTH)/_build_manifests/install/dist_include,$(DIST)/include
205 SYM_STORE_SOURCE_DIRS := $(topsrcdir)
207 ifndef JS_STANDALONE
208 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
210 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
211 EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
212 endif
214 SYMBOL_INDEX_NAME = \
215 $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt
217 buildsymbols:
218 ifdef MOZ_CRASHREPORTER
219 echo building symbol store
220 $(RM) -r $(DIST)/crashreporter-symbols
221 $(RM) '$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip'
222 $(RM) '$(DIST)/$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
223 $(NSINSTALL) -D $(DIST)/crashreporter-symbols
224 OBJCOPY='$(OBJCOPY)' \
225 $(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
226 $(MAKE_SYM_STORE_ARGS) \
227 $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir)) \
228 $(DUMP_SYMS_BIN) \
229 $(DIST)/crashreporter-symbols \
230 $(MAKE_SYM_STORE_PATH) | grep -iv test > \
231 $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
232 echo packing symbols
233 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
234 cd $(DIST)/crashreporter-symbols && \
235 zip -r9D '../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' . -x '*test*' -x '*Test*'
236 cd $(DIST)/crashreporter-symbols && \
237 grep 'sym' $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
238 mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
239 cd $(DIST)/crashreporter-symbols && \
240 zip -r9D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt' -x '*test*' -x '*Test*'
241 endif # MOZ_CRASHREPORTER
243 uploadsymbols:
244 ifdef MOZ_CRASHREPORTER
245 ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE
246 $(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
247 else
248 $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
249 endif
250 endif
252 # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
253 # exporting it makes make run its $(shell) command for each invoked submake,
254 # so transform it to an immediate assignment.
255 MOZ_SOURCE_STAMP := $(MOZ_SOURCE_STAMP)
256 export MOZ_SOURCE_STAMP
257 endif
259 .PHONY: update-packaging
260 update-packaging:
261 $(MAKE) -C tools/update-packaging
263 .PHONY: pretty-package
264 pretty-package:
265 unset MOZ_SIGN_CMD && $(MAKE) package MOZ_PKG_PRETTYNAMES=1
267 .PHONY: pretty-package-tests
268 pretty-package-tests:
269 unset MOZ_SIGN_CMD && $(MAKE) package-tests MOZ_PKG_PRETTYNAMES=1
271 .PHONY: pretty-l10n-check
272 pretty-l10n-check:
273 unset MOZ_SIGN_CMD && $(MAKE) l10n-check MOZ_PKG_PRETTYNAMES=1
275 .PHONY: pretty-update-packaging
276 pretty-update-packaging:
277 unset MOZ_SIGN_CMD && $(MAKE) -C tools/update-packaging MOZ_PKG_PRETTYNAMES=1
279 .PHONY: pretty-installer
280 pretty-installer:
281 unset MOZ_SIGN_CMD && $(MAKE) installer MOZ_PKG_PRETTYNAMES=1
283 #XXX: this is a hack, since we don't want to clobber for MSVC
284 # PGO support, but we can't do this test in client.mk
285 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
286 # No point in clobbering if PGO has been explicitly disabled.
287 ifndef NO_PROFILE_GUIDED_OPTIMIZE
288 maybe_clobber_profiledbuild: clean
289 else
290 maybe_clobber_profiledbuild:
291 endif
292 else
293 maybe_clobber_profiledbuild:
294 $(RM) $(DIST)/bin/*.pgc
295 find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
296 endif
298 .PHONY: maybe_clobber_profiledbuild
300 # Look for R_386_PC32 relocations in shared libs, these
301 # break x86_64 builds and SELinux users.
302 ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
303 check::
304 @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
305 endif
307 ifdef JS_STANDALONE
308 # Delegate js-specific rules to js
309 check-%:
310 $(MAKE) -C js/src $@
312 source-package install:
313 $(MAKE) -C js/src $@
315 # Every export rule depends on config/export, but the rule for config/export
316 # doesn't exist when building js non-standalone.
317 .PHONY: config/export
318 config/export:
320 endif
322 # Interdependencies for parallel export.
323 js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
324 accessible/xpcom/export: xpcom/xpidl/export
326 # The widget binding generator code is part of the annotationProcessors.
327 widget/android/bindings/export: build/annotationProcessors/export
329 ifdef ENABLE_CLANG_PLUGIN
330 js/src/export config/host: build/clang-plugin/export
331 endif
333 # Interdependencies that moz.build world don't know about yet for compilation.
334 # Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
335 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
336 toolkit/library/target: widget/gtk/mozgtk/gtk3/target
337 endif
338 ifdef MOZ_LDAP_XPCOM
339 ldap/target: config/external/nss/target mozglue/build/target
340 toolkit/library/target: ldap/target
341 endif
342 ifndef MOZ_FOLD_LIBS
343 ifndef MOZ_NATIVE_SQLITE
344 config/external/nss/target: db/sqlite3/src/target
345 endif
346 endif
347 ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
348 mozglue/build/target: memory/replace/dummy/target
349 endif