Backout a74bd5095902, Bug 959405 - Please update the Buri Moz-central, 1.3, 1.2 with...
[gecko.git] / Makefile.in
blobae4e161a856fddd271de7c4a8e66508da6d0262f
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 ifndef .PYMAKE
7 ifeq (,$(MAKE_VERSION))
8 $(error GNU Make is required)
9 endif
10 make_min_ver := 3.81
11 ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
12 $(error GNU Make $(make_min_ver) or higher is required)
13 endif
14 endif
16 export TOPLEVEL_BUILD := 1
18 default::
20 ifdef MOZ_BUILD_APP
21 include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
22 endif
24 include $(topsrcdir)/config/config.mk
26 ifndef LIBXUL_SDK
27 ifdef COMPILE_ENVIRONMENT
28 ifndef BUILDING_JS
29 BUILD_JS = 1
30 endif
31 endif
32 endif
34 GARBAGE_DIRS += dist _javagen _profile staticlib
35 DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
36 config/autoconf.mk \
37 mozilla-config.h \
38 netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
39 .mozconfig.mk
41 ifdef BUILDING_JS
42 configure_dir = $(topsrcdir)/js/src
43 else
44 configure_dir = $(topsrcdir)
45 endif
47 ifndef MOZ_PROFILE_USE
48 # We need to explicitly put backend.RecursiveMakeBackend here
49 # otherwise the rule in rules.mk doesn't run early enough.
50 libs binaries export tools:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
51 ifdef BUILD_JS
52 libs binaries export tools:: js-config-status
53 endif
54 endif
56 ifdef BUILDING_JS
57 .PHONY: CLOBBER
58 CLOBBER:
59 else
60 CLOBBER: $(topsrcdir)/CLOBBER
61 @echo 'STOP! The CLOBBER file has changed.'
62 @echo 'Please run the build through a sanctioned build wrapper, such as'
63 @echo '"mach build" or client.mk.'
64 @exit 1
65 endif
67 $(configure_dir)/configure: $(configure_dir)/configure.in
68 @echo 'STOP! configure.in has changed, and your configure is out of date.'
69 @echo 'Please rerun autoconf and re-configure your build directory.'
70 @echo 'To ignore this message, touch "configure" in the source directory,'
71 @echo 'but your build might not succeed.'
72 @exit 1
74 config.status: $(configure_dir)/configure
75 @echo 'STOP! configure has changed and needs to be run in this build directory.'
76 @echo 'Please rerun configure.'
77 @echo 'To ignore this message, touch "config.status" in the build directory,'
78 @echo 'but your build might not succeed.'
79 @exit 1
81 # Regenerate the build backend if it is out of date. We only have this rule in
82 # this main make file because having it in rules.mk and applied to partial tree
83 # builds resulted in a world of hurt. Gory details are in bug 877308.
85 # The mach build driver will ensure the backend is up to date for partial tree
86 # builds. This cleanly avoids most of the pain.
88 backend.RecursiveMakeBackend:
89 @echo 'Build configuration changed. Regenerating backend.'
90 $(PYTHON) config.status
92 Makefile: backend.RecursiveMakeBackend
93 @$(TOUCH) $@
95 include backend.RecursiveMakeBackend.pp
97 default:: backend.RecursiveMakeBackend
99 ifdef BUILD_JS
100 .PHONY: js-config-status
101 js-config-status:
102 $(call SUBMAKE,backend.RecursiveMakeBackend,js/src,1)
103 endif
105 install_manifests := bin idl include public private sdk
106 install_manifest_depends = \
107 CLOBBER \
108 $(configure_dir)/configure \
109 config.status \
110 backend.RecursiveMakeBackend \
111 $(NULL)
113 ifdef BUILD_JS
114 install_manifest_depends += js-config-status
115 endif
117 .PHONY: install-manifests
118 install-manifests: $(addprefix install-dist-,$(install_manifests))
120 # process_install_manifest needs to be invoked with --no-remove when building
121 # js as standalone because automated builds are building nspr separately and
122 # that would remove the resulting files. It is also necessary when building
123 # js as part of gecko because that would remove the files exported from gecko.
124 # Eventually, a standalone js build would just be able to build nspr itself,
125 # removing the need for the former. But that won't likely happen before
126 # finishing to merge gecko and js build systems, removing the need for the
127 # latter.
128 ifdef BUILDING_JS
129 NO_REMOVE=1
130 endif
132 .PHONY: $(addprefix install-dist-,$(install_manifests))
133 $(addprefix install-dist-,$(install_manifests)): install-dist-%: $(install_manifest_depends)
134 $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$(DIST)/$* _build_manifests/install/dist_$* $(if $(BUILD_JS),js/src/_build_manifests/install/dist_$*))
136 .PHONY: install-tests
137 install-manifests: install-tests
138 install-tests: $(install_manifest_depends)
139 $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )_tests _build_manifests/install/tests $(if $(BUILD_JS),js/src/_build_manifests/install/tests))
142 # _tests should be purged during cleaning. However, we don't want it purged
143 # during PGO builds because it contains some auto-generated files.
144 ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
145 GARBAGE_DIRS += _tests
146 endif
148 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
149 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
150 # process the install manifests as part of export.
151 ifdef MOZ_PROFILE_USE
152 ifndef NO_PROFILE_GUIDED_OPTIMIZE
153 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
154 export:: install-manifests
155 binaries::
156 @$(MAKE) install-manifests NO_REMOVE=1
157 endif
158 endif
159 else # !MOZ_PROFILE_USE (normal build)
160 export:: install-manifests
161 binaries::
162 @$(MAKE) install-manifests NO_REMOVE=1
163 endif
165 # For historical reasons that are unknown, $(DIST)/sdk is always blown away
166 # with no regard for PGO passes. This decision could probably be revisited.
167 export:: install-dist-sdk
169 ifndef BUILDING_JS
170 ifdef ENABLE_TESTS
171 # Additional makefile targets to call automated test suites
172 include $(topsrcdir)/testing/testsuite-targets.mk
173 endif
174 endif
176 default all::
177 $(call BUILDSTATUS,TIERS export $(if $(COMPILE_ENVIRONMENT),$(if $(MOZ_PSEUDO_DERECURSE),compile ))libs tools)
179 include $(topsrcdir)/config/rules.mk
181 distclean::
182 $(RM) $(DIST_GARBAGE)
184 ifeq ($(OS_ARCH),WINNT)
185 # we want to copy PDB files on Windows
186 MAKE_SYM_STORE_ARGS := -c --vcs-info
187 ifdef PDBSTR_PATH
188 MAKE_SYM_STORE_ARGS += -i
189 endif
190 DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe
191 # PDB files don't get moved to dist, so we need to scan the whole objdir
192 MAKE_SYM_STORE_PATH := .
193 endif
194 ifeq ($(OS_ARCH),Darwin)
195 # need to pass arch flags for universal builds
196 ifdef UNIVERSAL_BINARY
197 MAKE_SYM_STORE_ARGS := -c -a 'i386 x86_64' --vcs-info
198 MAKE_SYM_STORE_PATH := $(DIST)/universal
199 else
200 MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
201 MAKE_SYM_STORE_PATH := $(DIST)/bin
202 endif
203 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
204 endif
205 ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
206 MAKE_SYM_STORE_ARGS := -c --vcs-info
207 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
208 MAKE_SYM_STORE_PATH := $(DIST)/bin
209 endif
211 SYM_STORE_SOURCE_DIRS := $(topsrcdir)
213 ifndef BUILDING_JS
214 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
216 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
217 EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
218 endif
220 SYMBOL_INDEX_NAME = \
221 $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt
223 buildsymbols:
224 ifdef MOZ_CRASHREPORTER
225 echo building symbol store
226 $(RM) -r $(DIST)/crashreporter-symbols
227 $(RM) '$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip'
228 $(NSINSTALL) -D $(DIST)/crashreporter-symbols
229 OBJCOPY='$(OBJCOPY)' \
230 $(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
231 $(MAKE_SYM_STORE_ARGS) \
232 $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir)) \
233 $(DUMP_SYMS_BIN) \
234 $(DIST)/crashreporter-symbols \
235 $(MAKE_SYM_STORE_PATH) | grep -iv test > \
236 $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
237 echo packing symbols
238 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
239 cd $(DIST)/crashreporter-symbols && \
240 zip -r9D '../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' . -x '*test*' -x '*Test*'
241 cd $(DIST)/crashreporter-symbols && \
242 grep 'sym' $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
243 mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
244 cd $(DIST)/crashreporter-symbols && \
245 zip -r9D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt' -x '*test*' -x '*Test*'
246 endif # MOZ_CRASHREPORTER
248 uploadsymbols:
249 ifdef MOZ_CRASHREPORTER
250 $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
251 endif
253 # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
254 # exporting it makes make run its $(shell) command for each invoked submake,
255 # so transform it to an immediate assignment.
256 MOZ_SOURCE_STAMP := $(MOZ_SOURCE_STAMP)
257 export MOZ_SOURCE_STAMP
258 endif
260 #XXX: this is a hack, since we don't want to clobber for MSVC
261 # PGO support, but we can't do this test in client.mk
262 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
263 # No point in clobbering if PGO has been explicitly disabled.
264 ifndef NO_PROFILE_GUIDED_OPTIMIZE
265 maybe_clobber_profiledbuild: clean
266 else
267 maybe_clobber_profiledbuild:
268 endif
269 else
270 maybe_clobber_profiledbuild:
271 $(RM) $(DIST)/bin/*.pgc
272 find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
273 endif
275 .PHONY: maybe_clobber_profiledbuild
277 # Look for R_386_PC32 relocations in shared libs, these
278 # break x86_64 builds and SELinux users.
279 ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
280 check::
281 @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
282 endif
284 ifdef BUILDING_JS
285 # Delegate js-specific rules to js
286 check-%:
287 $(MAKE) -C js/src $@
289 source-package install:
290 $(MAKE) -C js/src $@
292 # Every export rule depends on config/export, but the rule for config/export
293 # doesn't exist when building js non-standalone.
294 .PHONY: config/export
295 config/export:
297 else
299 ifdef BUILD_JS
300 js/src/Makefile: subsrcdir := js/src
302 ifdef MOZ_PSEUDO_DERECURSE
303 # Interdependencies for parallel export.
304 js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
305 accessible/src/xpcom/export: xpcom/xpidl/export
306 js/src/export: mfbt/export
307 ifdef ENABLE_CLANG_PLUGIN
308 js/src/export config/export: build/clang-plugin/export
309 endif
310 endif
311 endif
312 endif