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 topsrcdir
= @top_srcdir@
12 ifeq (,$(MAKE_VERSION
))
13 $(error GNU Make is required
)
15 ifeq (,$(filter-out 3.78 3.79,$(MAKE_VERSION
)))
16 $(error GNU Make
3.80 or higher is required
)
20 export TOPLEVEL_BUILD
:= 1
22 include $(DEPTH
)/config
/autoconf.mk
26 ifdef COMPILE_ENVIRONMENT
27 include $(topsrcdir
)/$(MOZ_BUILD_APP
)/build.mk
31 include $(topsrcdir
)/config
/config.mk
33 GARBAGE_DIRS
+= dist _javagen _profile _tests staticlib
34 DIST_GARBAGE
= config.cache config.log config.status
* config-defs.h \
37 netwerk
/necko-config.h xpcom
/xpcom-config.h xpcom
/xpcom-private.h \
38 $(topsrcdir
)/.mozconfig.mk
$(topsrcdir
)/.mozconfig.out
40 ifndef MOZ_PROFILE_USE
41 # One of the first things we do in the build is purge "unknown" files
42 # from the object directory. This serves two purposes:
44 # 1) Remove files from a previous build no longer accounted for in
45 # this build configuration.
47 # 2) Work around poor build system dependencies by forcing some
50 # Ideally #2 does not exist. Our reliance on this aspect should diminish
53 # moz.build backend generation simply installs a set of "manifests" into
54 # a common directory. Each manifest is responsible for defining files in
55 # a specific subdirectory of the object directory. The invoked Python
56 # script simply iterates over all the manifests, purging files as
57 # necessary. To manage new directories or add files to the manifests,
58 # modify the backend generator.
60 # We need to explicitly put backend.RecursiveMakeBackend.built here
61 # otherwise the rule in rules.mk doesn't run early enough.
62 default alldep
all:: CLOBBER
$(topsrcdir
)/configure config.status backend.RecursiveMakeBackend.built
63 $(call SUBMAKE
,backend.RecursiveMakeBackend.built
,js
/src
,1)
64 $(call py_action
,purge_manifests
,-d _build_manifests
/purge .
)
67 CLOBBER
: $(topsrcdir
)/CLOBBER
68 @echo
"STOP! The CLOBBER file has changed."
69 @echo
"Please run the build through a sanctioned build wrapper, such as"
70 @echo
"'mach build' or client.mk."
73 $(topsrcdir
)/configure
: $(topsrcdir
)/configure.in
74 @echo
"STOP! configure.in has changed, and your configure is out of date."
75 @echo
"Please rerun autoconf and re-configure your build directory."
76 @echo
"To ignore this message, touch 'configure' in the source directory,"
77 @echo
"but your build might not succeed."
80 config.status
: $(topsrcdir
)/configure
81 @echo
"STOP! configure has changed and needs to be run in this build directory."
82 @echo
"Please rerun configure."
83 @echo
"To ignore this message, touch 'config.status' in the build directory,"
84 @echo
"but your build might not succeed."
87 # Build pseudo-external modules first when export is explicitly called
92 # Additional makefile targets to call automated test suites
93 include $(topsrcdir
)/testing
/testsuite-targets.mk
96 # Hacky way for precompile tier to bypass default tier traversal mechanism.
97 TIER_precompile_CUSTOM
:= 1
99 include $(topsrcdir
)/config
/rules.mk
102 $(call BUILDSTATUS
,TIERS
$(TIERS
))
103 $(foreach tier
,$(TIERS
),$(call SUBMAKE
,tier_
$(tier
)))
105 include $(topsrcdir
)/config
/makefiles
/tiers.mk
106 $(foreach tier
,$(TIERS
),$(eval
$(call CREATE_TIER_RULE
,$(tier
))))
109 $(RM
) $(DIST_GARBAGE
)
111 ifeq ($(OS_ARCH
),WINNT
)
112 # we want to copy PDB files on Windows
113 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
115 MAKE_SYM_STORE_ARGS
+= -i
117 DUMP_SYMS_BIN ?
= $(topsrcdir
)/toolkit
/crashreporter
/tools
/win32
/dump_syms_vc
$(_MSC_VER
).exe
118 # PDB files don't get moved to dist, so we need to scan the whole objdir
119 MAKE_SYM_STORE_PATH
:= .
121 ifeq ($(OS_ARCH
),Darwin
)
122 # need to pass arch flags for universal builds
123 ifdef UNIVERSAL_BINARY
124 MAKE_SYM_STORE_ARGS
:= -c
-a
"i386 x86_64" --vcs-info
125 MAKE_SYM_STORE_PATH
:= $(DIST
)/universal
127 MAKE_SYM_STORE_ARGS
:= -c
-a
$(OS_TEST
) --vcs-info
128 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
130 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
132 ifeq (,$(filter-out Linux SunOS
,$(OS_ARCH
)))
133 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
134 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
135 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
138 SYM_STORE_SOURCE_DIRS
:= $(topsrcdir
)
140 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
142 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
143 EXTRA_BUILDID
:= -$(MOZ_SYMBOLS_EXTRA_BUILDID
)
146 SYMBOL_INDEX_NAME
= \
147 $(MOZ_APP_NAME
)-$(MOZ_APP_VERSION
)-$(OS_TARGET
)-$(BUILDID
)-$(CPU_ARCH
)$(EXTRA_BUILDID
)-symbols.txt
150 ifdef MOZ_CRASHREPORTER
151 echo building symbol store
152 $(RM
) -r
$(DIST
)/crashreporter-symbols
153 $(RM
) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
154 $(NSINSTALL
) -D
$(DIST
)/crashreporter-symbols
155 OBJCOPY
="$(OBJCOPY)" \
156 $(PYTHON
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/symbolstore.py \
157 $(MAKE_SYM_STORE_ARGS
) \
158 $(foreach dir,$(SYM_STORE_SOURCE_DIRS
),-s
$(dir)) \
160 $(DIST
)/crashreporter-symbols \
161 $(MAKE_SYM_STORE_PATH
) | grep
-iv
test > \
162 $(DIST
)/crashreporter-symbols
/$(SYMBOL_INDEX_NAME
)
164 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
165 cd
$(DIST
)/crashreporter-symbols
&& \
166 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" .
-x
"*test*" -x
"*Test*"
167 cd
$(DIST
)/crashreporter-symbols
&& \
168 grep
"sym" $(SYMBOL_INDEX_NAME
) > $(SYMBOL_INDEX_NAME
).tmp
&& \
169 mv
$(SYMBOL_INDEX_NAME
).tmp
$(SYMBOL_INDEX_NAME
)
170 cd
$(DIST
)/crashreporter-symbols
&& \
171 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
-i
"*.sym" -i
"*.txt" -x
"*test*" -x
"*Test*"
172 endif # MOZ_CRASHREPORTER
175 ifdef MOZ_CRASHREPORTER
176 $(SHELL
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.sh
$(SYMBOL_INDEX_NAME
) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
179 # defined in package-name.mk
180 export MOZ_SOURCE_STAMP
182 #XXX: this is a hack, since we don't want to clobber for MSVC
183 # PGO support, but we can't do this test in client.mk
184 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
185 # No point in clobbering if PGO has been explicitly disabled.
186 ifndef NO_PROFILE_GUIDED_OPTIMIZE
187 maybe_clobber_profiledbuild
: clean
189 maybe_clobber_profiledbuild
:
192 maybe_clobber_profiledbuild
:
193 $(RM
) $(DIST
)/bin
/*.pgc
194 find
$(DIST
)/$(MOZ_APP_NAME
) -name
"*.pgc" -exec mv
{} $(DIST
)/bin \
;
197 .PHONY
: maybe_clobber_profiledbuild
199 # Look for R_386_PC32 relocations in shared libs, these
200 # break x86_64 builds and SELinux users.
201 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
203 @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
206 js
/src
/Makefile
: subsrcdir
:= js
/src
209 # Incorporate static tier directories into tests. This should be incorporated
210 # into moz.build files someday.
212 $(call SUBMAKE
,$@
,js
/src
)