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