Backed out changeset 58dbd2146e24 (bug 944961) for bustage.
[gecko.git] / Makefile.in
blob731209a184e750af2519df3b29bdc7c94a9b3205
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 include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
22 include $(topsrcdir)/config/config.mk
24 ifndef LIBXUL_SDK
25 ifdef COMPILE_ENVIRONMENT
26 BUILD_JS = 1
27 endif
28 endif
30 GARBAGE_DIRS += dist _javagen _profile staticlib
31 DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
32 config/autoconf.mk \
33 mozilla-config.h \
34 netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
35 .mozconfig.mk
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 $(topsrcdir)/configure config.status backend.RecursiveMakeBackend
41 ifdef BUILD_JS
42 libs binaries export tools:: js-config-status
43 endif
44 endif
46 CLOBBER: $(topsrcdir)/CLOBBER
47 @echo 'STOP! The CLOBBER file has changed.'
48 @echo 'Please run the build through a sanctioned build wrapper, such as'
49 @echo '"mach build" or client.mk.'
50 @exit 1
52 $(topsrcdir)/configure: $(topsrcdir)/configure.in
53 @echo 'STOP! configure.in has changed, and your configure is out of date.'
54 @echo 'Please rerun autoconf and re-configure your build directory.'
55 @echo 'To ignore this message, touch "configure" in the source directory,'
56 @echo 'but your build might not succeed.'
57 @exit 1
59 config.status: $(topsrcdir)/configure
60 @echo 'STOP! configure has changed and needs to be run in this build directory.'
61 @echo 'Please rerun configure.'
62 @echo 'To ignore this message, touch "config.status" in the build directory,'
63 @echo 'but your build might not succeed.'
64 @exit 1
66 # Regenerate the build backend if it is out of date. We only have this rule in
67 # this main make file because having it in rules.mk and applied to partial tree
68 # builds resulted in a world of hurt. Gory details are in bug 877308.
70 # The mach build driver will ensure the backend is up to date for partial tree
71 # builds. This cleanly avoids most of the pain.
73 backend.RecursiveMakeBackend:
74 @echo 'Build configuration changed. Regenerating backend.'
75 $(PYTHON) config.status
77 Makefile: backend.RecursiveMakeBackend
78 @$(TOUCH) $@
80 include backend.RecursiveMakeBackend.pp
82 default:: backend.RecursiveMakeBackend
84 ifdef BUILD_JS
85 .PHONY: js-config-status
86 js-config-status:
87 $(call SUBMAKE,backend.RecursiveMakeBackend,js/src,1)
88 endif
90 install_manifests := bin idl include public private sdk
91 install_manifest_depends = \
92 CLOBBER \
93 $(topsrcdir)/configure \
94 config.status \
95 backend.RecursiveMakeBackend \
96 $(NULL)
98 ifdef BUILD_JS
99 install_manifest_depends += js-config-status
100 endif
102 .PHONY: install-manifests
103 install-manifests: $(addprefix install-dist-,$(install_manifests))
105 .PHONY: $(addprefix install-dist-,$(install_manifests))
106 $(addprefix install-dist-,$(install_manifests)): install-dist-%: $(install_manifest_depends)
107 $(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_$*))
109 .PHONY: install-tests
110 install-manifests: install-tests
111 install-tests: $(install_manifest_depends)
112 $(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))
115 # _tests should be purged during cleaning. However, we don't want it purged
116 # during PGO builds because it contains some auto-generated files.
117 ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
118 GARBAGE_DIRS += _tests
119 endif
121 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
122 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
123 # process the install manifests as part of export.
124 ifdef MOZ_PROFILE_USE
125 ifndef NO_PROFILE_GUIDED_OPTIMIZE
126 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
127 export:: install-manifests
128 binaries::
129 @$(MAKE) install-manifests NO_REMOVE=1
130 endif
131 endif
132 else # !MOZ_PROFILE_USE (normal build)
133 export:: install-manifests
134 binaries::
135 @$(MAKE) install-manifests NO_REMOVE=1
136 endif
138 # For historical reasons that are unknown, $(DIST)/sdk is always blown away
139 # with no regard for PGO passes. This decision could probably be revisited.
140 export:: install-dist-sdk
142 ifdef ENABLE_TESTS
143 # Additional makefile targets to call automated test suites
144 include $(topsrcdir)/testing/testsuite-targets.mk
145 endif
147 default all::
148 $(call BUILDSTATUS,TIERS export $(if $(COMPILE_ENVIRONMENT),$(if $(MOZ_PSEUDO_DERECURSE),compile ))libs tools)
150 include $(topsrcdir)/config/rules.mk
152 distclean::
153 $(RM) $(DIST_GARBAGE)
155 ifeq ($(OS_ARCH),WINNT)
156 # we want to copy PDB files on Windows
157 MAKE_SYM_STORE_ARGS := -c --vcs-info
158 ifdef PDBSTR_PATH
159 MAKE_SYM_STORE_ARGS += -i
160 endif
161 DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe
162 # PDB files don't get moved to dist, so we need to scan the whole objdir
163 MAKE_SYM_STORE_PATH := .
164 endif
165 ifeq ($(OS_ARCH),Darwin)
166 # need to pass arch flags for universal builds
167 ifdef UNIVERSAL_BINARY
168 MAKE_SYM_STORE_ARGS := -c -a 'i386 x86_64' --vcs-info
169 MAKE_SYM_STORE_PATH := $(DIST)/universal
170 else
171 MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
172 MAKE_SYM_STORE_PATH := $(DIST)/bin
173 endif
174 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
175 endif
176 ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
177 MAKE_SYM_STORE_ARGS := -c --vcs-info
178 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
179 MAKE_SYM_STORE_PATH := $(DIST)/bin
180 endif
182 SYM_STORE_SOURCE_DIRS := $(topsrcdir)
184 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
186 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
187 EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
188 endif
190 SYMBOL_INDEX_NAME = \
191 $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt
193 buildsymbols:
194 ifdef MOZ_CRASHREPORTER
195 echo building symbol store
196 $(RM) -r $(DIST)/crashreporter-symbols
197 $(RM) '$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip'
198 $(NSINSTALL) -D $(DIST)/crashreporter-symbols
199 OBJCOPY='$(OBJCOPY)' \
200 $(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
201 $(MAKE_SYM_STORE_ARGS) \
202 $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir)) \
203 $(DUMP_SYMS_BIN) \
204 $(DIST)/crashreporter-symbols \
205 $(MAKE_SYM_STORE_PATH) | grep -iv test > \
206 $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
207 echo packing symbols
208 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
209 cd $(DIST)/crashreporter-symbols && \
210 zip -r9D '../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' . -x '*test*' -x '*Test*'
211 cd $(DIST)/crashreporter-symbols && \
212 grep 'sym' $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
213 mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
214 cd $(DIST)/crashreporter-symbols && \
215 zip -r9D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt' -x '*test*' -x '*Test*'
216 endif # MOZ_CRASHREPORTER
218 uploadsymbols:
219 ifdef MOZ_CRASHREPORTER
220 $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
221 endif
223 # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
224 # exporting it makes make run its $(shell) command for each invoked submake,
225 # so transform it to an immediate assignment.
226 MOZ_SOURCE_STAMP := $(MOZ_SOURCE_STAMP)
227 export MOZ_SOURCE_STAMP
229 #XXX: this is a hack, since we don't want to clobber for MSVC
230 # PGO support, but we can't do this test in client.mk
231 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
232 # No point in clobbering if PGO has been explicitly disabled.
233 ifndef NO_PROFILE_GUIDED_OPTIMIZE
234 maybe_clobber_profiledbuild: clean
235 else
236 maybe_clobber_profiledbuild:
237 endif
238 else
239 maybe_clobber_profiledbuild:
240 $(RM) $(DIST)/bin/*.pgc
241 find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
242 endif
244 .PHONY: maybe_clobber_profiledbuild
246 # Look for R_386_PC32 relocations in shared libs, these
247 # break x86_64 builds and SELinux users.
248 ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
249 check::
250 @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
251 endif
253 ifdef BUILD_JS
254 js/src/Makefile: subsrcdir := js/src
256 ifdef MOZ_PSEUDO_DERECURSE
257 # Interdependencies for parallel export.
258 js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
259 accessible/src/xpcom/export: xpcom/xpidl/export
260 js/src/export: mfbt/export
261 ifdef ENABLE_CLANG_PLUGIN
262 js/src/export config/export: build/clang-plugin/export
263 endif
264 endif
265 endif