Merge m-c to fx-team.
[gecko.git] / Makefile.in
blob2cf85c75a615643ff288126c05ba724ffe50c7f7
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 libs export tools:: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend.built
56 $(call SUBMAKE,backend.RecursiveMakeBackend.built,js/src,1)
58 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 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 export::
91 $(call py_action,process_install_manifest,$(DIST)/include _build_manifests/install/dist_include js/src/_build_manifests/install/dist_include)
93 default all::
94 $(call BUILDSTATUS,TIERS export compile libs tools)
96 include $(topsrcdir)/config/rules.mk
98 distclean::
99 $(RM) $(DIST_GARBAGE)
101 ifeq ($(OS_ARCH),WINNT)
102 # we want to copy PDB files on Windows
103 MAKE_SYM_STORE_ARGS := -c --vcs-info
104 ifdef PDBSTR_PATH
105 MAKE_SYM_STORE_ARGS += -i
106 endif
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 := .
110 endif
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
116 else
117 MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
118 MAKE_SYM_STORE_PATH := $(DIST)/bin
119 endif
120 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
121 endif
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
126 endif
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)
134 endif
136 SYMBOL_INDEX_NAME = \
137 $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt
139 buildsymbols:
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)) \
149 $(DUMP_SYMS_BIN) \
150 $(DIST)/crashreporter-symbols \
151 $(MAKE_SYM_STORE_PATH) | grep -iv test > \
152 $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
153 echo packing symbols
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
164 uploadsymbols:
165 ifdef MOZ_CRASHREPORTER
166 $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
167 endif
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
178 else
179 maybe_clobber_profiledbuild:
180 endif
181 else
182 maybe_clobber_profiledbuild:
183 $(RM) $(DIST)/bin/*.pgc
184 find $(DIST)/$(MOZ_APP_NAME) -name "*.pgc" -exec mv {} $(DIST)/bin \;
185 endif
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)
192 scheck::
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
194 endif
196 js/src/Makefile: subsrcdir := js/src
198 ifdef ENABLE_TESTS
199 # Incorporate static tier directories into tests. This should be incorporated
200 # into moz.build files someday.
201 check::
202 $(call SUBMAKE,$@,js/src)
203 endif