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