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