client.mk

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 # -*- makefile -*-
michael@0 2 # vim:set ts=8 sw=8 sts=8 noet:
michael@0 3 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 6
michael@0 7 # Build a mozilla application.
michael@0 8 #
michael@0 9 # To build a tree,
michael@0 10 # 1. hg clone ssh://hg.mozilla.org/mozilla-central mozilla
michael@0 11 # 2. cd mozilla
michael@0 12 # 3. create your .mozconfig file with
michael@0 13 # ac_add_options --enable-application=browser
michael@0 14 # 4. gmake -f client.mk
michael@0 15 #
michael@0 16 # Other targets (gmake -f client.mk [targets...]),
michael@0 17 # build
michael@0 18 # clean (realclean is now the same as clean)
michael@0 19 # distclean
michael@0 20 #
michael@0 21 # See http://developer.mozilla.org/en/docs/Build_Documentation for
michael@0 22 # more information.
michael@0 23 #
michael@0 24 # Options:
michael@0 25 # MOZ_BUILD_PROJECTS - Build multiple projects in subdirectories
michael@0 26 # of MOZ_OBJDIR
michael@0 27 # MOZ_OBJDIR - Destination object directory
michael@0 28 # MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
michael@0 29 # MOZ_PREFLIGHT_ALL } - Makefiles to run before any project in
michael@0 30 # MOZ_PREFLIGHT } MOZ_BUILD_PROJECTS, before each project, after
michael@0 31 # MOZ_POSTFLIGHT } each project, and after all projects; these
michael@0 32 # MOZ_POSTFLIGHT_ALL } variables contain space-separated lists
michael@0 33 # MOZ_UNIFY_BDATE - Set to use the same bdate for each project in
michael@0 34 # MOZ_BUILD_PROJECTS
michael@0 35 #
michael@0 36 #######################################################################
michael@0 37 # Defines
michael@0 38
michael@0 39 comma := ,
michael@0 40
michael@0 41 CWD := $(CURDIR)
michael@0 42 ifneq (1,$(words $(CWD)))
michael@0 43 $(error The mozilla directory cannot be located in a path with spaces.)
michael@0 44 endif
michael@0 45
michael@0 46 ifeq "$(CWD)" "/"
michael@0 47 CWD := /.
michael@0 48 endif
michael@0 49
michael@0 50 ifndef TOPSRCDIR
michael@0 51 ifeq (,$(wildcard client.mk))
michael@0 52 TOPSRCDIR := $(patsubst %/,%,$(dir $(MAKEFILE_LIST)))
michael@0 53 MOZ_OBJDIR = .
michael@0 54 else
michael@0 55 TOPSRCDIR := $(CWD)
michael@0 56 endif
michael@0 57 endif
michael@0 58
michael@0 59 # try to find autoconf 2.13 - discard errors from 'which'
michael@0 60 # MacOS X 10.4 sends "no autoconf*" errors to stdout, discard those via grep
michael@0 61 AUTOCONF ?= $(shell which autoconf-2.13 autoconf2.13 autoconf213 2>/dev/null | grep -v '^no autoconf' | head -1)
michael@0 62
michael@0 63 # See if the autoconf package was installed through fink
michael@0 64 ifeq (,$(strip $(AUTOCONF)))
michael@0 65 AUTOCONF = $(shell which fink >/dev/null 2>&1 && echo `which fink`/../../lib/autoconf2.13/bin/autoconf)
michael@0 66 endif
michael@0 67
michael@0 68 ifeq (,$(strip $(AUTOCONF)))
michael@0 69 AUTOCONF=$(error Could not find autoconf 2.13)
michael@0 70 endif
michael@0 71
michael@0 72 SH := /bin/sh
michael@0 73 PERL ?= perl
michael@0 74 PYTHON ?= python
michael@0 75
michael@0 76 CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
michael@0 77 ifdef CONFIG_GUESS_SCRIPT
michael@0 78 CONFIG_GUESS := $(shell $(CONFIG_GUESS_SCRIPT))
michael@0 79 endif
michael@0 80
michael@0 81
michael@0 82 ####################################
michael@0 83 # Sanity checks
michael@0 84
michael@0 85 # Windows checks.
michael@0 86 ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
michael@0 87
michael@0 88 # check for CRLF line endings
michael@0 89 ifneq (0,$(shell $(PERL) -e 'binmode(STDIN); while (<STDIN>) { if (/\r/) { print "1"; exit } } print "0"' < $(TOPSRCDIR)/client.mk))
michael@0 90 $(error This source tree appears to have Windows-style line endings. To \
michael@0 91 convert it to Unix-style line endings, check \
michael@0 92 "https://developer.mozilla.org/en-US/docs/Developer_Guide/Mozilla_build_FAQ\#Win32-specific_questions" \
michael@0 93 for a workaround of this issue.)
michael@0 94 endif
michael@0 95 endif
michael@0 96
michael@0 97 ####################################
michael@0 98 # Load mozconfig Options
michael@0 99
michael@0 100 # See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
michael@0 101
michael@0 102 MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk
michael@0 103
michael@0 104 define CR
michael@0 105
michael@0 106
michael@0 107 endef
michael@0 108
michael@0 109 # As $(shell) doesn't preserve newlines, use sed to replace them with an
michael@0 110 # unlikely sequence (||), which is then replaced back to newlines by make
michael@0 111 # before evaluation. $(shell) replacing newlines with spaces, || is always
michael@0 112 # followed by a space (since sed doesn't remove newlines), except on the
michael@0 113 # last line, so replace both '|| ' and '||'.
michael@0 114 MOZCONFIG_CONTENT := $(subst ||,$(CR),$(subst || ,$(CR),$(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) | sed 's/$$/||/')))
michael@0 115 $(eval $(MOZCONFIG_CONTENT))
michael@0 116
michael@0 117 export FOUND_MOZCONFIG
michael@0 118
michael@0 119 # As '||' was used as a newline separator, it means it's not occurring in
michael@0 120 # lines themselves. It can thus safely be used to replaces normal spaces,
michael@0 121 # to then replace newlines with normal spaces. This allows to get a list
michael@0 122 # of mozconfig output lines.
michael@0 123 MOZCONFIG_OUT_LINES := $(subst $(CR), ,$(subst $(NULL) $(NULL),||,$(MOZCONFIG_CONTENT)))
michael@0 124 # Filter-out comments from those lines.
michael@0 125 START_COMMENT = \#
michael@0 126 MOZCONFIG_OUT_FILTERED := $(filter-out $(START_COMMENT)%,$(MOZCONFIG_OUT_LINES))
michael@0 127
michael@0 128 ifdef AUTOCLOBBER
michael@0 129 export AUTOCLOBBER=1
michael@0 130 endif
michael@0 131 export MOZ_PGO
michael@0 132
michael@0 133 ifdef MOZ_PARALLEL_BUILD
michael@0 134 MOZ_MAKE_FLAGS := $(filter-out -j%,$(MOZ_MAKE_FLAGS))
michael@0 135 MOZ_MAKE_FLAGS += -j$(MOZ_PARALLEL_BUILD)
michael@0 136 endif
michael@0 137
michael@0 138 # Automatically add -jN to make flags if not defined. N defaults to number of cores.
michael@0 139 ifeq (,$(findstring -j,$(MOZ_MAKE_FLAGS)))
michael@0 140 cores=$(shell $(PYTHON) -c 'import multiprocessing; print(multiprocessing.cpu_count())')
michael@0 141 MOZ_MAKE_FLAGS += -j$(cores)
michael@0 142 endif
michael@0 143
michael@0 144
michael@0 145 ifndef MOZ_OBJDIR
michael@0 146 MOZ_OBJDIR = obj-$(CONFIG_GUESS)
michael@0 147 else
michael@0 148 # On Windows Pymake builds check MOZ_OBJDIR doesn't start with "/"
michael@0 149 ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
michael@0 150 ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(MOZ_OBJDIR))))
michael@0 151 $(error For Windows Pymake builds, MOZ_OBJDIR must be a Windows [and not MSYS] style path.)
michael@0 152 endif
michael@0 153 endif
michael@0 154 endif
michael@0 155
michael@0 156 ifdef MOZ_BUILD_PROJECTS
michael@0 157
michael@0 158 ifdef MOZ_CURRENT_PROJECT
michael@0 159 OBJDIR = $(MOZ_OBJDIR)/$(MOZ_CURRENT_PROJECT)
michael@0 160 MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
michael@0 161 BUILD_PROJECT_ARG = MOZ_BUILD_APP=$(MOZ_CURRENT_PROJECT)
michael@0 162 else
michael@0 163 OBJDIR = $(error Cannot find the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
michael@0 164 MOZ_MAKE = $(error Cannot build in the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
michael@0 165 endif
michael@0 166
michael@0 167 else # MOZ_BUILD_PROJECTS
michael@0 168
michael@0 169 OBJDIR = $(MOZ_OBJDIR)
michael@0 170 MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
michael@0 171
michael@0 172 endif # MOZ_BUILD_PROJECTS
michael@0 173
michael@0 174 # 'configure' scripts generated by autoconf.
michael@0 175 CONFIGURES := $(TOPSRCDIR)/configure
michael@0 176 CONFIGURES += $(TOPSRCDIR)/js/src/configure
michael@0 177
michael@0 178 # Make targets that are going to be passed to the real build system
michael@0 179 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
michael@0 180
michael@0 181 #######################################################################
michael@0 182 # Rules
michael@0 183
michael@0 184 # The default rule is build
michael@0 185 build::
michael@0 186 $(MAKE) -f $(TOPSRCDIR)/client.mk $(if $(MOZ_PGO),profiledbuild,realbuild)
michael@0 187
michael@0 188 # Define mkdir
michael@0 189 include $(TOPSRCDIR)/config/makefiles/makeutils.mk
michael@0 190 include $(TOPSRCDIR)/config/makefiles/autotargets.mk
michael@0 191
michael@0 192 # Create a makefile containing the mk_add_options values from mozconfig,
michael@0 193 # but only do so when OBJDIR is defined (see further above).
michael@0 194 ifdef MOZ_BUILD_PROJECTS
michael@0 195 ifdef MOZ_CURRENT_PROJECT
michael@0 196 WANT_MOZCONFIG_MK = 1
michael@0 197 else
michael@0 198 WANT_MOZCONFIG_MK =
michael@0 199 endif
michael@0 200 else
michael@0 201 WANT_MOZCONFIG_MK = 1
michael@0 202 endif
michael@0 203
michael@0 204 ifdef WANT_MOZCONFIG_MK
michael@0 205 # For now, only output "export" lines from mozconfig2client-mk output.
michael@0 206 MOZCONFIG_MK_LINES := $(filter export||%,$(MOZCONFIG_OUT_LINES))
michael@0 207 $(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
michael@0 208 $(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
michael@0 209
michael@0 210 # Include that makefile so that it is created. This should not actually change
michael@0 211 # the environment since MOZCONFIG_CONTENT, which MOZCONFIG_OUT_LINES derives
michael@0 212 # from, has already been eval'ed.
michael@0 213 include $(OBJDIR)/.mozconfig.mk
michael@0 214 endif
michael@0 215
michael@0 216 # Print out any options loaded from mozconfig.
michael@0 217 all realbuild clean distclean export libs install realclean::
michael@0 218 ifneq (,$(strip $(MOZCONFIG_OUT_FILTERED)))
michael@0 219 $(info Adding client.mk options from $(FOUND_MOZCONFIG):)
michael@0 220 $(foreach line,$(MOZCONFIG_OUT_FILTERED),$(info $(NULL) $(NULL) $(NULL) $(NULL) $(subst ||, ,$(line))))
michael@0 221 endif
michael@0 222
michael@0 223 # Windows equivalents
michael@0 224 build_all: build
michael@0 225 clobber clobber_all: clean
michael@0 226
michael@0 227 # helper target for mobile
michael@0 228 build_and_deploy: build package install
michael@0 229
michael@0 230 # Do everything from scratch
michael@0 231 everything: clean build
michael@0 232
michael@0 233 ####################################
michael@0 234 # Profile-Guided Optimization
michael@0 235 # This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this
michael@0 236 # is usable in multi-pass builds, where you might not have a runnable
michael@0 237 # application until all the build passes and postflight scripts have run.
michael@0 238 ifdef MOZ_OBJDIR
michael@0 239 PGO_OBJDIR = $(MOZ_OBJDIR)
michael@0 240 else
michael@0 241 PGO_OBJDIR := $(TOPSRCDIR)
michael@0 242 endif
michael@0 243
michael@0 244 profiledbuild::
michael@0 245 $(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1 MOZ_PGO_INSTRUMENTED=1
michael@0 246 $(MAKE) -C $(PGO_OBJDIR) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
michael@0 247 rm -f ${PGO_OBJDIR}/jarlog/en-US.log
michael@0 248 MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log EXTRA_TEST_ARGS=10 $(MAKE) -C $(PGO_OBJDIR) pgo-profile-run
michael@0 249 $(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
michael@0 250 $(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
michael@0 251
michael@0 252 #####################################################
michael@0 253 # Build date unification
michael@0 254
michael@0 255 ifdef MOZ_UNIFY_BDATE
michael@0 256 ifndef MOZ_BUILD_DATE
michael@0 257 ifdef MOZ_BUILD_PROJECTS
michael@0 258 MOZ_BUILD_DATE = $(shell $(PYTHON) $(TOPSRCDIR)/toolkit/xre/make-platformini.py --print-buildid)
michael@0 259 export MOZ_BUILD_DATE
michael@0 260 endif
michael@0 261 endif
michael@0 262 endif
michael@0 263
michael@0 264 #####################################################
michael@0 265 # Preflight, before building any project
michael@0 266
michael@0 267 realbuild preflight_all::
michael@0 268 ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_PREFLIGHT_ALL),,1))
michael@0 269 # Don't run preflight_all for individual projects in multi-project builds
michael@0 270 # (when MOZ_CURRENT_PROJECT is set.)
michael@0 271 ifndef MOZ_BUILD_PROJECTS
michael@0 272 # Building a single project, OBJDIR is usable.
michael@0 273 set -e; \
michael@0 274 for mkfile in $(MOZ_PREFLIGHT_ALL); do \
michael@0 275 $(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
michael@0 276 done
michael@0 277 else
michael@0 278 # OBJDIR refers to the project-specific OBJDIR, which is not available at
michael@0 279 # this point when building multiple projects. Only MOZ_OBJDIR is available.
michael@0 280 set -e; \
michael@0 281 for mkfile in $(MOZ_PREFLIGHT_ALL); do \
michael@0 282 $(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS='$(MOZ_BUILD_PROJECTS)'; \
michael@0 283 done
michael@0 284 endif
michael@0 285 endif
michael@0 286
michael@0 287 # If we're building multiple projects, but haven't specified which project,
michael@0 288 # loop through them.
michael@0 289
michael@0 290 ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
michael@0 291 configure realbuild preflight postflight $(OBJDIR_TARGETS)::
michael@0 292 set -e; \
michael@0 293 for app in $(MOZ_BUILD_PROJECTS); do \
michael@0 294 $(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
michael@0 295 done
michael@0 296
michael@0 297 else
michael@0 298
michael@0 299 # MOZ_CURRENT_PROJECT: either doing a single-project build, or building an
michael@0 300 # individual project in a multi-project build.
michael@0 301
michael@0 302 ####################################
michael@0 303 # Configure
michael@0 304
michael@0 305 MAKEFILE = $(wildcard $(OBJDIR)/Makefile)
michael@0 306 CONFIG_STATUS = $(wildcard $(OBJDIR)/config.status)
michael@0 307 CONFIG_CACHE = $(wildcard $(OBJDIR)/config.cache)
michael@0 308
michael@0 309 EXTRA_CONFIG_DEPS := \
michael@0 310 $(TOPSRCDIR)/aclocal.m4 \
michael@0 311 $(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
michael@0 312 $(TOPSRCDIR)/js/src/aclocal.m4 \
michael@0 313 $(NULL)
michael@0 314
michael@0 315 $(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
michael@0 316 @echo Generating $@ using autoconf
michael@0 317 cd $(@D); $(AUTOCONF)
michael@0 318
michael@0 319 CONFIG_STATUS_DEPS := \
michael@0 320 $(wildcard $(TOPSRCDIR)/*/confvars.sh) \
michael@0 321 $(CONFIGURES) \
michael@0 322 $(TOPSRCDIR)/CLOBBER \
michael@0 323 $(TOPSRCDIR)/nsprpub/configure \
michael@0 324 $(TOPSRCDIR)/config/milestone.txt \
michael@0 325 $(TOPSRCDIR)/browser/config/version.txt \
michael@0 326 $(TOPSRCDIR)/build/virtualenv_packages.txt \
michael@0 327 $(TOPSRCDIR)/python/mozbuild/mozbuild/virtualenv.py \
michael@0 328 $(TOPSRCDIR)/testing/mozbase/packages.txt \
michael@0 329 $(NULL)
michael@0 330
michael@0 331 CONFIGURE_ENV_ARGS += \
michael@0 332 MAKE='$(MAKE)' \
michael@0 333 $(NULL)
michael@0 334
michael@0 335 # configure uses the program name to determine @srcdir@. Calling it without
michael@0 336 # $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
michael@0 337 # path of $(TOPSRCDIR).
michael@0 338 ifeq ($(TOPSRCDIR),$(OBJDIR))
michael@0 339 CONFIGURE = ./configure
michael@0 340 else
michael@0 341 CONFIGURE = $(TOPSRCDIR)/configure
michael@0 342 endif
michael@0 343
michael@0 344 $(OBJDIR)/CLOBBER: $(TOPSRCDIR)/CLOBBER
michael@0 345 $(PYTHON) $(TOPSRCDIR)/config/pythonpath.py -I $(TOPSRCDIR)/testing/mozbase/mozfile \
michael@0 346 $(TOPSRCDIR)/python/mozbuild/mozbuild/controller/clobber.py $(TOPSRCDIR) $(OBJDIR)
michael@0 347
michael@0 348 configure-files: $(CONFIGURES)
michael@0 349
michael@0 350 configure-preqs = \
michael@0 351 $(OBJDIR)/CLOBBER \
michael@0 352 configure-files \
michael@0 353 $(call mkdir_deps,$(OBJDIR)) \
michael@0 354 $(if $(MOZ_BUILD_PROJECTS),$(call mkdir_deps,$(MOZ_OBJDIR))) \
michael@0 355 save-mozconfig \
michael@0 356 $(NULL)
michael@0 357
michael@0 358 save-mozconfig: $(FOUND_MOZCONFIG)
michael@0 359 -cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig
michael@0 360
michael@0 361 configure:: $(configure-preqs)
michael@0 362 @echo cd $(OBJDIR);
michael@0 363 @echo $(CONFIGURE) $(CONFIGURE_ARGS)
michael@0 364 @cd $(OBJDIR) && $(BUILD_PROJECT_ARG) $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
michael@0 365 || ( echo '*** Fix above errors and then restart with\
michael@0 366 "$(MAKE) -f client.mk build"' && exit 1 )
michael@0 367 @touch $(OBJDIR)/Makefile
michael@0 368
michael@0 369 ifneq (,$(MAKEFILE))
michael@0 370 $(OBJDIR)/Makefile: $(OBJDIR)/config.status
michael@0 371
michael@0 372 $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
michael@0 373 else
michael@0 374 $(OBJDIR)/Makefile: $(CONFIG_STATUS_DEPS)
michael@0 375 endif
michael@0 376 @$(MAKE) -f $(TOPSRCDIR)/client.mk configure
michael@0 377
michael@0 378 ifneq (,$(CONFIG_STATUS))
michael@0 379 $(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
michael@0 380 $(PYTHON) $(OBJDIR)/config.status -n --file=$(OBJDIR)/config/autoconf.mk
michael@0 381 endif
michael@0 382
michael@0 383
michael@0 384 ####################################
michael@0 385 # Preflight
michael@0 386
michael@0 387 realbuild preflight::
michael@0 388 ifdef MOZ_PREFLIGHT
michael@0 389 set -e; \
michael@0 390 for mkfile in $(MOZ_PREFLIGHT); do \
michael@0 391 $(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
michael@0 392 done
michael@0 393 endif
michael@0 394
michael@0 395 ####################################
michael@0 396 # Build it
michael@0 397
michael@0 398 realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
michael@0 399 +$(MOZ_MAKE)
michael@0 400
michael@0 401 ####################################
michael@0 402 # Other targets
michael@0 403
michael@0 404 # Pass these target onto the real build system
michael@0 405 $(OBJDIR_TARGETS):: $(OBJDIR)/Makefile $(OBJDIR)/config.status
michael@0 406 +$(MOZ_MAKE) $@
michael@0 407
michael@0 408 ####################################
michael@0 409 # Postflight
michael@0 410
michael@0 411 realbuild postflight::
michael@0 412 ifdef MOZ_POSTFLIGHT
michael@0 413 set -e; \
michael@0 414 for mkfile in $(MOZ_POSTFLIGHT); do \
michael@0 415 $(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
michael@0 416 done
michael@0 417 endif
michael@0 418
michael@0 419 endif # MOZ_CURRENT_PROJECT
michael@0 420
michael@0 421 ####################################
michael@0 422 # Postflight, after building all projects
michael@0 423
michael@0 424 realbuild postflight_all::
michael@0 425 ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_POSTFLIGHT_ALL),,1))
michael@0 426 # Don't run postflight_all for individual projects in multi-project builds
michael@0 427 # (when MOZ_CURRENT_PROJECT is set.)
michael@0 428 ifndef MOZ_BUILD_PROJECTS
michael@0 429 # Building a single project, OBJDIR is usable.
michael@0 430 set -e; \
michael@0 431 for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
michael@0 432 $(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
michael@0 433 done
michael@0 434 else
michael@0 435 # OBJDIR refers to the project-specific OBJDIR, which is not available at
michael@0 436 # this point when building multiple projects. Only MOZ_OBJDIR is available.
michael@0 437 set -e; \
michael@0 438 for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
michael@0 439 $(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS='$(MOZ_BUILD_PROJECTS)'; \
michael@0 440 done
michael@0 441 endif
michael@0 442 endif
michael@0 443
michael@0 444 cleansrcdir:
michael@0 445 @cd $(TOPSRCDIR); \
michael@0 446 if [ -f Makefile ]; then \
michael@0 447 $(MAKE) distclean ; \
michael@0 448 else \
michael@0 449 echo 'Removing object files from srcdir...'; \
michael@0 450 rm -fr `find . -type d \( -name .deps -print -o -name CVS \
michael@0 451 -o -exec test ! -d {}/CVS \; \) -prune \
michael@0 452 -o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
michael@0 453 build/autoconf/clean-config.sh; \
michael@0 454 fi;
michael@0 455
michael@0 456 echo-variable-%:
michael@0 457 @echo $($*)
michael@0 458
michael@0 459 # This makefile doesn't support parallel execution. It does pass
michael@0 460 # MOZ_MAKE_FLAGS to sub-make processes, so they will correctly execute
michael@0 461 # in parallel.
michael@0 462 .NOTPARALLEL:
michael@0 463
michael@0 464 .PHONY: checkout \
michael@0 465 real_checkout \
michael@0 466 realbuild \
michael@0 467 build \
michael@0 468 profiledbuild \
michael@0 469 cleansrcdir \
michael@0 470 pull_all \
michael@0 471 build_all \
michael@0 472 clobber \
michael@0 473 clobber_all \
michael@0 474 pull_and_build_all \
michael@0 475 everything \
michael@0 476 configure \
michael@0 477 preflight_all \
michael@0 478 preflight \
michael@0 479 postflight \
michael@0 480 postflight_all \
michael@0 481 $(OBJDIR_TARGETS)

mercurial