DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (31ec81b5d7bb)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

ifndef .PYMAKE
ifeq (,$(MAKE_VERSION))
$(error GNU Make is required)
endif
ifeq (,$(filter-out 3.78 3.79,$(MAKE_VERSION)))
$(error GNU Make 3.80 or higher is required)
endif
endif

export TOPLEVEL_BUILD := 1

default::

ifdef COMPILE_ENVIRONMENT
include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
endif


include $(topsrcdir)/config/config.mk

GARBAGE_DIRS += dist _javagen _profile _tests staticlib
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
   config/autoconf.mk \
   mozilla-config.h \
   netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
   .mozconfig.mk

ifndef MOZ_PROFILE_USE
# One of the first things we do in the build is purge "unknown" files
# from the object directory. This serves two purposes:
#
#   1) Remove files from a previous build no longer accounted for in
#      this build configuration.
#
#   2) Work around poor build system dependencies by forcing some
#      rebuilds.
#
# Ideally #2 does not exist. Our reliance on this aspect should diminish
# over time.
#
# moz.build backend generation simply installs a set of "manifests" into
# a common directory. Each manifest is responsible for defining files in
# a specific subdirectory of the object directory. The invoked Python
# script simply iterates over all the manifests, purging files as
# necessary. To manage new directories or add files to the manifests,
# modify the backend generator.
#
# We need to explicitly put backend.RecursiveMakeBackend.built here
# otherwise the rule in rules.mk doesn't run early enough.
libs export tools:: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend.built
ifndef LIBXUL_SDK
	$(call SUBMAKE,backend.RecursiveMakeBackend.built,js/src,1)
endif

export::
	$(call py_action,purge_manifests,-d _build_manifests/purge .)
endif

CLOBBER: $(topsrcdir)/CLOBBER
	@echo "STOP!  The CLOBBER file has changed."
	@echo "Please run the build through a sanctioned build wrapper, such as"
	@echo "'mach build' or client.mk."
	@exit 1

$(topsrcdir)/configure: $(topsrcdir)/configure.in
	@echo "STOP!  configure.in has changed, and your configure is out of date."
	@echo "Please rerun autoconf and re-configure your build directory."
	@echo "To ignore this message, touch 'configure' in the source directory,"
	@echo "but your build might not succeed."
	@exit 1

config.status: $(topsrcdir)/configure
	@echo "STOP!  configure has changed and needs to be run in this build directory."
	@echo "Please rerun configure."
	@echo "To ignore this message, touch 'config.status' in the build directory,"
	@echo "but your build might not succeed."
	@exit 1

export::
	$(RM) -r $(DIST)/sdk

ifdef ENABLE_TESTS
# Additional makefile targets to call automated test suites
include $(topsrcdir)/testing/testsuite-targets.mk
endif

export::
	$(call py_action,process_install_manifest,$(DIST)/include _build_manifests/install/dist_include $(if $(LIBXUL_SDK),,js/src/_build_manifests/install/dist_include))

default all::
	$(call BUILDSTATUS,TIERS export compile libs tools)

include $(topsrcdir)/config/rules.mk

distclean::
	$(RM) $(DIST_GARBAGE)

ifeq ($(OS_ARCH),WINNT)
# we want to copy PDB files on Windows
MAKE_SYM_STORE_ARGS := -c --vcs-info
ifdef PDBSTR_PATH
MAKE_SYM_STORE_ARGS += -i
endif
DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe
# PDB files don't get moved to dist, so we need to scan the whole objdir
MAKE_SYM_STORE_PATH := .
endif
ifeq ($(OS_ARCH),Darwin)
# need to pass arch flags for universal builds
ifdef UNIVERSAL_BINARY
MAKE_SYM_STORE_ARGS := -c -a "i386 x86_64" --vcs-info
MAKE_SYM_STORE_PATH := $(DIST)/universal
else
MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
MAKE_SYM_STORE_PATH := $(DIST)/bin
endif
DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
endif
ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
MAKE_SYM_STORE_ARGS := -c --vcs-info
DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
MAKE_SYM_STORE_PATH := $(DIST)/bin
endif

SYM_STORE_SOURCE_DIRS := $(topsrcdir)

include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk

ifdef MOZ_SYMBOLS_EXTRA_BUILDID
EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
endif

SYMBOL_INDEX_NAME = \
  $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt

buildsymbols:
ifdef MOZ_CRASHREPORTER
	echo building symbol store
	$(RM) -r $(DIST)/crashreporter-symbols
	$(RM) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
	$(NSINSTALL) -D $(DIST)/crashreporter-symbols
	OBJCOPY="$(OBJCOPY)" \
	$(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
	  $(MAKE_SYM_STORE_ARGS)                                          \
	  $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir))               \
	  $(DUMP_SYMS_BIN)                                                \
	  $(DIST)/crashreporter-symbols                                   \
	  $(MAKE_SYM_STORE_PATH) | grep -iv test >                        \
	  $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
	echo packing symbols
	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
	cd $(DIST)/crashreporter-symbols && \
          zip -r9D "../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" . -x "*test*" -x "*Test*"
	cd $(DIST)/crashreporter-symbols && \
	grep "sym" $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
	  mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
	cd $(DIST)/crashreporter-symbols && \
          zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" . -i "*.sym" -i "*.txt"  -x "*test*" -x "*Test*"
endif # MOZ_CRASHREPORTER

uploadsymbols:
ifdef MOZ_CRASHREPORTER
	$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
endif

# defined in package-name.mk
export MOZ_SOURCE_STAMP

#XXX: this is a hack, since we don't want to clobber for MSVC
# PGO support, but we can't do this test in client.mk
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
# No point in clobbering if PGO has been explicitly disabled.
ifndef NO_PROFILE_GUIDED_OPTIMIZE
maybe_clobber_profiledbuild: clean
else
maybe_clobber_profiledbuild:
endif
else
maybe_clobber_profiledbuild:
	$(RM) $(DIST)/bin/*.pgc
	find $(DIST)/$(MOZ_APP_NAME) -name "*.pgc" -exec mv {} $(DIST)/bin \;
endif

.PHONY: maybe_clobber_profiledbuild

# Look for R_386_PC32 relocations in shared libs, these
# break x86_64 builds and SELinux users.
ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
scheck::
	@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
endif

ifndef LIBXUL_SDK
js/src/Makefile: subsrcdir := js/src

ifdef ENABLE_TESTS
# Incorporate static tier directories into tests. This should be incorporated
# into moz.build files someday.
check::
	$(call SUBMAKE,$@,js/src)
endif
endif