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/.
7 ifeq (,$(MAKE_VERSION
))
8 $(error GNU Make is required
)
11 ifneq ($(make_min_ver
),$(firstword $(sort $(make_min_ver
) $(MAKE_VERSION
))))
12 $(error GNU Make
$(make_min_ver
) or higher is required
)
16 export TOPLEVEL_BUILD
:= 1
21 include $(topsrcdir
)/$(MOZ_BUILD_APP
)/build.mk
24 include $(topsrcdir
)/config
/config.mk
27 ifdef COMPILE_ENVIRONMENT
34 GARBAGE_DIRS
+= dist _javagen _profile staticlib
35 DIST_GARBAGE
= config.cache config.log config.status
* config-defs.h \
38 netwerk
/necko-config.h xpcom
/xpcom-config.h xpcom
/xpcom-private.h \
42 configure_dir
= $(topsrcdir
)/js
/src
44 configure_dir
= $(topsrcdir
)
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
52 libs binaries
export tools
:: js-config-status
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.'
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.'
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.'
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
95 include backend.RecursiveMakeBackend.pp
97 default
:: backend.RecursiveMakeBackend
100 .PHONY
: js-config-status
102 $(call SUBMAKE
,backend.RecursiveMakeBackend
,js
/src
,1)
105 install_manifests
:= bin idl
include public private sdk
106 install_manifest_depends
= \
108 $(configure_dir
)/configure \
110 backend.RecursiveMakeBackend \
114 install_manifest_depends
+= js-config-status
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
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
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
156 @
$(MAKE
) install-manifests NO_REMOVE
=1
159 else # !MOZ_PROFILE_USE (normal build)
160 export:: install-manifests
162 @
$(MAKE
) install-manifests NO_REMOVE
=1
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
171 # Additional makefile targets to call automated test suites
172 include $(topsrcdir
)/testing
/testsuite-targets.mk
177 $(call BUILDSTATUS
,TIERS
export $(if
$(COMPILE_ENVIRONMENT
),$(if
$(MOZ_PSEUDO_DERECURSE
),compile
))libs tools
)
179 include $(topsrcdir
)/config
/rules.mk
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
188 MAKE_SYM_STORE_ARGS
+= -i
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
:= .
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
200 MAKE_SYM_STORE_ARGS
:= -c
-a
$(OS_TEST
) --vcs-info
201 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
203 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
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
211 SYM_STORE_SOURCE_DIRS
:= $(topsrcdir
)
214 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
216 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
217 EXTRA_BUILDID
:= -$(MOZ_SYMBOLS_EXTRA_BUILDID
)
220 SYMBOL_INDEX_NAME
= \
221 $(MOZ_APP_NAME
)-$(MOZ_APP_VERSION
)-$(OS_TARGET
)-$(BUILDID
)-$(CPU_ARCH
)$(EXTRA_BUILDID
)-symbols.txt
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)) \
234 $(DIST
)/crashreporter-symbols \
235 $(MAKE_SYM_STORE_PATH
) | grep
-iv
test > \
236 $(DIST
)/crashreporter-symbols
/$(SYMBOL_INDEX_NAME
)
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
249 ifdef MOZ_CRASHREPORTER
250 $(SHELL
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.sh
$(SYMBOL_INDEX_NAME
) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
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
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
267 maybe_clobber_profiledbuild
:
270 maybe_clobber_profiledbuild
:
271 $(RM
) $(DIST
)/bin
/*.pgc
272 find
$(DIST
)/$(MOZ_APP_NAME
) -name
'*.pgc' -exec mv
{} $(DIST
)/bin \
;
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
)
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
285 # Delegate js-specific rules to js
289 source-package
install:
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
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