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 libs
export 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
91 $(call py_action
,process_install_manifest
,$(DIST
)/include _build_manifests
/install/dist_include js
/src
/_build_manifests
/install/dist_include
)
94 $(call BUILDSTATUS
,TIERS
export compile libs tools
)
96 include $(topsrcdir
)/config
/rules.mk
101 ifeq ($(OS_ARCH
),WINNT
)
102 # we want to copy PDB files on Windows
103 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
105 MAKE_SYM_STORE_ARGS
+= -i
107 DUMP_SYMS_BIN ?
= $(topsrcdir
)/toolkit
/crashreporter
/tools
/win32
/dump_syms_vc
$(_MSC_VER
).exe
108 # PDB files don't get moved to dist, so we need to scan the whole objdir
109 MAKE_SYM_STORE_PATH
:= .
111 ifeq ($(OS_ARCH
),Darwin
)
112 # need to pass arch flags for universal builds
113 ifdef UNIVERSAL_BINARY
114 MAKE_SYM_STORE_ARGS
:= -c
-a
"i386 x86_64" --vcs-info
115 MAKE_SYM_STORE_PATH
:= $(DIST
)/universal
117 MAKE_SYM_STORE_ARGS
:= -c
-a
$(OS_TEST
) --vcs-info
118 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
120 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
122 ifeq (,$(filter-out Linux SunOS
,$(OS_ARCH
)))
123 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
124 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
125 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
128 SYM_STORE_SOURCE_DIRS
:= $(topsrcdir
)
130 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
132 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
133 EXTRA_BUILDID
:= -$(MOZ_SYMBOLS_EXTRA_BUILDID
)
136 SYMBOL_INDEX_NAME
= \
137 $(MOZ_APP_NAME
)-$(MOZ_APP_VERSION
)-$(OS_TARGET
)-$(BUILDID
)-$(CPU_ARCH
)$(EXTRA_BUILDID
)-symbols.txt
140 ifdef MOZ_CRASHREPORTER
141 echo building symbol store
142 $(RM
) -r
$(DIST
)/crashreporter-symbols
143 $(RM
) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
144 $(NSINSTALL
) -D
$(DIST
)/crashreporter-symbols
145 OBJCOPY
="$(OBJCOPY)" \
146 $(PYTHON
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/symbolstore.py \
147 $(MAKE_SYM_STORE_ARGS
) \
148 $(foreach dir,$(SYM_STORE_SOURCE_DIRS
),-s
$(dir)) \
150 $(DIST
)/crashreporter-symbols \
151 $(MAKE_SYM_STORE_PATH
) | grep
-iv
test > \
152 $(DIST
)/crashreporter-symbols
/$(SYMBOL_INDEX_NAME
)
154 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
155 cd
$(DIST
)/crashreporter-symbols
&& \
156 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" .
-x
"*test*" -x
"*Test*"
157 cd
$(DIST
)/crashreporter-symbols
&& \
158 grep
"sym" $(SYMBOL_INDEX_NAME
) > $(SYMBOL_INDEX_NAME
).tmp
&& \
159 mv
$(SYMBOL_INDEX_NAME
).tmp
$(SYMBOL_INDEX_NAME
)
160 cd
$(DIST
)/crashreporter-symbols
&& \
161 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
-i
"*.sym" -i
"*.txt" -x
"*test*" -x
"*Test*"
162 endif # MOZ_CRASHREPORTER
165 ifdef MOZ_CRASHREPORTER
166 $(SHELL
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.sh
$(SYMBOL_INDEX_NAME
) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
169 # defined in package-name.mk
170 export MOZ_SOURCE_STAMP
172 #XXX: this is a hack, since we don't want to clobber for MSVC
173 # PGO support, but we can't do this test in client.mk
174 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
175 # No point in clobbering if PGO has been explicitly disabled.
176 ifndef NO_PROFILE_GUIDED_OPTIMIZE
177 maybe_clobber_profiledbuild
: clean
179 maybe_clobber_profiledbuild
:
182 maybe_clobber_profiledbuild
:
183 $(RM
) $(DIST
)/bin
/*.pgc
184 find
$(DIST
)/$(MOZ_APP_NAME
) -name
"*.pgc" -exec mv
{} $(DIST
)/bin \
;
187 .PHONY
: maybe_clobber_profiledbuild
189 # Look for R_386_PC32 relocations in shared libs, these
190 # break x86_64 builds and SELinux users.
191 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
193 @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
196 js
/src
/Makefile
: subsrcdir
:= js
/src
199 # Incorporate static tier directories into tests. This should be incorporated
200 # into moz.build files someday.
202 $(call SUBMAKE
,$@
,js
/src
)