Merge m-c to fx-team.
[gecko.git] / Makefile.in
blobed491b8e6515fcd034e4deb6a13c3ebc89676ac2
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/.
6 ifndef .PYMAKE
7 ifeq (,$(MAKE_VERSION))
8 $(error GNU Make is required)
9 endif
10 ifeq (,$(filter-out 3.78 3.79,$(MAKE_VERSION)))
11 $(error GNU Make 3.80 or higher is required)
12 endif
13 endif
15 export TOPLEVEL_BUILD := 1
17 default::
19 ifdef COMPILE_ENVIRONMENT
20 include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
21 endif
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 \
28 config/autoconf.mk \
29 mozilla-config.h \
30 netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
31 .mozconfig.mk
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
41 # rebuilds.
43 # Ideally #2 does not exist. Our reliance on this aspect should diminish
44 # over time.
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)
58 default all export::
59 $(call py_action,purge_manifests,-d _build_manifests/purge .)
60 endif
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."
66 @exit 1
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."
73 @exit 1
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."
80 @exit 1
82 default all export::
83 $(RM) -r $(DIST)/sdk
85 ifdef ENABLE_TESTS
86 # Additional makefile targets to call automated test suites
87 include $(topsrcdir)/testing/testsuite-targets.mk
88 endif
90 # Hacky way for precompile tier to bypass default tier traversal mechanism.
91 TIER_precompile_CUSTOM := 1
93 default all export::
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
98 default all::
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))))
105 distclean::
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
111 ifdef PDBSTR_PATH
112 MAKE_SYM_STORE_ARGS += -i
113 endif
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 := .
117 endif
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
123 else
124 MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
125 MAKE_SYM_STORE_PATH := $(DIST)/bin
126 endif
127 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
128 endif
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
133 endif
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)
141 endif
143 SYMBOL_INDEX_NAME = \
144 $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt
146 buildsymbols:
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)) \
156 $(DUMP_SYMS_BIN) \
157 $(DIST)/crashreporter-symbols \
158 $(MAKE_SYM_STORE_PATH) | grep -iv test > \
159 $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
160 echo packing symbols
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
171 uploadsymbols:
172 ifdef MOZ_CRASHREPORTER
173 $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
174 endif
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
185 else
186 maybe_clobber_profiledbuild:
187 endif
188 else
189 maybe_clobber_profiledbuild:
190 $(RM) $(DIST)/bin/*.pgc
191 find $(DIST)/$(MOZ_APP_NAME) -name "*.pgc" -exec mv {} $(DIST)/bin \;
192 endif
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)
199 scheck::
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
201 endif
203 js/src/Makefile: subsrcdir := js/src
205 ifdef ENABLE_TESTS
206 # Incorporate static tier directories into tests. This should be incorporated
207 # into moz.build files someday.
208 check::
209 $(call SUBMAKE,$@,js/src)
210 endif