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
90 $(MAKE
) -C config
export
94 # Additional makefile targets to call automated test suites
95 include $(topsrcdir
)/testing
/testsuite-targets.mk
98 # Hacky way for precompile tier to bypass default tier traversal mechanism.
99 TIER_precompile_CUSTOM
:= 1
101 include $(topsrcdir
)/config
/rules.mk
104 $(call BUILDSTATUS
,TIERS
$(TIERS
))
105 $(foreach tier
,$(TIERS
),$(call SUBMAKE
,tier_
$(tier
)))
107 include $(topsrcdir
)/config
/makefiles
/tiers.mk
108 $(foreach tier
,$(TIERS
),$(eval
$(call CREATE_TIER_RULE
,$(tier
))))
111 $(RM
) $(DIST_GARBAGE
)
113 ifeq ($(OS_ARCH
),WINNT
)
114 # we want to copy PDB files on Windows
115 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
117 MAKE_SYM_STORE_ARGS
+= -i
119 DUMP_SYMS_BIN ?
= $(topsrcdir
)/toolkit
/crashreporter
/tools
/win32
/dump_syms_vc
$(_MSC_VER
).exe
120 # PDB files don't get moved to dist, so we need to scan the whole objdir
121 MAKE_SYM_STORE_PATH
:= .
123 ifeq ($(OS_ARCH
),Darwin
)
124 # need to pass arch flags for universal builds
125 ifdef UNIVERSAL_BINARY
126 MAKE_SYM_STORE_ARGS
:= -c
-a
"i386 x86_64" --vcs-info
127 MAKE_SYM_STORE_PATH
:= $(DIST
)/universal
129 MAKE_SYM_STORE_ARGS
:= -c
-a
$(OS_TEST
) --vcs-info
130 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
132 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
134 ifeq (,$(filter-out Linux SunOS
,$(OS_ARCH
)))
135 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
136 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
137 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
140 SYM_STORE_SOURCE_DIRS
:= $(topsrcdir
)
142 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
144 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
145 EXTRA_BUILDID
:= -$(MOZ_SYMBOLS_EXTRA_BUILDID
)
148 SYMBOL_INDEX_NAME
= \
149 $(MOZ_APP_NAME
)-$(MOZ_APP_VERSION
)-$(OS_TARGET
)-$(BUILDID
)-$(CPU_ARCH
)$(EXTRA_BUILDID
)-symbols.txt
152 ifdef MOZ_CRASHREPORTER
153 echo building symbol store
154 $(RM
) -r
$(DIST
)/crashreporter-symbols
155 $(RM
) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
156 $(NSINSTALL
) -D
$(DIST
)/crashreporter-symbols
157 OBJCOPY
="$(OBJCOPY)" \
158 $(PYTHON
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/symbolstore.py \
159 $(MAKE_SYM_STORE_ARGS
) \
160 $(foreach dir,$(SYM_STORE_SOURCE_DIRS
),-s
$(dir)) \
162 $(DIST
)/crashreporter-symbols \
163 $(MAKE_SYM_STORE_PATH
) | grep
-iv
test > \
164 $(DIST
)/crashreporter-symbols
/$(SYMBOL_INDEX_NAME
)
166 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
167 cd
$(DIST
)/crashreporter-symbols
&& \
168 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" .
-x
"*test*" -x
"*Test*"
169 cd
$(DIST
)/crashreporter-symbols
&& \
170 grep
"sym" $(SYMBOL_INDEX_NAME
) > $(SYMBOL_INDEX_NAME
).tmp
&& \
171 mv
$(SYMBOL_INDEX_NAME
).tmp
$(SYMBOL_INDEX_NAME
)
172 cd
$(DIST
)/crashreporter-symbols
&& \
173 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
-i
"*.sym" -i
"*.txt" -x
"*test*" -x
"*Test*"
174 endif # MOZ_CRASHREPORTER
177 ifdef MOZ_CRASHREPORTER
178 $(SHELL
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.sh
$(SYMBOL_INDEX_NAME
) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
181 # defined in package-name.mk
182 export MOZ_SOURCE_STAMP
184 #XXX: this is a hack, since we don't want to clobber for MSVC
185 # PGO support, but we can't do this test in client.mk
186 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
187 # No point in clobbering if PGO has been explicitly disabled.
188 ifndef NO_PROFILE_GUIDED_OPTIMIZE
189 maybe_clobber_profiledbuild
: clean
191 maybe_clobber_profiledbuild
:
194 maybe_clobber_profiledbuild
:
195 $(RM
) $(DIST
)/bin
/*.pgc
196 find
$(DIST
)/$(MOZ_APP_NAME
) -name
"*.pgc" -exec mv
{} $(DIST
)/bin \
;
199 .PHONY
: maybe_clobber_profiledbuild
201 # Look for R_386_PC32 relocations in shared libs, these
202 # break x86_64 builds and SELinux users.
203 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
205 @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
208 js
/src
/Makefile
: subsrcdir
:= js
/src
211 # Incorporate static tier directories into tests. This should be incorporated
212 # into moz.build files someday.
214 $(call SUBMAKE
,$@
,js
/src
)