client.mk

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/client.mk	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,481 @@
     1.4 +# -*- makefile -*-
     1.5 +# vim:set ts=8 sw=8 sts=8 noet:
     1.6 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.9 +
    1.10 +# Build a mozilla application.
    1.11 +#
    1.12 +# To build a tree,
    1.13 +#    1. hg clone ssh://hg.mozilla.org/mozilla-central mozilla
    1.14 +#    2. cd mozilla
    1.15 +#    3. create your .mozconfig file with
    1.16 +#       ac_add_options --enable-application=browser
    1.17 +#    4. gmake -f client.mk
    1.18 +#
    1.19 +# Other targets (gmake -f client.mk [targets...]),
    1.20 +#    build
    1.21 +#    clean (realclean is now the same as clean)
    1.22 +#    distclean
    1.23 +#
    1.24 +# See http://developer.mozilla.org/en/docs/Build_Documentation for 
    1.25 +# more information.
    1.26 +#
    1.27 +# Options:
    1.28 +#   MOZ_BUILD_PROJECTS   - Build multiple projects in subdirectories
    1.29 +#                          of MOZ_OBJDIR
    1.30 +#   MOZ_OBJDIR           - Destination object directory
    1.31 +#   MOZ_MAKE_FLAGS       - Flags to pass to $(MAKE)
    1.32 +#   MOZ_PREFLIGHT_ALL  } - Makefiles to run before any project in
    1.33 +#   MOZ_PREFLIGHT      }   MOZ_BUILD_PROJECTS, before each project, after
    1.34 +#   MOZ_POSTFLIGHT     }   each project, and after all projects; these
    1.35 +#   MOZ_POSTFLIGHT_ALL }   variables contain space-separated lists
    1.36 +#   MOZ_UNIFY_BDATE      - Set to use the same bdate for each project in
    1.37 +#                          MOZ_BUILD_PROJECTS
    1.38 +#
    1.39 +#######################################################################
    1.40 +# Defines
    1.41 +
    1.42 +comma := ,
    1.43 +
    1.44 +CWD := $(CURDIR)
    1.45 +ifneq (1,$(words $(CWD)))
    1.46 +$(error The mozilla directory cannot be located in a path with spaces.)
    1.47 +endif
    1.48 +
    1.49 +ifeq "$(CWD)" "/"
    1.50 +CWD   := /.
    1.51 +endif
    1.52 +
    1.53 +ifndef TOPSRCDIR
    1.54 +ifeq (,$(wildcard client.mk))
    1.55 +TOPSRCDIR := $(patsubst %/,%,$(dir $(MAKEFILE_LIST)))
    1.56 +MOZ_OBJDIR = .
    1.57 +else
    1.58 +TOPSRCDIR := $(CWD)
    1.59 +endif
    1.60 +endif
    1.61 +
    1.62 +# try to find autoconf 2.13 - discard errors from 'which'
    1.63 +# MacOS X 10.4 sends "no autoconf*" errors to stdout, discard those via grep
    1.64 +AUTOCONF ?= $(shell which autoconf-2.13 autoconf2.13 autoconf213 2>/dev/null | grep -v '^no autoconf' | head -1)
    1.65 +
    1.66 +# See if the autoconf package was installed through fink
    1.67 +ifeq (,$(strip $(AUTOCONF)))
    1.68 +AUTOCONF = $(shell which fink >/dev/null 2>&1 && echo `which fink`/../../lib/autoconf2.13/bin/autoconf)
    1.69 +endif
    1.70 +
    1.71 +ifeq (,$(strip $(AUTOCONF)))
    1.72 +AUTOCONF=$(error Could not find autoconf 2.13)
    1.73 +endif
    1.74 +
    1.75 +SH := /bin/sh
    1.76 +PERL ?= perl
    1.77 +PYTHON ?= python
    1.78 +
    1.79 +CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
    1.80 +ifdef CONFIG_GUESS_SCRIPT
    1.81 +  CONFIG_GUESS := $(shell $(CONFIG_GUESS_SCRIPT))
    1.82 +endif
    1.83 +
    1.84 +
    1.85 +####################################
    1.86 +# Sanity checks
    1.87 +
    1.88 +# Windows checks.
    1.89 +ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
    1.90 +
    1.91 +# check for CRLF line endings
    1.92 +ifneq (0,$(shell $(PERL) -e 'binmode(STDIN); while (<STDIN>) { if (/\r/) { print "1"; exit } } print "0"' < $(TOPSRCDIR)/client.mk))
    1.93 +$(error This source tree appears to have Windows-style line endings. To \
    1.94 +convert it to Unix-style line endings, check \
    1.95 +"https://developer.mozilla.org/en-US/docs/Developer_Guide/Mozilla_build_FAQ\#Win32-specific_questions" \
    1.96 +for a workaround of this issue.)
    1.97 +endif
    1.98 +endif
    1.99 +
   1.100 +####################################
   1.101 +# Load mozconfig Options
   1.102 +
   1.103 +# See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
   1.104 +
   1.105 +MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk
   1.106 +
   1.107 +define CR
   1.108 +
   1.109 +
   1.110 +endef
   1.111 +
   1.112 +# As $(shell) doesn't preserve newlines, use sed to replace them with an
   1.113 +# unlikely sequence (||), which is then replaced back to newlines by make
   1.114 +# before evaluation. $(shell) replacing newlines with spaces, || is always
   1.115 +# followed by a space (since sed doesn't remove newlines), except on the
   1.116 +# last line, so replace both '|| ' and '||'.
   1.117 +MOZCONFIG_CONTENT := $(subst ||,$(CR),$(subst || ,$(CR),$(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) | sed 's/$$/||/')))
   1.118 +$(eval $(MOZCONFIG_CONTENT))
   1.119 +
   1.120 +export FOUND_MOZCONFIG
   1.121 +
   1.122 +# As '||' was used as a newline separator, it means it's not occurring in
   1.123 +# lines themselves. It can thus safely be used to replaces normal spaces,
   1.124 +# to then replace newlines with normal spaces. This allows to get a list
   1.125 +# of mozconfig output lines.
   1.126 +MOZCONFIG_OUT_LINES := $(subst $(CR), ,$(subst $(NULL) $(NULL),||,$(MOZCONFIG_CONTENT)))
   1.127 +# Filter-out comments from those lines.
   1.128 +START_COMMENT = \#
   1.129 +MOZCONFIG_OUT_FILTERED := $(filter-out $(START_COMMENT)%,$(MOZCONFIG_OUT_LINES))
   1.130 +
   1.131 +ifdef AUTOCLOBBER
   1.132 +export AUTOCLOBBER=1
   1.133 +endif
   1.134 +export MOZ_PGO
   1.135 +
   1.136 +ifdef MOZ_PARALLEL_BUILD
   1.137 +  MOZ_MAKE_FLAGS := $(filter-out -j%,$(MOZ_MAKE_FLAGS))
   1.138 +  MOZ_MAKE_FLAGS += -j$(MOZ_PARALLEL_BUILD)
   1.139 +endif
   1.140 +
   1.141 +# Automatically add -jN to make flags if not defined. N defaults to number of cores.
   1.142 +ifeq (,$(findstring -j,$(MOZ_MAKE_FLAGS)))
   1.143 +  cores=$(shell $(PYTHON) -c 'import multiprocessing; print(multiprocessing.cpu_count())')
   1.144 +  MOZ_MAKE_FLAGS += -j$(cores)
   1.145 +endif
   1.146 +
   1.147 +
   1.148 +ifndef MOZ_OBJDIR
   1.149 +  MOZ_OBJDIR = obj-$(CONFIG_GUESS)
   1.150 +else
   1.151 +# On Windows Pymake builds check MOZ_OBJDIR doesn't start with "/"
   1.152 +  ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
   1.153 +  ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(MOZ_OBJDIR))))
   1.154 +  $(error For Windows Pymake builds, MOZ_OBJDIR must be a Windows [and not MSYS] style path.)
   1.155 +  endif
   1.156 +  endif
   1.157 +endif
   1.158 +
   1.159 +ifdef MOZ_BUILD_PROJECTS
   1.160 +
   1.161 +ifdef MOZ_CURRENT_PROJECT
   1.162 +  OBJDIR = $(MOZ_OBJDIR)/$(MOZ_CURRENT_PROJECT)
   1.163 +  MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
   1.164 +  BUILD_PROJECT_ARG = MOZ_BUILD_APP=$(MOZ_CURRENT_PROJECT)
   1.165 +else
   1.166 +  OBJDIR = $(error Cannot find the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
   1.167 +  MOZ_MAKE = $(error Cannot build in the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
   1.168 +endif
   1.169 +
   1.170 +else # MOZ_BUILD_PROJECTS
   1.171 +
   1.172 +OBJDIR = $(MOZ_OBJDIR)
   1.173 +MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
   1.174 +
   1.175 +endif # MOZ_BUILD_PROJECTS
   1.176 +
   1.177 +# 'configure' scripts generated by autoconf.
   1.178 +CONFIGURES := $(TOPSRCDIR)/configure
   1.179 +CONFIGURES += $(TOPSRCDIR)/js/src/configure
   1.180 +
   1.181 +# Make targets that are going to be passed to the real build system
   1.182 +OBJDIR_TARGETS = install export libs clean realclean distclean maybe_clobber_profiledbuild upload sdk installer package package-compare stage-package source-package l10n-check automation/build
   1.183 +
   1.184 +#######################################################################
   1.185 +# Rules
   1.186 +
   1.187 +# The default rule is build
   1.188 +build::
   1.189 +	$(MAKE) -f $(TOPSRCDIR)/client.mk $(if $(MOZ_PGO),profiledbuild,realbuild)
   1.190 +
   1.191 +# Define mkdir
   1.192 +include $(TOPSRCDIR)/config/makefiles/makeutils.mk
   1.193 +include $(TOPSRCDIR)/config/makefiles/autotargets.mk
   1.194 +
   1.195 +# Create a makefile containing the mk_add_options values from mozconfig,
   1.196 +# but only do so when OBJDIR is defined (see further above).
   1.197 +ifdef MOZ_BUILD_PROJECTS
   1.198 +ifdef MOZ_CURRENT_PROJECT
   1.199 +WANT_MOZCONFIG_MK = 1
   1.200 +else
   1.201 +WANT_MOZCONFIG_MK =
   1.202 +endif
   1.203 +else
   1.204 +WANT_MOZCONFIG_MK = 1
   1.205 +endif
   1.206 +
   1.207 +ifdef WANT_MOZCONFIG_MK
   1.208 +# For now, only output "export" lines from mozconfig2client-mk output.
   1.209 +MOZCONFIG_MK_LINES := $(filter export||%,$(MOZCONFIG_OUT_LINES))
   1.210 +$(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
   1.211 +	$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
   1.212 +
   1.213 +# Include that makefile so that it is created. This should not actually change
   1.214 +# the environment since MOZCONFIG_CONTENT, which MOZCONFIG_OUT_LINES derives
   1.215 +# from, has already been eval'ed.
   1.216 +include $(OBJDIR)/.mozconfig.mk
   1.217 +endif
   1.218 +
   1.219 +# Print out any options loaded from mozconfig.
   1.220 +all realbuild clean distclean export libs install realclean::
   1.221 +ifneq (,$(strip $(MOZCONFIG_OUT_FILTERED)))
   1.222 +	$(info Adding client.mk options from $(FOUND_MOZCONFIG):)
   1.223 +	$(foreach line,$(MOZCONFIG_OUT_FILTERED),$(info $(NULL) $(NULL) $(NULL) $(NULL) $(subst ||, ,$(line))))
   1.224 +endif
   1.225 +
   1.226 +# Windows equivalents
   1.227 +build_all: build
   1.228 +clobber clobber_all: clean
   1.229 +
   1.230 +# helper target for mobile
   1.231 +build_and_deploy: build package install
   1.232 +
   1.233 +# Do everything from scratch
   1.234 +everything: clean build
   1.235 +
   1.236 +####################################
   1.237 +# Profile-Guided Optimization
   1.238 +#  This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this
   1.239 +#  is usable in multi-pass builds, where you might not have a runnable
   1.240 +#  application until all the build passes and postflight scripts have run.
   1.241 +ifdef MOZ_OBJDIR
   1.242 +  PGO_OBJDIR = $(MOZ_OBJDIR)
   1.243 +else
   1.244 +  PGO_OBJDIR := $(TOPSRCDIR)
   1.245 +endif
   1.246 +
   1.247 +profiledbuild::
   1.248 +	$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1 MOZ_PGO_INSTRUMENTED=1
   1.249 +	$(MAKE) -C $(PGO_OBJDIR) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
   1.250 +	rm -f ${PGO_OBJDIR}/jarlog/en-US.log
   1.251 +	MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log EXTRA_TEST_ARGS=10 $(MAKE) -C $(PGO_OBJDIR) pgo-profile-run
   1.252 +	$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
   1.253 +	$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
   1.254 +
   1.255 +#####################################################
   1.256 +# Build date unification
   1.257 +
   1.258 +ifdef MOZ_UNIFY_BDATE
   1.259 +ifndef MOZ_BUILD_DATE
   1.260 +ifdef MOZ_BUILD_PROJECTS
   1.261 +MOZ_BUILD_DATE = $(shell $(PYTHON) $(TOPSRCDIR)/toolkit/xre/make-platformini.py --print-buildid)
   1.262 +export MOZ_BUILD_DATE
   1.263 +endif
   1.264 +endif
   1.265 +endif
   1.266 +
   1.267 +#####################################################
   1.268 +# Preflight, before building any project
   1.269 +
   1.270 +realbuild preflight_all::
   1.271 +ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_PREFLIGHT_ALL),,1))
   1.272 +# Don't run preflight_all for individual projects in multi-project builds
   1.273 +# (when MOZ_CURRENT_PROJECT is set.)
   1.274 +ifndef MOZ_BUILD_PROJECTS
   1.275 +# Building a single project, OBJDIR is usable.
   1.276 +	set -e; \
   1.277 +	for mkfile in $(MOZ_PREFLIGHT_ALL); do \
   1.278 +	  $(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
   1.279 +	done
   1.280 +else
   1.281 +# OBJDIR refers to the project-specific OBJDIR, which is not available at
   1.282 +# this point when building multiple projects.  Only MOZ_OBJDIR is available.
   1.283 +	set -e; \
   1.284 +	for mkfile in $(MOZ_PREFLIGHT_ALL); do \
   1.285 +	  $(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS='$(MOZ_BUILD_PROJECTS)'; \
   1.286 +	done
   1.287 +endif
   1.288 +endif
   1.289 +
   1.290 +# If we're building multiple projects, but haven't specified which project,
   1.291 +# loop through them.
   1.292 +
   1.293 +ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
   1.294 +configure realbuild preflight postflight $(OBJDIR_TARGETS)::
   1.295 +	set -e; \
   1.296 +	for app in $(MOZ_BUILD_PROJECTS); do \
   1.297 +	  $(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
   1.298 +	done
   1.299 +
   1.300 +else
   1.301 +
   1.302 +# MOZ_CURRENT_PROJECT: either doing a single-project build, or building an
   1.303 +# individual project in a multi-project build.
   1.304 +
   1.305 +####################################
   1.306 +# Configure
   1.307 +
   1.308 +MAKEFILE      = $(wildcard $(OBJDIR)/Makefile)
   1.309 +CONFIG_STATUS = $(wildcard $(OBJDIR)/config.status)
   1.310 +CONFIG_CACHE  = $(wildcard $(OBJDIR)/config.cache)
   1.311 +
   1.312 +EXTRA_CONFIG_DEPS := \
   1.313 +  $(TOPSRCDIR)/aclocal.m4 \
   1.314 +  $(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
   1.315 +  $(TOPSRCDIR)/js/src/aclocal.m4 \
   1.316 +  $(NULL)
   1.317 +
   1.318 +$(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
   1.319 +	@echo Generating $@ using autoconf
   1.320 +	cd $(@D); $(AUTOCONF)
   1.321 +
   1.322 +CONFIG_STATUS_DEPS := \
   1.323 +  $(wildcard $(TOPSRCDIR)/*/confvars.sh) \
   1.324 +  $(CONFIGURES) \
   1.325 +  $(TOPSRCDIR)/CLOBBER \
   1.326 +  $(TOPSRCDIR)/nsprpub/configure \
   1.327 +  $(TOPSRCDIR)/config/milestone.txt \
   1.328 +  $(TOPSRCDIR)/browser/config/version.txt \
   1.329 +  $(TOPSRCDIR)/build/virtualenv_packages.txt \
   1.330 +  $(TOPSRCDIR)/python/mozbuild/mozbuild/virtualenv.py \
   1.331 +  $(TOPSRCDIR)/testing/mozbase/packages.txt \
   1.332 +  $(NULL)
   1.333 +
   1.334 +CONFIGURE_ENV_ARGS += \
   1.335 +  MAKE='$(MAKE)' \
   1.336 +  $(NULL)
   1.337 +
   1.338 +# configure uses the program name to determine @srcdir@. Calling it without
   1.339 +#   $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
   1.340 +#   path of $(TOPSRCDIR).
   1.341 +ifeq ($(TOPSRCDIR),$(OBJDIR))
   1.342 +  CONFIGURE = ./configure
   1.343 +else
   1.344 +  CONFIGURE = $(TOPSRCDIR)/configure
   1.345 +endif
   1.346 +
   1.347 +$(OBJDIR)/CLOBBER: $(TOPSRCDIR)/CLOBBER
   1.348 +	$(PYTHON) $(TOPSRCDIR)/config/pythonpath.py -I $(TOPSRCDIR)/testing/mozbase/mozfile \
   1.349 +	    $(TOPSRCDIR)/python/mozbuild/mozbuild/controller/clobber.py $(TOPSRCDIR) $(OBJDIR)
   1.350 +
   1.351 +configure-files: $(CONFIGURES)
   1.352 +
   1.353 +configure-preqs = \
   1.354 +  $(OBJDIR)/CLOBBER \
   1.355 +  configure-files \
   1.356 +  $(call mkdir_deps,$(OBJDIR)) \
   1.357 +  $(if $(MOZ_BUILD_PROJECTS),$(call mkdir_deps,$(MOZ_OBJDIR))) \
   1.358 +  save-mozconfig \
   1.359 +  $(NULL)
   1.360 +
   1.361 +save-mozconfig: $(FOUND_MOZCONFIG)
   1.362 +	-cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig
   1.363 +
   1.364 +configure:: $(configure-preqs)
   1.365 +	@echo cd $(OBJDIR);
   1.366 +	@echo $(CONFIGURE) $(CONFIGURE_ARGS)
   1.367 +	@cd $(OBJDIR) && $(BUILD_PROJECT_ARG) $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
   1.368 +	  || ( echo '*** Fix above errors and then restart with\
   1.369 +               "$(MAKE) -f client.mk build"' && exit 1 )
   1.370 +	@touch $(OBJDIR)/Makefile
   1.371 +
   1.372 +ifneq (,$(MAKEFILE))
   1.373 +$(OBJDIR)/Makefile: $(OBJDIR)/config.status
   1.374 +
   1.375 +$(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
   1.376 +else
   1.377 +$(OBJDIR)/Makefile: $(CONFIG_STATUS_DEPS)
   1.378 +endif
   1.379 +	@$(MAKE) -f $(TOPSRCDIR)/client.mk configure
   1.380 +
   1.381 +ifneq (,$(CONFIG_STATUS))
   1.382 +$(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
   1.383 +	$(PYTHON) $(OBJDIR)/config.status -n --file=$(OBJDIR)/config/autoconf.mk
   1.384 +endif
   1.385 +
   1.386 +
   1.387 +####################################
   1.388 +# Preflight
   1.389 +
   1.390 +realbuild preflight::
   1.391 +ifdef MOZ_PREFLIGHT
   1.392 +	set -e; \
   1.393 +	for mkfile in $(MOZ_PREFLIGHT); do \
   1.394 +	  $(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
   1.395 +	done
   1.396 +endif
   1.397 +
   1.398 +####################################
   1.399 +# Build it
   1.400 +
   1.401 +realbuild::  $(OBJDIR)/Makefile $(OBJDIR)/config.status
   1.402 +	+$(MOZ_MAKE)
   1.403 +
   1.404 +####################################
   1.405 +# Other targets
   1.406 +
   1.407 +# Pass these target onto the real build system
   1.408 +$(OBJDIR_TARGETS):: $(OBJDIR)/Makefile $(OBJDIR)/config.status
   1.409 +	+$(MOZ_MAKE) $@
   1.410 +
   1.411 +####################################
   1.412 +# Postflight
   1.413 +
   1.414 +realbuild postflight::
   1.415 +ifdef MOZ_POSTFLIGHT
   1.416 +	set -e; \
   1.417 +	for mkfile in $(MOZ_POSTFLIGHT); do \
   1.418 +	  $(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
   1.419 +	done
   1.420 +endif
   1.421 +
   1.422 +endif # MOZ_CURRENT_PROJECT
   1.423 +
   1.424 +####################################
   1.425 +# Postflight, after building all projects
   1.426 +
   1.427 +realbuild postflight_all::
   1.428 +ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_POSTFLIGHT_ALL),,1))
   1.429 +# Don't run postflight_all for individual projects in multi-project builds
   1.430 +# (when MOZ_CURRENT_PROJECT is set.)
   1.431 +ifndef MOZ_BUILD_PROJECTS
   1.432 +# Building a single project, OBJDIR is usable.
   1.433 +	set -e; \
   1.434 +	for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
   1.435 +	  $(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
   1.436 +	done
   1.437 +else
   1.438 +# OBJDIR refers to the project-specific OBJDIR, which is not available at
   1.439 +# this point when building multiple projects.  Only MOZ_OBJDIR is available.
   1.440 +	set -e; \
   1.441 +	for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
   1.442 +	  $(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS='$(MOZ_BUILD_PROJECTS)'; \
   1.443 +	done
   1.444 +endif
   1.445 +endif
   1.446 +
   1.447 +cleansrcdir:
   1.448 +	@cd $(TOPSRCDIR); \
   1.449 +	if [ -f Makefile ]; then \
   1.450 +	  $(MAKE) distclean ; \
   1.451 +	else \
   1.452 +	  echo 'Removing object files from srcdir...'; \
   1.453 +	  rm -fr `find . -type d \( -name .deps -print -o -name CVS \
   1.454 +	          -o -exec test ! -d {}/CVS \; \) -prune \
   1.455 +	          -o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
   1.456 +	   build/autoconf/clean-config.sh; \
   1.457 +	fi;
   1.458 +
   1.459 +echo-variable-%:
   1.460 +	@echo $($*)
   1.461 +
   1.462 +# This makefile doesn't support parallel execution. It does pass
   1.463 +# MOZ_MAKE_FLAGS to sub-make processes, so they will correctly execute
   1.464 +# in parallel.
   1.465 +.NOTPARALLEL:
   1.466 +
   1.467 +.PHONY: checkout \
   1.468 +    real_checkout \
   1.469 +    realbuild \
   1.470 +    build \
   1.471 +    profiledbuild \
   1.472 +    cleansrcdir \
   1.473 +    pull_all \
   1.474 +    build_all \
   1.475 +    clobber \
   1.476 +    clobber_all \
   1.477 +    pull_and_build_all \
   1.478 +    everything \
   1.479 +    configure \
   1.480 +    preflight_all \
   1.481 +    preflight \
   1.482 +    postflight \
   1.483 +    postflight_all \
   1.484 +    $(OBJDIR_TARGETS)

mercurial