Bug 886842 - Add clang trunk builds for ASan. r=froydnj
[gecko.git] / Makefile.in
blobb3a4c6312bcf2bccb2e99fbb5da33dc1e08dd456
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 DEPTH = @DEPTH@
7 topsrcdir = @top_srcdir@
8 srcdir = @srcdir@
9 VPATH = @srcdir@
11 ifndef .PYMAKE
12 ifeq (,$(MAKE_VERSION))
13 $(error GNU Make is required)
14 endif
15 ifeq (,$(filter-out 3.78 3.79,$(MAKE_VERSION)))
16 $(error GNU Make 3.80 or higher is required)
17 endif
18 endif
20 export TOPLEVEL_BUILD := 1
22 include $(DEPTH)/config/autoconf.mk
24 default::
26 ifdef COMPILE_ENVIRONMENT
27 include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
28 endif
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 \
35 config/autoconf.mk \
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 # One of the first things we do in the build is purge "unknown" files
42 # from the object directory. This serves two purposes:
44 # 1) Remove files from a previous build no longer accounted for in
45 # this build configuration.
47 # 2) Work around poor build system dependencies by forcing some
48 # rebuilds.
50 # Ideally #2 does not exist. Our reliance on this aspect should diminish
51 # over time.
53 # moz.build backend generation simply installs a set of "manifests" into
54 # a common directory. Each manifest is responsible for defining files in
55 # a specific subdirectory of the object directory. The invoked Python
56 # script simply iterates over all the manifests, purging files as
57 # necessary. To manage new directories or add files to the manifests,
58 # modify the backend generator.
60 # We need to explicitly put backend.RecursiveMakeBackend.built here
61 # otherwise the rule in rules.mk doesn't run early enough.
62 default alldep all:: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend.built
63 $(PYTHON) $(topsrcdir)/config/purge_directories.py -d _build_manifests/purge .
64 endif
66 CLOBBER: $(topsrcdir)/CLOBBER
67 @echo "STOP! The CLOBBER file has changed."
68 @echo "Please run the build through a sanctioned build wrapper, such as"
69 @echo "'mach build' or client.mk."
70 @exit 1
72 $(topsrcdir)/configure: $(topsrcdir)/configure.in
73 @echo "STOP! configure.in has changed, and your configure is out of date."
74 @echo "Please rerun autoconf and re-configure your build directory."
75 @echo "To ignore this message, touch 'configure' in the source directory,"
76 @echo "but your build might not succeed."
77 @exit 1
79 config.status: $(topsrcdir)/configure
80 @echo "STOP! configure has changed and needs to be run in this build directory."
81 @echo "Please rerun configure."
82 @echo "To ignore this message, touch 'config.status' in the build directory,"
83 @echo "but your build might not succeed."
84 @exit 1
86 # Build pseudo-external modules first when export is explicitly called
87 export::
88 $(RM) -r $(DIST)/sdk
89 $(MAKE) -C config export
90 $(MAKE) tier_nspr
92 ifdef ENABLE_TESTS
93 # Additional makefile targets to call automated test suites
94 include $(topsrcdir)/testing/testsuite-targets.mk
95 endif
97 include $(topsrcdir)/config/rules.mk
99 distclean::
100 cat unallmakefiles | $(XARGS) rm -f
101 $(RM) unallmakefiles $(DIST_GARBAGE)
103 ifeq ($(OS_ARCH),WINNT)
104 # we want to copy PDB files on Windows
105 MAKE_SYM_STORE_ARGS := -c --vcs-info
106 ifdef PDBSTR_PATH
107 MAKE_SYM_STORE_ARGS += -i
108 endif
109 DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe
110 # PDB files don't get moved to dist, so we need to scan the whole objdir
111 MAKE_SYM_STORE_PATH := .
112 endif
113 ifeq ($(OS_ARCH),Darwin)
114 # need to pass arch flags for universal builds
115 ifdef UNIVERSAL_BINARY
116 MAKE_SYM_STORE_ARGS := -c -a "i386 x86_64" --vcs-info
117 MAKE_SYM_STORE_PATH := $(DIST)/universal
118 else
119 MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
120 MAKE_SYM_STORE_PATH := $(DIST)/bin
121 endif
122 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
123 endif
124 ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
125 MAKE_SYM_STORE_ARGS := -c --vcs-info
126 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
127 MAKE_SYM_STORE_PATH := $(DIST)/bin
128 endif
130 SYM_STORE_SOURCE_DIRS := $(topsrcdir)
132 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
134 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
135 EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
136 endif
138 SYMBOL_INDEX_NAME = \
139 $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt
141 buildsymbols:
142 ifdef MOZ_CRASHREPORTER
143 echo building symbol store
144 $(RM) -r $(DIST)/crashreporter-symbols
145 $(RM) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
146 $(NSINSTALL) -D $(DIST)/crashreporter-symbols
147 OBJCOPY="$(OBJCOPY)" \
148 $(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
149 $(MAKE_SYM_STORE_ARGS) \
150 $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir)) \
151 $(DUMP_SYMS_BIN) \
152 $(DIST)/crashreporter-symbols \
153 $(MAKE_SYM_STORE_PATH) | grep -iv test > \
154 $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
155 echo packing symbols
156 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
157 cd $(DIST)/crashreporter-symbols && \
158 zip -r9D "../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" . -x "*test*" -x "*Test*"
159 cd $(DIST)/crashreporter-symbols && \
160 grep "sym" $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
161 mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
162 cd $(DIST)/crashreporter-symbols && \
163 zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" . -i "*.sym" -i "*.txt" -x "*test*" -x "*Test*"
164 endif # MOZ_CRASHREPORTER
166 uploadsymbols:
167 ifdef MOZ_CRASHREPORTER
168 $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
169 endif
171 codesighs:
172 $(MAKE) -C $(MOZ_BUILD_APP)/installer codesighs
174 # defined in package-name.mk
175 export MOZ_SOURCE_STAMP
177 #XXX: this is a hack, since we don't want to clobber for MSVC
178 # PGO support, but we can't do this test in client.mk
179 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
180 # No point in clobbering if PGO has been explicitly disabled.
181 ifndef NO_PROFILE_GUIDED_OPTIMIZE
182 maybe_clobber_profiledbuild: clean
183 else
184 maybe_clobber_profiledbuild:
185 endif
186 else
187 maybe_clobber_profiledbuild:
188 $(RM) $(DIST)/bin/*.pgc
189 find $(DIST)/$(MOZ_APP_NAME) -name "*.pgc" -exec mv {} $(DIST)/bin \;
190 endif
192 .PHONY: maybe_clobber_profiledbuild
194 # Look for R_386_PC32 relocations in shared libs, these
195 # break x86_64 builds and SELinux users.
196 ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
197 scheck::
198 @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
199 endif
201 js/src/Makefile: subsrcdir := js/src
203 ifdef ENABLE_TESTS
204 # Incorporate static tier directories into tests. This should be incorporated
205 # into moz.build files someday.
206 check::
207 $(call SUBMAKE,$@,js/src)
208 endif