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 \
36 unallmakefiles mozilla-config.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 # We need to explicitly put backend.RecursiveMakeBackend.built here
42 # otherwise the rule in rules.mk doesn't run early enough.
43 default alldep
all:: CLOBBER
$(topsrcdir
)/configure config.status backend.RecursiveMakeBackend.built
45 $(RM
) -r
$(DIST
)/include
46 $(RM
) -r
$(DIST
)/private
47 $(RM
) -r
$(DIST
)/public
52 CLOBBER
: $(topsrcdir
)/CLOBBER
53 @echo
"STOP! The CLOBBER file has changed."
54 @echo
"Please run the build through a sanctioned build wrapper, such as"
55 @echo
"'mach build' or client.mk."
58 $(topsrcdir
)/configure
: $(topsrcdir
)/configure.in
59 @echo
"STOP! configure.in has changed, and your configure is out of date."
60 @echo
"Please rerun autoconf and re-configure your build directory."
61 @echo
"To ignore this message, touch 'configure' in the source directory,"
62 @echo
"but your build might not succeed."
65 config.status
: $(topsrcdir
)/configure
66 @echo
"STOP! configure has changed and needs to be run in this build directory."
67 @echo
"Please rerun configure."
68 @echo
"To ignore this message, touch 'config.status' in the build directory,"
69 @echo
"but your build might not succeed."
72 # Build pseudo-external modules first when export is explicitly called
75 $(MAKE
) -C config
export
79 # Additional makefile targets to call automated test suites
80 include $(topsrcdir
)/testing
/testsuite-targets.mk
83 include $(topsrcdir
)/config
/rules.mk
86 cat unallmakefiles |
$(XARGS
) rm -f
87 $(RM
) unallmakefiles
$(DIST_GARBAGE
)
89 ifeq ($(OS_ARCH
),WINNT
)
90 # we want to copy PDB files on Windows
91 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
93 MAKE_SYM_STORE_ARGS
+= -i
95 DUMP_SYMS_BIN ?
= $(topsrcdir
)/toolkit
/crashreporter
/tools
/win32
/dump_syms_vc
$(_MSC_VER
).exe
96 # PDB files don't get moved to dist, so we need to scan the whole objdir
97 MAKE_SYM_STORE_PATH
:= .
99 ifeq ($(OS_ARCH
),Darwin
)
100 # need to pass arch flags for universal builds
101 ifdef UNIVERSAL_BINARY
102 MAKE_SYM_STORE_ARGS
:= -c
-a
"i386 x86_64" --vcs-info
103 MAKE_SYM_STORE_PATH
:= $(DIST
)/universal
105 MAKE_SYM_STORE_ARGS
:= -c
-a
$(OS_TEST
) --vcs-info
106 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
108 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
110 ifeq (,$(filter-out Linux SunOS
,$(OS_ARCH
)))
111 MAKE_SYM_STORE_ARGS
:= -c
--vcs-info
112 DUMP_SYMS_BIN ?
= $(DIST
)/host
/bin
/dump_syms
113 MAKE_SYM_STORE_PATH
:= $(DIST
)/bin
116 SYM_STORE_SOURCE_DIRS
:= $(topsrcdir
)
118 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
120 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
121 EXTRA_BUILDID
:= -$(MOZ_SYMBOLS_EXTRA_BUILDID
)
124 SYMBOL_INDEX_NAME
= \
125 $(MOZ_APP_NAME
)-$(MOZ_APP_VERSION
)-$(OS_TARGET
)-$(BUILDID
)-$(CPU_ARCH
)$(EXTRA_BUILDID
)-symbols.txt
128 ifdef MOZ_CRASHREPORTER
129 echo building symbol store
130 $(RM
) -r
$(DIST
)/crashreporter-symbols
131 $(RM
) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
132 $(NSINSTALL
) -D
$(DIST
)/crashreporter-symbols
133 OBJCOPY
="$(OBJCOPY)" \
134 $(PYTHON
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/symbolstore.py \
135 $(MAKE_SYM_STORE_ARGS
) \
136 $(foreach dir,$(SYM_STORE_SOURCE_DIRS
),-s
$(dir)) \
138 $(DIST
)/crashreporter-symbols \
139 $(MAKE_SYM_STORE_PATH
) | grep
-iv
test > \
140 $(DIST
)/crashreporter-symbols
/$(SYMBOL_INDEX_NAME
)
142 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
143 cd
$(DIST
)/crashreporter-symbols
&& \
144 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" .
-x
"*test*" -x
"*Test*"
145 cd
$(DIST
)/crashreporter-symbols
&& \
146 grep
"sym" $(SYMBOL_INDEX_NAME
) > $(SYMBOL_INDEX_NAME
).tmp
&& \
147 mv
$(SYMBOL_INDEX_NAME
).tmp
$(SYMBOL_INDEX_NAME
)
148 cd
$(DIST
)/crashreporter-symbols
&& \
149 zip
-r9D
"../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
-i
"*.sym" -i
"*.txt" -x
"*test*" -x
"*Test*"
150 endif # MOZ_CRASHREPORTER
153 ifdef MOZ_CRASHREPORTER
154 $(SHELL
) $(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.sh
$(SYMBOL_INDEX_NAME
) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
158 $(MAKE
) -C
$(MOZ_BUILD_APP
)/installer codesighs
160 # defined in package-name.mk
161 export MOZ_SOURCE_STAMP
163 #XXX: this is a hack, since we don't want to clobber for MSVC
164 # PGO support, but we can't do this test in client.mk
165 ifneq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
166 # No point in clobbering if PGO has been explicitly disabled.
167 ifndef NO_PROFILE_GUIDED_OPTIMIZE
168 maybe_clobber_profiledbuild
: clean
170 maybe_clobber_profiledbuild
:
173 maybe_clobber_profiledbuild
:
174 $(RM
) $(DIST
)/bin
/*.pgc
175 find
$(DIST
)/$(MOZ_APP_NAME
) -name
"*.pgc" -exec mv
{} $(DIST
)/bin \
;
178 .PHONY
: maybe_clobber_profiledbuild
180 # Look for R_386_PC32 relocations in shared libs, these
181 # break x86_64 builds and SELinux users.
182 ifeq ($(OS_TARGET
)_
$(TARGET_XPCOM_ABI
),Linux_x86-gcc3
)
184 @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
187 js
/src
/Makefile
: subsrcdir
:= js
/src
190 # Incorporate static tier directories into tests. This should be incorporated
191 # into moz.build files someday.
193 $(call SUBMAKE
,$@
,js
/src
)