config/rules.mk

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/config/rules.mk	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,1668 @@
     1.4 +# -*- makefile -*-
     1.5 +# vim:set ts=8 sw=8 sts=8 noet:
     1.6 +#
     1.7 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.8 +# License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.9 +# You can obtain one at http://mozilla.org/MPL/2.0/.
    1.10 +#
    1.11 +
    1.12 +ifndef topsrcdir
    1.13 +$(error topsrcdir was not set))
    1.14 +endif
    1.15 +
    1.16 +# Define an include-at-most-once flag
    1.17 +ifdef INCLUDED_RULES_MK
    1.18 +$(error Do not include rules.mk twice!)
    1.19 +endif
    1.20 +INCLUDED_RULES_MK = 1
    1.21 +
    1.22 +# Make sure that anything that needs to be defined in moz.build wasn't
    1.23 +# overwritten.
    1.24 +_eval_for_side_effects := $(CHECK_MOZBUILD_VARIABLES)
    1.25 +
    1.26 +ifndef MOZILLA_DIR
    1.27 +MOZILLA_DIR = $(topsrcdir)
    1.28 +endif
    1.29 +
    1.30 +ifndef INCLUDED_CONFIG_MK
    1.31 +include $(topsrcdir)/config/config.mk
    1.32 +endif
    1.33 +
    1.34 +ifndef INCLUDED_VERSION_MK
    1.35 +include $(topsrcdir)/config/version.mk
    1.36 +endif
    1.37 +
    1.38 +USE_AUTOTARGETS_MK = 1
    1.39 +include $(topsrcdir)/config/makefiles/makeutils.mk
    1.40 +
    1.41 +# Only build with Pymake (not GNU make) on Windows.
    1.42 +ifeq ($(HOST_OS_ARCH),WINNT)
    1.43 +ifndef L10NBASEDIR
    1.44 +ifndef .PYMAKE
    1.45 +$(error Pymake is required to build on Windows. Run |./mach build| to \
    1.46 +automatically use pymake or invoke pymake directly via \
    1.47 +|python build/pymake/make.py|.)
    1.48 +endif
    1.49 +endif
    1.50 +endif
    1.51 +
    1.52 +ifdef REBUILD_CHECK
    1.53 +ifdef .PYMAKE
    1.54 +REPORT_BUILD = @%rebuild_check rebuild_check $@ $^
    1.55 +else
    1.56 +REPORT_BUILD = $(info $(shell $(PYTHON) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^))
    1.57 +endif
    1.58 +else
    1.59 +REPORT_BUILD = $(info $(notdir $@))
    1.60 +endif
    1.61 +
    1.62 +EXEC			= exec
    1.63 +
    1.64 +# Don't copy xulrunner files at install time, when using system xulrunner
    1.65 +ifdef SYSTEM_LIBXUL
    1.66 +  SKIP_COPY_XULRUNNER=1
    1.67 +endif
    1.68 +
    1.69 +# ELOG prints out failed command when building silently (gmake -s). Pymake
    1.70 +# prints out failed commands anyway, so ELOG just makes things worse by
    1.71 +# forcing shell invocations.
    1.72 +ifndef .PYMAKE
    1.73 +ifneq (,$(findstring s, $(filter-out --%, $(MAKEFLAGS))))
    1.74 +  ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh
    1.75 +else
    1.76 +  ELOG :=
    1.77 +endif # -s
    1.78 +else
    1.79 +  ELOG :=
    1.80 +endif # ifndef .PYMAKE
    1.81 +
    1.82 +_VPATH_SRCS = $(abspath $<)
    1.83 +
    1.84 +################################################################################
    1.85 +# Testing frameworks support
    1.86 +################################################################################
    1.87 +
    1.88 +testxpcobjdir = $(DEPTH)/_tests/xpcshell
    1.89 +
    1.90 +ifdef ENABLE_TESTS
    1.91 +
    1.92 +# Add test directories to the regular directories list. TEST_DIRS should
    1.93 +# arguably have the same status as TOOL_DIRS and other *_DIRS variables. It is
    1.94 +# coded this way until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +="
    1.95 +# convention.
    1.96 +#
    1.97 +# The current developer workflow expects tests to be updated when processing
    1.98 +# the default target. If we ever change this implementation, the behavior
    1.99 +# should be preserved or the change should be widely communicated. A
   1.100 +# consequence of not processing test dir targets during the default target is
   1.101 +# that changes to tests may not be updated and code could assume to pass
   1.102 +# locally against non-current test code.
   1.103 +DIRS += $(TEST_DIRS)
   1.104 +
   1.105 +ifdef CPP_UNIT_TESTS
   1.106 +ifdef COMPILE_ENVIRONMENT
   1.107 +
   1.108 +# Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
   1.109 +# through TestHarness.h, by modifying the list of includes and the libs against
   1.110 +# which stuff links.
   1.111 +CPPSRCS += $(CPP_UNIT_TESTS)
   1.112 +CPP_UNIT_TEST_BINS := $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
   1.113 +SIMPLE_PROGRAMS += $(CPP_UNIT_TEST_BINS)
   1.114 +INCLUDES += -I$(DIST)/include/testing
   1.115 +LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
   1.116 +
   1.117 +ifndef MOZ_PROFILE_GENERATE
   1.118 +libs:: $(CPP_UNIT_TEST_BINS) $(call mkdir_deps,$(DIST)/cppunittests)
   1.119 +	$(NSINSTALL) $(CPP_UNIT_TEST_BINS) $(DIST)/cppunittests
   1.120 +endif
   1.121 +
   1.122 +run-cppunittests::
   1.123 +	@$(PYTHON) $(topsrcdir)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS))
   1.124 +
   1.125 +cppunittests-remote: DM_TRANS?=adb
   1.126 +cppunittests-remote:
   1.127 +	@if [ '${TEST_DEVICE}' != '' -o '$(DM_TRANS)' = 'adb' ]; then \
   1.128 +		$(PYTHON) -u $(topsrcdir)/testing/remotecppunittests.py \
   1.129 +			--xre-path=$(DEPTH)/dist/bin \
   1.130 +			--localLib=$(DEPTH)/dist/$(MOZ_APP_NAME) \
   1.131 +			--dm_trans=$(DM_TRANS) \
   1.132 +			--deviceIP=${TEST_DEVICE} \
   1.133 +			$(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS)) $(EXTRA_TEST_ARGS); \
   1.134 +	else \
   1.135 +		echo 'please prepare your host with environment variables for TEST_DEVICE'; \
   1.136 +	fi
   1.137 +
   1.138 +endif # COMPILE_ENVIRONMENT
   1.139 +endif # CPP_UNIT_TESTS
   1.140 +
   1.141 +.PHONY: check
   1.142 +
   1.143 +ifdef PYTHON_UNIT_TESTS
   1.144 +
   1.145 +RUN_PYTHON_UNIT_TESTS := $(addsuffix -run,$(PYTHON_UNIT_TESTS))
   1.146 +
   1.147 +.PHONY: $(RUN_PYTHON_UNIT_TESTS)
   1.148 +
   1.149 +check:: $(RUN_PYTHON_UNIT_TESTS)
   1.150 +
   1.151 +$(RUN_PYTHON_UNIT_TESTS): %-run: %
   1.152 +	@PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $<
   1.153 +
   1.154 +endif # PYTHON_UNIT_TESTS
   1.155 +
   1.156 +endif # ENABLE_TESTS
   1.157 +
   1.158 +
   1.159 +#
   1.160 +# Library rules
   1.161 +#
   1.162 +# If FORCE_STATIC_LIB is set, build a static library.
   1.163 +# Otherwise, build a shared library.
   1.164 +#
   1.165 +
   1.166 +ifndef LIBRARY
   1.167 +ifdef STATIC_LIBRARY_NAME
   1.168 +REAL_LIBRARY		:= $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
   1.169 +# Only build actual library if it is installed in DIST/lib or SDK
   1.170 +ifeq (,$(SDK_LIBRARY)$(DIST_INSTALL)$(NO_EXPAND_LIBS))
   1.171 +LIBRARY			:= $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
   1.172 +else
   1.173 +LIBRARY			:= $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
   1.174 +endif
   1.175 +endif # STATIC_LIBRARY_NAME
   1.176 +endif # LIBRARY
   1.177 +
   1.178 +ifndef HOST_LIBRARY
   1.179 +ifdef HOST_LIBRARY_NAME
   1.180 +HOST_LIBRARY		:= $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
   1.181 +endif
   1.182 +endif
   1.183 +
   1.184 +ifdef LIBRARY
   1.185 +ifdef FORCE_SHARED_LIB
   1.186 +ifdef MKSHLIB
   1.187 +
   1.188 +ifdef LIB_IS_C_ONLY
   1.189 +MKSHLIB			= $(MKCSHLIB)
   1.190 +endif
   1.191 +
   1.192 +ifneq (,$(filter WINNT,$(OS_ARCH)))
   1.193 +IMPORT_LIBRARY		:= $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
   1.194 +endif
   1.195 +
   1.196 +ifdef MAKE_FRAMEWORK
   1.197 +SHARED_LIBRARY		:= $(SHARED_LIBRARY_NAME)
   1.198 +else
   1.199 +SHARED_LIBRARY		:= $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
   1.200 +endif
   1.201 +
   1.202 +EMBED_MANIFEST_AT=2
   1.203 +
   1.204 +endif # MKSHLIB
   1.205 +endif # FORCE_SHARED_LIB
   1.206 +endif # LIBRARY
   1.207 +
   1.208 +ifdef FORCE_STATIC_LIB
   1.209 +ifndef FORCE_SHARED_LIB
   1.210 +SHARED_LIBRARY		:= $(NULL)
   1.211 +DEF_FILE		:= $(NULL)
   1.212 +IMPORT_LIBRARY		:= $(NULL)
   1.213 +endif
   1.214 +endif
   1.215 +
   1.216 +ifdef FORCE_SHARED_LIB
   1.217 +ifndef FORCE_STATIC_LIB
   1.218 +LIBRARY := $(NULL)
   1.219 +endif
   1.220 +endif
   1.221 +
   1.222 +ifeq ($(OS_ARCH),WINNT)
   1.223 +ifndef GNU_CC
   1.224 +
   1.225 +#
   1.226 +# Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
   1.227 +# directory. For parallel builds, this PDB file is shared and locked by
   1.228 +# MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
   1.229 +# without SP1, don't do parallel builds.
   1.230 +#
   1.231 +# The final PDB for libraries and programs is created by the linker and uses
   1.232 +# a different name from the single PDB file created by the compiler. See
   1.233 +# bug 462740.
   1.234 +#
   1.235 +
   1.236 +ifdef SIMPLE_PROGRAMS
   1.237 +COMPILE_PDB_FLAG ?= -Fd$(basename $(@F)).pdb
   1.238 +else
   1.239 +COMPILE_PDB_FLAG ?= -Fdgenerated.pdb
   1.240 +endif
   1.241 +COMPILE_CFLAGS += $(COMPILE_PDB_FLAG)
   1.242 +COMPILE_CXXFLAGS += $(COMPILE_PDB_FLAG)
   1.243 +
   1.244 +LINK_PDBFILE ?= $(basename $(@F)).pdb
   1.245 +ifdef MOZ_DEBUG
   1.246 +CODFILE=$(basename $(@F)).cod
   1.247 +endif
   1.248 +
   1.249 +ifdef DEFFILE
   1.250 +OS_LDFLAGS += -DEF:$(call normalizepath,$(DEFFILE))
   1.251 +EXTRA_DEPS += $(DEFFILE)
   1.252 +endif
   1.253 +
   1.254 +else #!GNU_CC
   1.255 +
   1.256 +ifdef DEFFILE
   1.257 +OS_LDFLAGS += $(call normalizepath,$(DEFFILE))
   1.258 +EXTRA_DEPS += $(DEFFILE)
   1.259 +endif
   1.260 +
   1.261 +endif # !GNU_CC
   1.262 +
   1.263 +endif # WINNT
   1.264 +
   1.265 +ifeq ($(SOLARIS_SUNPRO_CXX),1)
   1.266 +ifeq (86,$(findstring 86,$(OS_TEST)))
   1.267 +OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
   1.268 +endif # x86
   1.269 +endif # Solaris Sun Studio C++
   1.270 +
   1.271 +ifeq ($(HOST_OS_ARCH),WINNT)
   1.272 +HOST_PDBFILE=$(basename $(@F)).pdb
   1.273 +HOST_PDB_FLAG ?= -Fd$(HOST_PDBFILE)
   1.274 +HOST_CFLAGS += $(HOST_PDB_FLAG)
   1.275 +HOST_CXXFLAGS += $(HOST_PDB_FLAG)
   1.276 +endif
   1.277 +
   1.278 +# Don't build SIMPLE_PROGRAMS during the MOZ_PROFILE_GENERATE pass
   1.279 +ifdef MOZ_PROFILE_GENERATE
   1.280 +EXCLUDED_OBJS := $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX))
   1.281 +SIMPLE_PROGRAMS :=
   1.282 +endif
   1.283 +
   1.284 +ifdef COMPILE_ENVIRONMENT
   1.285 +ifndef TARGETS
   1.286 +TARGETS			= $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS)
   1.287 +endif
   1.288 +
   1.289 +COBJS = $(notdir $(CSRCS:.c=.$(OBJ_SUFFIX)))
   1.290 +SOBJS = $(notdir $(SSRCS:.S=.$(OBJ_SUFFIX)))
   1.291 +# CPPSRCS can have different extensions (eg: .cpp, .cc)
   1.292 +CPPOBJS = $(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(CPPSRCS))))
   1.293 +CMOBJS = $(notdir $(CMSRCS:.m=.$(OBJ_SUFFIX)))
   1.294 +CMMOBJS = $(notdir $(CMMSRCS:.mm=.$(OBJ_SUFFIX)))
   1.295 +ASOBJS = $(notdir $(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)))
   1.296 +ifndef OBJS
   1.297 +_OBJS = $(COBJS) $(SOBJS) $(CPPOBJS) $(CMOBJS) $(CMMOBJS) $(ASOBJS)
   1.298 +OBJS = $(strip $(_OBJS))
   1.299 +endif
   1.300 +
   1.301 +HOST_COBJS = $(addprefix host_,$(notdir $(HOST_CSRCS:.c=.$(OBJ_SUFFIX))))
   1.302 +# HOST_CPPOBJS can have different extensions (eg: .cpp, .cc)
   1.303 +HOST_CPPOBJS = $(addprefix host_,$(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(HOST_CPPSRCS)))))
   1.304 +HOST_CMOBJS = $(addprefix host_,$(notdir $(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))))
   1.305 +HOST_CMMOBJS = $(addprefix host_,$(notdir $(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX))))
   1.306 +ifndef HOST_OBJS
   1.307 +_HOST_OBJS = $(HOST_COBJS) $(HOST_CPPOBJS) $(HOST_CMOBJS) $(HOST_CMMOBJS)
   1.308 +HOST_OBJS = $(strip $(_HOST_OBJS))
   1.309 +endif
   1.310 +else
   1.311 +LIBRARY :=
   1.312 +SHARED_LIBRARY :=
   1.313 +IMPORT_LIBRARY :=
   1.314 +REAL_LIBRARY :=
   1.315 +PROGRAM :=
   1.316 +SIMPLE_PROGRAMS :=
   1.317 +HOST_LIBRARY :=
   1.318 +HOST_PROGRAM :=
   1.319 +HOST_SIMPLE_PROGRAMS :=
   1.320 +SDK_BINARY := $(filter %.py,$(SDK_BINARY))
   1.321 +SDK_LIBRARY :=
   1.322 +endif
   1.323 +
   1.324 +ALL_TRASH = \
   1.325 +	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
   1.326 +	$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
   1.327 +	$(OBJS:.$(OBJ_SUFFIX)=.i) $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
   1.328 +	$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
   1.329 +	$(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
   1.330 +	$(wildcard *.pdb) $(CODFILE) $(IMPORT_LIBRARY) \
   1.331 +	$(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
   1.332 +	$(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
   1.333 +	$(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
   1.334 +	$(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) \
   1.335 +	$(wildcard gts_tmp_*) $(LIBRARY:%.a=.%.timestamp)
   1.336 +ALL_TRASH_DIRS = \
   1.337 +	$(GARBAGE_DIRS) /no-such-file
   1.338 +
   1.339 +ifdef QTDIR
   1.340 +GARBAGE                 += $(MOCSRCS)
   1.341 +endif
   1.342 +
   1.343 +ifdef SIMPLE_PROGRAMS
   1.344 +GARBAGE			+= $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
   1.345 +endif
   1.346 +
   1.347 +ifdef HOST_SIMPLE_PROGRAMS
   1.348 +GARBAGE			+= $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
   1.349 +endif
   1.350 +
   1.351 +#
   1.352 +# the Solaris WorkShop template repository cache.  it occasionally can get
   1.353 +# out of sync, so targets like clobber should kill it.
   1.354 +#
   1.355 +ifeq ($(SOLARIS_SUNPRO_CXX),1)
   1.356 +GARBAGE_DIRS += SunWS_cache
   1.357 +endif
   1.358 +
   1.359 +ifdef MOZ_UPDATE_XTERM
   1.360 +# Its good not to have a newline at the end of the titlebar string because it
   1.361 +# makes the make -s output easier to read.  Echo -n does not work on all
   1.362 +# platforms, but we can trick printf into doing it.
   1.363 +UPDATE_TITLE = printf '\033]0;%s in %s\007' $(1) $(relativesrcdir)/$(2) ;
   1.364 +endif
   1.365 +
   1.366 +ifdef MACH
   1.367 +ifndef NO_BUILDSTATUS_MESSAGES
   1.368 +define BUILDSTATUS
   1.369 +@echo 'BUILDSTATUS $1'
   1.370 +
   1.371 +endef
   1.372 +endif
   1.373 +endif
   1.374 +
   1.375 +define SUBMAKE # $(call SUBMAKE,target,directory,static)
   1.376 ++@$(UPDATE_TITLE)
   1.377 ++$(MAKE) $(if $(2),-C $(2)) $(1)
   1.378 +
   1.379 +endef # The extra line is important here! don't delete it
   1.380 +
   1.381 +define TIER_DIR_SUBMAKE
   1.382 +$(call SUBMAKE,$(4),$(3),$(5))
   1.383 +
   1.384 +endef # Ths empty line is important.
   1.385 +
   1.386 +ifneq (,$(strip $(DIRS)))
   1.387 +LOOP_OVER_DIRS = \
   1.388 +  $(foreach dir,$(DIRS),$(call SUBMAKE,$@,$(dir)))
   1.389 +endif
   1.390 +
   1.391 +# we only use this for the makefiles target and other stuff that doesn't matter
   1.392 +ifneq (,$(strip $(PARALLEL_DIRS)))
   1.393 +LOOP_OVER_PARALLEL_DIRS = \
   1.394 +  $(foreach dir,$(PARALLEL_DIRS),$(call SUBMAKE,$@,$(dir)))
   1.395 +endif
   1.396 +
   1.397 +ifneq (,$(strip $(TOOL_DIRS)))
   1.398 +LOOP_OVER_TOOL_DIRS = \
   1.399 +  $(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,$@,$(dir)))
   1.400 +endif
   1.401 +
   1.402 +#
   1.403 +# Now we can differentiate between objects used to build a library, and
   1.404 +# objects used to build an executable in the same directory.
   1.405 +#
   1.406 +ifndef PROGOBJS
   1.407 +PROGOBJS		= $(OBJS)
   1.408 +endif
   1.409 +
   1.410 +ifndef HOST_PROGOBJS
   1.411 +HOST_PROGOBJS		= $(HOST_OBJS)
   1.412 +endif
   1.413 +
   1.414 +GARBAGE_DIRS    += $(wildcard $(CURDIR)/$(MDDEPDIR))
   1.415 +
   1.416 +#
   1.417 +# Tags: emacs (etags), vi (ctags)
   1.418 +# TAG_PROGRAM := ctags -L -
   1.419 +#
   1.420 +TAG_PROGRAM		= xargs etags -a
   1.421 +
   1.422 +#
   1.423 +# Turn on C++ linking if we have any .cpp or .mm files
   1.424 +# (moved this from config.mk so that config.mk can be included
   1.425 +#  before the CPPSRCS are defined)
   1.426 +#
   1.427 +ifneq ($(HOST_CPPSRCS)$(HOST_CMMSRCS),)
   1.428 +HOST_CPP_PROG_LINK	= 1
   1.429 +endif
   1.430 +
   1.431 +#
   1.432 +# This will strip out symbols that the component should not be
   1.433 +# exporting from the .dynsym section.
   1.434 +#
   1.435 +ifdef IS_COMPONENT
   1.436 +EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
   1.437 +endif # IS_COMPONENT
   1.438 +
   1.439 +#
   1.440 +# MacOS X specific stuff
   1.441 +#
   1.442 +
   1.443 +ifeq ($(OS_ARCH),Darwin)
   1.444 +ifdef SHARED_LIBRARY
   1.445 +ifdef IS_COMPONENT
   1.446 +EXTRA_DSO_LDOPTS	+= -bundle
   1.447 +else
   1.448 +EXTRA_DSO_LDOPTS	+= -dynamiclib -install_name @executable_path/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
   1.449 +endif
   1.450 +endif
   1.451 +endif
   1.452 +
   1.453 +#
   1.454 +# On NetBSD a.out systems, use -Bsymbolic.  This fixes what would otherwise be
   1.455 +# fatal symbol name clashes between components.
   1.456 +#
   1.457 +ifeq ($(OS_ARCH),NetBSD)
   1.458 +ifeq ($(DLL_SUFFIX),.so.1.0)
   1.459 +ifdef IS_COMPONENT
   1.460 +EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
   1.461 +endif
   1.462 +endif
   1.463 +endif
   1.464 +
   1.465 +ifeq ($(OS_ARCH),FreeBSD)
   1.466 +ifdef IS_COMPONENT
   1.467 +EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
   1.468 +endif
   1.469 +endif
   1.470 +
   1.471 +ifeq ($(OS_ARCH),NetBSD)
   1.472 +ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips,$(OS_TEST)))
   1.473 +ifneq (,$(filter layout/%,$(relativesrcdir)))
   1.474 +OS_CFLAGS += -Wa,-xgot
   1.475 +OS_CXXFLAGS += -Wa,-xgot
   1.476 +endif
   1.477 +endif
   1.478 +endif
   1.479 +
   1.480 +#
   1.481 +# HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
   1.482 +# which uses internal symbols first
   1.483 +#
   1.484 +ifeq ($(OS_ARCH),HP-UX)
   1.485 +ifdef IS_COMPONENT
   1.486 +ifeq ($(GNU_CC)$(GNU_CXX),)
   1.487 +EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
   1.488 +ifneq ($(HAS_EXTRAEXPORTS),1)
   1.489 +MKSHLIB  += -Wl,+eNSGetModule -Wl,+eerrno
   1.490 +MKCSHLIB += +eNSGetModule +eerrno
   1.491 +ifneq ($(OS_TEST),ia64)
   1.492 +MKSHLIB  += -Wl,+e_shlInit
   1.493 +MKCSHLIB += +e_shlInit
   1.494 +endif # !ia64
   1.495 +endif # !HAS_EXTRAEXPORTS
   1.496 +endif # non-gnu compilers
   1.497 +endif # IS_COMPONENT
   1.498 +endif # HP-UX
   1.499 +
   1.500 +ifeq ($(OS_ARCH),AIX)
   1.501 +ifdef IS_COMPONENT
   1.502 +ifneq ($(HAS_EXTRAEXPORTS),1)
   1.503 +MKSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
   1.504 +MKCSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
   1.505 +endif # HAS_EXTRAEXPORTS
   1.506 +endif # IS_COMPONENT
   1.507 +endif # AIX
   1.508 +
   1.509 +#
   1.510 +# Linux: add -Bsymbolic flag for components
   1.511 +#
   1.512 +ifeq ($(OS_ARCH),Linux)
   1.513 +ifdef IS_COMPONENT
   1.514 +EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
   1.515 +endif
   1.516 +endif
   1.517 +
   1.518 +#
   1.519 +# GNU doesn't have path length limitation
   1.520 +#
   1.521 +
   1.522 +ifeq ($(OS_ARCH),GNU)
   1.523 +OS_CPPFLAGS += -DPATH_MAX=1024 -DMAXPATHLEN=1024
   1.524 +endif
   1.525 +
   1.526 +ifeq ($(OS_ARCH),WINNT)
   1.527 +ifdef USE_DELAYIMP
   1.528 +OS_LIBS += $(call EXPAND_LIBNAME,delayimp)
   1.529 +endif
   1.530 +endif
   1.531 +
   1.532 +#
   1.533 +# MINGW32
   1.534 +#
   1.535 +ifeq ($(OS_ARCH),WINNT)
   1.536 +ifdef GNU_CC
   1.537 +ifndef IS_COMPONENT
   1.538 +DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
   1.539 +endif
   1.540 +endif
   1.541 +endif
   1.542 +
   1.543 +ifeq ($(USE_TVFS),1)
   1.544 +IFLAGS1 = -rb
   1.545 +IFLAGS2 = -rb
   1.546 +else
   1.547 +IFLAGS1 = -m 644
   1.548 +IFLAGS2 = -m 755
   1.549 +endif
   1.550 +
   1.551 +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
   1.552 +OUTOPTION = -Fo# eol
   1.553 +PREPROCESS_OPTION = -P -Fi# eol
   1.554 +else
   1.555 +OUTOPTION = -o # eol
   1.556 +PREPROCESS_OPTION = -E -o #eol
   1.557 +endif # WINNT && !GNU_CC
   1.558 +
   1.559 +ifneq (,$(filter ml%,$(AS)))
   1.560 +ASOUTOPTION = -Fo# eol
   1.561 +else
   1.562 +ASOUTOPTION = -o # eol
   1.563 +endif
   1.564 +
   1.565 +ifeq (,$(CROSS_COMPILE))
   1.566 +HOST_OUTOPTION = $(OUTOPTION)
   1.567 +else
   1.568 +HOST_OUTOPTION = -o # eol
   1.569 +endif
   1.570 +################################################################################
   1.571 +
   1.572 +# Ensure the build config is up to date. This is done automatically when builds
   1.573 +# are performed through |mach build|. The check here is to catch people not
   1.574 +# using mach. If we ever enforce builds through mach, this code can be removed.
   1.575 +ifndef MOZBUILD_BACKEND_CHECKED
   1.576 +ifndef MACH
   1.577 +ifndef TOPLEVEL_BUILD
   1.578 +$(DEPTH)/backend.RecursiveMakeBackend:
   1.579 +	$(error Build configuration changed. Build with |mach build| or run |mach build-backend| to regenerate build config)
   1.580 +
   1.581 +include $(DEPTH)/backend.RecursiveMakeBackend.pp
   1.582 +
   1.583 +default:: $(DEPTH)/backend.RecursiveMakeBackend
   1.584 +
   1.585 +export MOZBUILD_BACKEND_CHECKED=1
   1.586 +endif
   1.587 +endif
   1.588 +endif
   1.589 +
   1.590 +# The root makefile doesn't want to do a plain export/libs, because
   1.591 +# of the tiers and because of libxul. Suppress the default rules in favor
   1.592 +# of something else. Makefiles which use this var *must* provide a sensible
   1.593 +# default rule before including rules.mk
   1.594 +default all::
   1.595 +	$(MAKE) export
   1.596 +ifdef MOZ_PSEUDO_DERECURSE
   1.597 +ifdef COMPILE_ENVIRONMENT
   1.598 +	$(MAKE) compile
   1.599 +endif
   1.600 +endif
   1.601 +	$(MAKE) libs
   1.602 +	$(MAKE) tools
   1.603 +
   1.604 +ifeq ($(findstring s,$(filter-out --%, $(MAKEFLAGS))),)
   1.605 +ECHO := echo
   1.606 +QUIET :=
   1.607 +else
   1.608 +ECHO := true
   1.609 +QUIET := -q
   1.610 +endif
   1.611 +
   1.612 +# Do everything from scratch
   1.613 +everything::
   1.614 +	$(MAKE) clean
   1.615 +	$(MAKE) all
   1.616 +
   1.617 +ifneq (,$(filter-out %.$(LIB_SUFFIX),$(SHARED_LIBRARY_LIBS)))
   1.618 +$(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only)
   1.619 +endif
   1.620 +
   1.621 +HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
   1.622 +
   1.623 +# Dependencies which, if modified, should cause everything to rebuild
   1.624 +GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
   1.625 +
   1.626 +##############################################
   1.627 +ifdef COMPILE_ENVIRONMENT
   1.628 +OBJ_TARGETS = $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS)
   1.629 +
   1.630 +compile:: $(OBJ_TARGETS)
   1.631 +
   1.632 +include $(topsrcdir)/config/makefiles/target_binaries.mk
   1.633 +endif
   1.634 +
   1.635 +ifdef IS_TOOL_DIR
   1.636 +# One would think "tools:: libs" would work, but it turns out that combined with
   1.637 +# bug 907365, this makes make forget to run some rules sometimes.
   1.638 +tools::
   1.639 +	@$(MAKE) libs
   1.640 +endif
   1.641 +
   1.642 +##############################################
   1.643 +ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE))
   1.644 +ifdef MOZ_PROFILE_USE
   1.645 +ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
   1.646 +# When building with PGO, we have to make sure to re-link
   1.647 +# in the MOZ_PROFILE_USE phase if we linked in the
   1.648 +# MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
   1.649 +# file in the link rule in the GENERATE phase to indicate
   1.650 +# that we need a relink.
   1.651 +ifdef SHARED_LIBRARY
   1.652 +$(SHARED_LIBRARY): pgo.relink
   1.653 +endif
   1.654 +ifdef PROGRAM
   1.655 +$(PROGRAM): pgo.relink
   1.656 +endif
   1.657 +
   1.658 +# In the second pass, we need to merge the pgc files into the pgd file.
   1.659 +# The compiler would do this for us automatically if they were in the right
   1.660 +# place, but they're in dist/bin.
   1.661 +ifneq (,$(SHARED_LIBRARY)$(PROGRAM))
   1.662 +export::
   1.663 +ifdef PROGRAM
   1.664 +	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
   1.665 +	  $(PROGRAM:$(BIN_SUFFIX)=) $(DIST)/bin
   1.666 +endif
   1.667 +ifdef SHARED_LIBRARY
   1.668 +	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
   1.669 +	  $(SHARED_LIBRARY_NAME) $(DIST)/bin
   1.670 +endif
   1.671 +endif # SHARED_LIBRARY || PROGRAM
   1.672 +endif # WINNT_
   1.673 +endif # MOZ_PROFILE_USE
   1.674 +ifdef MOZ_PROFILE_GENERATE
   1.675 +# Clean up profiling data during PROFILE_GENERATE phase
   1.676 +export::
   1.677 +ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
   1.678 +	$(foreach pgd,$(wildcard *.pgd),pgomgr -clear $(pgd);)
   1.679 +else
   1.680 +ifdef GNU_CC
   1.681 +	-$(RM) *.gcda
   1.682 +endif
   1.683 +endif
   1.684 +endif
   1.685 +
   1.686 +ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
   1.687 +ifdef GNU_CC
   1.688 +# Force rebuilding libraries and programs in both passes because each
   1.689 +# pass uses different object files.
   1.690 +$(PROGRAM) $(SHARED_LIBRARY) $(LIBRARY): FORCE
   1.691 +endif
   1.692 +endif
   1.693 +
   1.694 +endif # NO_PROFILE_GUIDED_OPTIMIZE
   1.695 +
   1.696 +##############################################
   1.697 +
   1.698 +checkout:
   1.699 +	$(MAKE) -C $(topsrcdir) -f client.mk checkout
   1.700 +
   1.701 +clean clobber realclean clobber_all::
   1.702 +	-$(RM) $(ALL_TRASH)
   1.703 +	-$(RM) -r $(ALL_TRASH_DIRS)
   1.704 +
   1.705 +ifdef TIERS
   1.706 +clean clobber realclean clobber_all distclean::
   1.707 +	$(foreach dir, \
   1.708 +		$(foreach tier, $(TIERS), $(tier_$(tier)_staticdirs) $(tier_$(tier)_dirs)), \
   1.709 +		-$(call SUBMAKE,$@,$(dir)))
   1.710 +else
   1.711 +clean clobber realclean clobber_all distclean::
   1.712 +	$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
   1.713 +endif
   1.714 +
   1.715 +distclean::
   1.716 +	-$(RM) -r $(ALL_TRASH_DIRS)
   1.717 +	-$(RM) $(ALL_TRASH)  \
   1.718 +	Makefile .HSancillary \
   1.719 +	$(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
   1.720 +	$(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
   1.721 +	$(wildcard *.$(IMPORT_LIB_SUFFIX))
   1.722 +
   1.723 +alltags:
   1.724 +	$(RM) TAGS
   1.725 +	find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
   1.726 +
   1.727 +#
   1.728 +# PROGRAM = Foo
   1.729 +# creates OBJS, links with LIBS to create Foo
   1.730 +#
   1.731 +$(PROGRAM): $(PROGOBJS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
   1.732 +	$(REPORT_BUILD)
   1.733 +	@$(RM) $@.manifest
   1.734 +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
   1.735 +	$(EXPAND_LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
   1.736 +ifdef MSMANIFEST_TOOL
   1.737 +	@if test -f $@.manifest; then \
   1.738 +		if test -f '$(srcdir)/$@.manifest'; then \
   1.739 +			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
   1.740 +			mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
   1.741 +		else \
   1.742 +			echo 'Embedding manifest from $@.manifest'; \
   1.743 +			mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
   1.744 +		fi; \
   1.745 +	elif test -f '$(srcdir)/$@.manifest'; then \
   1.746 +		echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
   1.747 +		mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
   1.748 +	fi
   1.749 +endif	# MSVC with manifest tool
   1.750 +ifdef MOZ_PROFILE_GENERATE
   1.751 +# touch it a few seconds into the future to work around FAT's
   1.752 +# 2-second granularity
   1.753 +	touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
   1.754 +endif
   1.755 +else # !WINNT || GNU_CC
   1.756 +	$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE) $(STLPORT_LIBS)
   1.757 +	$(call CHECK_BINARY,$@)
   1.758 +endif # WINNT && !GNU_CC
   1.759 +
   1.760 +ifdef ENABLE_STRIP
   1.761 +	$(STRIP) $(STRIP_FLAGS) $@
   1.762 +endif
   1.763 +ifdef MOZ_POST_PROGRAM_COMMAND
   1.764 +	$(MOZ_POST_PROGRAM_COMMAND) $@
   1.765 +endif
   1.766 +
   1.767 +$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
   1.768 +	$(REPORT_BUILD)
   1.769 +ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
   1.770 +	$(EXPAND_LIBS_EXEC) -- $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
   1.771 +ifdef MSMANIFEST_TOOL
   1.772 +	@if test -f $@.manifest; then \
   1.773 +		if test -f '$(srcdir)/$@.manifest'; then \
   1.774 +			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
   1.775 +			mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
   1.776 +		else \
   1.777 +			echo 'Embedding manifest from $@.manifest'; \
   1.778 +			mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
   1.779 +		fi; \
   1.780 +	elif test -f '$(srcdir)/$@.manifest'; then \
   1.781 +		echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
   1.782 +		mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
   1.783 +	fi
   1.784 +endif	# MSVC with manifest tool
   1.785 +else
   1.786 +ifeq ($(HOST_CPP_PROG_LINK),1)
   1.787 +	$(EXPAND_LIBS_EXEC) -- $(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
   1.788 +else
   1.789 +	$(EXPAND_LIBS_EXEC) -- $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
   1.790 +endif # HOST_CPP_PROG_LINK
   1.791 +endif
   1.792 +
   1.793 +#
   1.794 +# This is an attempt to support generation of multiple binaries
   1.795 +# in one directory, it assumes everything to compile Foo is in
   1.796 +# Foo.o (from either Foo.c or Foo.cpp).
   1.797 +#
   1.798 +# SIMPLE_PROGRAMS = Foo Bar
   1.799 +# creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
   1.800 +#
   1.801 +$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(EXTRA_DEPS) $(GLOBAL_DEPS)
   1.802 +	$(REPORT_BUILD)
   1.803 +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
   1.804 +	$(EXPAND_LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
   1.805 +ifdef MSMANIFEST_TOOL
   1.806 +	@if test -f $@.manifest; then \
   1.807 +		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
   1.808 +		rm -f $@.manifest; \
   1.809 +	fi
   1.810 +endif	# MSVC with manifest tool
   1.811 +else
   1.812 +	$(EXPAND_CCC) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(STLPORT_LIBS)
   1.813 +	$(call CHECK_BINARY,$@)
   1.814 +endif # WINNT && !GNU_CC
   1.815 +
   1.816 +ifdef ENABLE_STRIP
   1.817 +	$(STRIP) $(STRIP_FLAGS) $@
   1.818 +endif
   1.819 +ifdef MOZ_POST_PROGRAM_COMMAND
   1.820 +	$(MOZ_POST_PROGRAM_COMMAND) $@
   1.821 +endif
   1.822 +
   1.823 +$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
   1.824 +	$(REPORT_BUILD)
   1.825 +ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
   1.826 +	$(EXPAND_LIBS_EXEC) -- $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
   1.827 +else
   1.828 +ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
   1.829 +	$(EXPAND_LIBS_EXEC) -- $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
   1.830 +else
   1.831 +	$(EXPAND_LIBS_EXEC) -- $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
   1.832 +endif
   1.833 +endif
   1.834 +
   1.835 +ifdef DTRACE_PROBE_OBJ
   1.836 +EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
   1.837 +OBJS += $(DTRACE_PROBE_OBJ)
   1.838 +endif
   1.839 +
   1.840 +$(filter %.$(LIB_SUFFIX),$(LIBRARY)): $(OBJS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
   1.841 +	$(REPORT_BUILD)
   1.842 +	$(RM) $(LIBRARY)
   1.843 +	$(EXPAND_AR) $(AR_FLAGS) $(OBJS) $(SHARED_LIBRARY_LIBS)
   1.844 +
   1.845 +$(filter-out %.$(LIB_SUFFIX),$(LIBRARY)): $(filter %.$(LIB_SUFFIX),$(LIBRARY)) $(OBJS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
   1.846 +# When we only build a library descriptor, blow out any existing library
   1.847 +	$(REPORT_BUILD)
   1.848 +	$(if $(filter %.$(LIB_SUFFIX),$(LIBRARY)),,$(RM) $(REAL_LIBRARY) $(EXPORT_LIBRARY:%=%/$(REAL_LIBRARY)))
   1.849 +	$(EXPAND_LIBS_GEN) -o $@ $(OBJS) $(SHARED_LIBRARY_LIBS)
   1.850 +
   1.851 +ifeq ($(OS_ARCH),WINNT)
   1.852 +# Import libraries are created by the rules creating shared libraries.
   1.853 +# The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
   1.854 +# but make will happily consider the import library before it is refreshed
   1.855 +# when rebuilding the corresponding shared library. Defining an empty recipe
   1.856 +# for import libraries forces make to wait for the shared library recipe to
   1.857 +# have run before considering other targets that depend on the import library.
   1.858 +# See bug 795204.
   1.859 +$(IMPORT_LIBRARY): $(SHARED_LIBRARY) ;
   1.860 +endif
   1.861 +
   1.862 +$(HOST_LIBRARY): $(HOST_OBJS) Makefile
   1.863 +	$(REPORT_BUILD)
   1.864 +	$(RM) $@
   1.865 +	$(EXPAND_LIBS_EXEC) --extract -- $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
   1.866 +
   1.867 +ifdef HAVE_DTRACE
   1.868 +ifndef XP_MACOSX
   1.869 +ifdef DTRACE_PROBE_OBJ
   1.870 +ifndef DTRACE_LIB_DEPENDENT
   1.871 +NON_DTRACE_OBJS := $(filter-out $(DTRACE_PROBE_OBJ),$(OBJS))
   1.872 +$(DTRACE_PROBE_OBJ): $(NON_DTRACE_OBJS)
   1.873 +	dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(NON_DTRACE_OBJS)
   1.874 +endif
   1.875 +endif
   1.876 +endif
   1.877 +endif
   1.878 +
   1.879 +# On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
   1.880 +# so instead of deleting .o files after repacking them into a dylib, we make
   1.881 +# symlinks back to the originals. The symlinks are a no-op for stabs debugging,
   1.882 +# so no need to conditionalize on OS version or debugging format.
   1.883 +
   1.884 +$(SHARED_LIBRARY): $(OBJS) $(DEF_FILE) $(RESFILE) $(LIBRARY) $(EXTRA_DEPS) $(GLOBAL_DEPS)
   1.885 +	$(REPORT_BUILD)
   1.886 +ifndef INCREMENTAL_LINKER
   1.887 +	$(RM) $@
   1.888 +endif
   1.889 +ifdef DTRACE_LIB_DEPENDENT
   1.890 +ifndef XP_MACOSX
   1.891 +	dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o  $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
   1.892 +endif
   1.893 +	$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
   1.894 +	@$(RM) $(DTRACE_PROBE_OBJ)
   1.895 +else # ! DTRACE_LIB_DEPENDENT
   1.896 +	$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(WRAP_LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) $(if $(LIB_IS_C_ONLY),,$(STLPORT_LIBS))
   1.897 +endif # DTRACE_LIB_DEPENDENT
   1.898 +	$(call CHECK_BINARY,$@)
   1.899 +
   1.900 +ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
   1.901 +ifdef MSMANIFEST_TOOL
   1.902 +ifdef EMBED_MANIFEST_AT
   1.903 +	@if test -f $@.manifest; then \
   1.904 +		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
   1.905 +		rm -f $@.manifest; \
   1.906 +	fi
   1.907 +endif   # EMBED_MANIFEST_AT
   1.908 +endif	# MSVC with manifest tool
   1.909 +ifdef MOZ_PROFILE_GENERATE
   1.910 +	touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
   1.911 +endif
   1.912 +endif	# WINNT && !GCC
   1.913 +	@$(RM) foodummyfilefoo $(DELETE_AFTER_LINK)
   1.914 +	chmod +x $@
   1.915 +ifdef ENABLE_STRIP
   1.916 +	$(STRIP) $(STRIP_FLAGS) $@
   1.917 +endif
   1.918 +ifdef MOZ_POST_DSO_LIB_COMMAND
   1.919 +	$(MOZ_POST_DSO_LIB_COMMAND) $@
   1.920 +endif
   1.921 +
   1.922 +ifeq ($(SOLARIS_SUNPRO_CC),1)
   1.923 +_MDDEPFILE = $(MDDEPDIR)/$(@F).pp
   1.924 +
   1.925 +define MAKE_DEPS_AUTO_CC
   1.926 +if test -d $(@D); then \
   1.927 +	echo 'Building deps for $< using Sun Studio cc'; \
   1.928 +	$(CC) $(COMPILE_CFLAGS) -xM  $< >$(_MDDEPFILE) ; \
   1.929 +	$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
   1.930 +fi
   1.931 +endef
   1.932 +define MAKE_DEPS_AUTO_CXX
   1.933 +if test -d $(@D); then \
   1.934 +	echo 'Building deps for $< using Sun Studio CC'; \
   1.935 +	$(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
   1.936 +	$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
   1.937 +fi
   1.938 +endef
   1.939 +endif # Sun Studio on Solaris
   1.940 +
   1.941 +# The object file is in the current directory, and the source file can be any
   1.942 +# relative path. This macro adds the dependency obj: src for each source file.
   1.943 +# This dependency must be first for the $< flag to work correctly, and the
   1.944 +# rules that have commands for these targets must not list any other
   1.945 +# prerequisites, or they will override the $< variable.
   1.946 +define src_objdep
   1.947 +$(basename $2$(notdir $1)).$(OBJ_SUFFIX): $1 $$(call mkdir_deps,$$(MDDEPDIR))
   1.948 +endef
   1.949 +$(foreach f,$(CSRCS) $(SSRCS) $(CPPSRCS) $(CMSRCS) $(CMMSRCS) $(ASFILES),$(eval $(call src_objdep,$(f))))
   1.950 +$(foreach f,$(HOST_CSRCS) $(HOST_CPPSRCS) $(HOST_CMSRCS) $(HOST_CMMSRCS),$(eval $(call src_objdep,$(f),host_)))
   1.951 +
   1.952 +$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
   1.953 +
   1.954 +# Rules for building native targets must come first because of the host_ prefix
   1.955 +$(HOST_COBJS):
   1.956 +	$(REPORT_BUILD)
   1.957 +	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
   1.958 +
   1.959 +$(HOST_CPPOBJS):
   1.960 +	$(REPORT_BUILD)
   1.961 +	$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
   1.962 +
   1.963 +$(HOST_CMOBJS):
   1.964 +	$(REPORT_BUILD)
   1.965 +	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
   1.966 +
   1.967 +$(HOST_CMMOBJS):
   1.968 +	$(REPORT_BUILD)
   1.969 +	$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
   1.970 +
   1.971 +$(COBJS):
   1.972 +	$(REPORT_BUILD)
   1.973 +	@$(MAKE_DEPS_AUTO_CC)
   1.974 +	$(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
   1.975 +
   1.976 +# DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
   1.977 +# 'moc' only knows about #defines it gets on the command line (-D...), not in
   1.978 +# included headers like mozilla-config.h
   1.979 +$(filter moc_%.cpp,$(CPPSRCS)): moc_%.cpp: %.h
   1.980 +	$(REPORT_BUILD)
   1.981 +	$(ELOG) $(MOC) $(DEFINES) $(ACDEFINES) $< $(OUTOPTION)$@
   1.982 +
   1.983 +$(filter moc_%.cc,$(CPPSRCS)): moc_%.cc: %.cc
   1.984 +	$(REPORT_BUILD)
   1.985 +	$(ELOG) $(MOC) $(DEFINES) $(ACDEFINES) $(_VPATH_SRCS:.cc=.h) $(OUTOPTION)$@
   1.986 +
   1.987 +$(filter qrc_%.cpp,$(CPPSRCS)): qrc_%.cpp: %.qrc
   1.988 +	$(REPORT_BUILD)
   1.989 +	$(ELOG) $(RCC) -name $* $< $(OUTOPTION)$@
   1.990 +
   1.991 +ifdef ASFILES
   1.992 +# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
   1.993 +# a '-c' flag.
   1.994 +$(ASOBJS):
   1.995 +	$(REPORT_BUILD)
   1.996 +	$(AS) $(ASOUTOPTION)$@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
   1.997 +endif
   1.998 +
   1.999 +$(SOBJS):
  1.1000 +	$(REPORT_BUILD)
  1.1001 +	$(AS) -o $@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(LOCAL_INCLUDES) $(TARGET_LOCAL_INCLUDES) -c $<
  1.1002 +
  1.1003 +$(CPPOBJS):
  1.1004 +	$(REPORT_BUILD)
  1.1005 +	@$(MAKE_DEPS_AUTO_CXX)
  1.1006 +	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1007 +
  1.1008 +$(CMMOBJS):
  1.1009 +	$(REPORT_BUILD)
  1.1010 +	@$(MAKE_DEPS_AUTO_CXX)
  1.1011 +	$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1012 +
  1.1013 +$(CMOBJS):
  1.1014 +	$(REPORT_BUILD)
  1.1015 +	@$(MAKE_DEPS_AUTO_CC)
  1.1016 +	$(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1017 +
  1.1018 +$(filter %.s,$(CPPSRCS:%.cpp=%.s)): %.s: %.cpp $(call mkdir_deps,$(MDDEPDIR))
  1.1019 +	$(REPORT_BUILD)
  1.1020 +	$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1021 +
  1.1022 +$(filter %.s,$(CPPSRCS:%.cc=%.s)): %.s: %.cc $(call mkdir_deps,$(MDDEPDIR))
  1.1023 +	$(REPORT_BUILD)
  1.1024 +	$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1025 +
  1.1026 +$(filter %.s,$(CSRCS:%.c=%.s)): %.s: %.c $(call mkdir_deps,$(MDDEPDIR))
  1.1027 +	$(REPORT_BUILD)
  1.1028 +	$(CC) -S $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1029 +
  1.1030 +$(filter %.i,$(CPPSRCS:%.cpp=%.i)): %.i: %.cpp $(call mkdir_deps,$(MDDEPDIR))
  1.1031 +	$(REPORT_BUILD)
  1.1032 +	$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1033 +
  1.1034 +$(filter %.i,$(CPPSRCS:%.cc=%.i)): %.i: %.cc $(call mkdir_deps,$(MDDEPDIR))
  1.1035 +	$(REPORT_BUILD)
  1.1036 +	$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1037 +
  1.1038 +$(filter %.i,$(CSRCS:%.c=%.i)): %.i: %.c $(call mkdir_deps,$(MDDEPDIR))
  1.1039 +	$(REPORT_BUILD)
  1.1040 +	$(CC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1041 +
  1.1042 +$(filter %.i,$(CMMSRCS:%.mm=%.i)): %.i: %.mm $(call mkdir_deps,$(MDDEPDIR))
  1.1043 +	$(REPORT_BUILD)
  1.1044 +	$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
  1.1045 +
  1.1046 +$(RESFILE): %.res: %.rc
  1.1047 +	$(REPORT_BUILD)
  1.1048 +	@echo Creating Resource file: $@
  1.1049 +ifdef GNU_CC
  1.1050 +	$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
  1.1051 +else
  1.1052 +	$(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
  1.1053 +endif
  1.1054 +
  1.1055 +# Cancel GNU make built-in implicit rules
  1.1056 +ifndef .PYMAKE
  1.1057 +MAKEFLAGS += -r
  1.1058 +endif
  1.1059 +
  1.1060 +ifneq (,$(filter WINNT,$(OS_ARCH)))
  1.1061 +SEP := ;
  1.1062 +else
  1.1063 +SEP := :
  1.1064 +endif
  1.1065 +
  1.1066 +EMPTY :=
  1.1067 +SPACE := $(EMPTY) $(EMPTY)
  1.1068 +
  1.1069 +# MSYS has its own special path form, but javac expects the source and class
  1.1070 +# paths to be in the DOS form (i.e. e:/builds/...).  This function does the
  1.1071 +# appropriate conversion on Windows, but is a noop on other systems.
  1.1072 +ifeq ($(HOST_OS_ARCH),WINNT)
  1.1073 +#  We use 'pwd -W' to get DOS form of the path.  However, since the given path
  1.1074 +#  could be a file or a non-existent path, we cannot call 'pwd -W' directly
  1.1075 +#  on the path.  Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
  1.1076 +#  on it, then merge with the rest of the path.
  1.1077 +root-path = $(shell echo $(1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\1|')
  1.1078 +non-root-path = $(shell echo $(1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\2|')
  1.1079 +normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(patsubst %/,%,$(shell cd $(call root-path,$(1)) && pwd -W))/$(call non-root-path,$(1)),$(1)))
  1.1080 +else
  1.1081 +normalizepath = $(1)
  1.1082 +endif
  1.1083 +
  1.1084 +###############################################################################
  1.1085 +# Java rules
  1.1086 +###############################################################################
  1.1087 +ifneq (,$(JAVAFILES)$(ANDROID_RESFILES)$(ANDROID_APKNAME)$(JAVA_JAR_TARGETS))
  1.1088 +  include $(topsrcdir)/config/makefiles/java-build.mk
  1.1089 +endif
  1.1090 +
  1.1091 +###############################################################################
  1.1092 +# Bunch of things that extend the 'export' rule (in order):
  1.1093 +###############################################################################
  1.1094 +
  1.1095 +ifneq ($(XPI_NAME),)
  1.1096 +$(FINAL_TARGET):
  1.1097 +	$(NSINSTALL) -D $@
  1.1098 +
  1.1099 +export:: $(FINAL_TARGET)
  1.1100 +endif
  1.1101 +
  1.1102 +################################################################################
  1.1103 +# Copy each element of PREF_JS_EXPORTS
  1.1104 +
  1.1105 +# The default location for PREF_JS_EXPORTS is the gre prefs directory.
  1.1106 +PREF_DIR = defaults/pref
  1.1107 +
  1.1108 +# If DIST_SUBDIR is defined it indicates that app and gre dirs are
  1.1109 +# different and that we are building app related resources. Hence,
  1.1110 +# PREF_DIR should point to the app prefs location.
  1.1111 +ifneq (,$(DIST_SUBDIR)$(XPI_NAME)$(LIBXUL_SDK))
  1.1112 +PREF_DIR = defaults/preferences
  1.1113 +endif
  1.1114 +
  1.1115 +# on win32, pref files need CRLF line endings... see bug 206029
  1.1116 +ifeq (WINNT,$(OS_ARCH))
  1.1117 +PREF_PPFLAGS += --line-endings=crlf
  1.1118 +endif
  1.1119 +
  1.1120 +ifneq ($(PREF_JS_EXPORTS),)
  1.1121 +ifndef NO_DIST_INSTALL
  1.1122 +PREF_JS_EXPORTS_PATH := $(FINAL_TARGET)/$(PREF_DIR)
  1.1123 +PREF_JS_EXPORTS_FLAGS := $(PREF_PPFLAGS)
  1.1124 +PP_TARGETS += PREF_JS_EXPORTS
  1.1125 +endif
  1.1126 +endif
  1.1127 +
  1.1128 +################################################################################
  1.1129 +# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
  1.1130 +
  1.1131 +ifneq ($(AUTOCFG_JS_EXPORTS),)
  1.1132 +ifndef NO_DIST_INSTALL
  1.1133 +AUTOCFG_JS_EXPORTS_FILES := $(AUTOCFG_JS_EXPORTS)
  1.1134 +AUTOCFG_JS_EXPORTS_DEST := $(FINAL_TARGET)/defaults/autoconfig
  1.1135 +AUTOCFG_JS_EXPORTS_TARGET := export
  1.1136 +INSTALL_TARGETS += AUTOCFG_JS_EXPORTS
  1.1137 +endif
  1.1138 +endif
  1.1139 +
  1.1140 +################################################################################
  1.1141 +# Install a linked .xpt into the appropriate place.
  1.1142 +# This should ideally be performed by the non-recursive idl make file. Some day.
  1.1143 +ifdef XPT_NAME #{
  1.1144 +
  1.1145 +ifndef NO_DIST_INSTALL
  1.1146 +_XPT_NAME_FILES := $(DEPTH)/config/makefiles/xpidl/xpt/$(XPT_NAME)
  1.1147 +_XPT_NAME_DEST := $(FINAL_TARGET)/components
  1.1148 +INSTALL_TARGETS += _XPT_NAME
  1.1149 +
  1.1150 +ifndef NO_INTERFACES_MANIFEST
  1.1151 +libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
  1.1152 +	$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest 'interfaces $(XPT_NAME)')
  1.1153 +	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/interfaces.manifest')
  1.1154 +endif
  1.1155 +endif
  1.1156 +
  1.1157 +endif #} XPT_NAME
  1.1158 +
  1.1159 +################################################################################
  1.1160 +# Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
  1.1161 +ifneq (,$(filter %.js,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
  1.1162 +ifeq (,$(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
  1.1163 +ifndef NO_JS_MANIFEST
  1.1164 +$(error .js component without matching .manifest. See https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0)
  1.1165 +endif
  1.1166 +endif
  1.1167 +endif
  1.1168 +
  1.1169 +ifdef EXTRA_COMPONENTS
  1.1170 +libs:: $(EXTRA_COMPONENTS)
  1.1171 +ifndef NO_DIST_INSTALL
  1.1172 +EXTRA_COMPONENTS_FILES := $(EXTRA_COMPONENTS)
  1.1173 +EXTRA_COMPONENTS_DEST := $(FINAL_TARGET)/components
  1.1174 +INSTALL_TARGETS += EXTRA_COMPONENTS
  1.1175 +endif
  1.1176 +
  1.1177 +endif
  1.1178 +
  1.1179 +ifdef EXTRA_PP_COMPONENTS
  1.1180 +ifndef NO_DIST_INSTALL
  1.1181 +EXTRA_PP_COMPONENTS_PATH := $(FINAL_TARGET)/components
  1.1182 +PP_TARGETS += EXTRA_PP_COMPONENTS
  1.1183 +endif
  1.1184 +endif
  1.1185 +
  1.1186 +EXTRA_MANIFESTS = $(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS))
  1.1187 +ifneq (,$(EXTRA_MANIFESTS))
  1.1188 +libs:: $(call mkdir_deps,$(FINAL_TARGET))
  1.1189 +	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest $(patsubst %,'manifest components/%',$(notdir $(EXTRA_MANIFESTS))))
  1.1190 +endif
  1.1191 +
  1.1192 +################################################################################
  1.1193 +# Copy each element of EXTRA_JS_MODULES to
  1.1194 +# $(FINAL_TARGET)/$(JS_MODULES_PATH). JS_MODULES_PATH defaults to "modules"
  1.1195 +# if it is undefined.
  1.1196 +JS_MODULES_PATH ?= modules
  1.1197 +FINAL_JS_MODULES_PATH := $(FINAL_TARGET)/$(JS_MODULES_PATH)
  1.1198 +
  1.1199 +ifdef EXTRA_JS_MODULES
  1.1200 +ifndef NO_DIST_INSTALL
  1.1201 +EXTRA_JS_MODULES_FILES := $(EXTRA_JS_MODULES)
  1.1202 +EXTRA_JS_MODULES_DEST := $(FINAL_JS_MODULES_PATH)
  1.1203 +INSTALL_TARGETS += EXTRA_JS_MODULES
  1.1204 +endif
  1.1205 +endif
  1.1206 +
  1.1207 +ifdef EXTRA_PP_JS_MODULES
  1.1208 +ifndef NO_DIST_INSTALL
  1.1209 +EXTRA_PP_JS_MODULES_PATH := $(FINAL_JS_MODULES_PATH)
  1.1210 +PP_TARGETS += EXTRA_PP_JS_MODULES
  1.1211 +endif
  1.1212 +endif
  1.1213 +
  1.1214 +################################################################################
  1.1215 +# Copy testing-only JS modules to appropriate destination.
  1.1216 +#
  1.1217 +# For each file defined in TESTING_JS_MODULES, copy it to
  1.1218 +# objdir/_tests/modules/. If TESTING_JS_MODULE_DIR is defined, that path
  1.1219 +# wlll be appended to the output directory.
  1.1220 +
  1.1221 +ifdef ENABLE_TESTS
  1.1222 +ifdef TESTING_JS_MODULES
  1.1223 +testmodulesdir = $(DEPTH)/_tests/modules/$(TESTING_JS_MODULE_DIR)
  1.1224 +
  1.1225 +GENERATED_DIRS += $(testmodulesdir)
  1.1226 +
  1.1227 +ifndef NO_DIST_INSTALL
  1.1228 +TESTING_JS_MODULES_FILES := $(TESTING_JS_MODULES)
  1.1229 +TESTING_JS_MODULES_DEST := $(testmodulesdir)
  1.1230 +INSTALL_TARGETS += TESTING_JS_MODULES
  1.1231 +endif
  1.1232 +
  1.1233 +endif
  1.1234 +endif
  1.1235 +
  1.1236 +################################################################################
  1.1237 +# SDK
  1.1238 +
  1.1239 +ifneq (,$(SDK_LIBRARY))
  1.1240 +ifndef NO_DIST_INSTALL
  1.1241 +SDK_LIBRARY_FILES := $(SDK_LIBRARY)
  1.1242 +SDK_LIBRARY_DEST := $(SDK_LIB_DIR)
  1.1243 +INSTALL_TARGETS += SDK_LIBRARY
  1.1244 +endif
  1.1245 +endif # SDK_LIBRARY
  1.1246 +
  1.1247 +ifneq (,$(strip $(SDK_BINARY)))
  1.1248 +ifndef NO_DIST_INSTALL
  1.1249 +SDK_BINARY_FILES := $(SDK_BINARY)
  1.1250 +SDK_BINARY_DEST := $(SDK_BIN_DIR)
  1.1251 +INSTALL_TARGETS += SDK_BINARY
  1.1252 +endif
  1.1253 +endif # SDK_BINARY
  1.1254 +
  1.1255 +################################################################################
  1.1256 +# CHROME PACKAGING
  1.1257 +
  1.1258 +chrome::
  1.1259 +	$(MAKE) realchrome
  1.1260 +	$(LOOP_OVER_PARALLEL_DIRS)
  1.1261 +	$(LOOP_OVER_DIRS)
  1.1262 +	$(LOOP_OVER_TOOL_DIRS)
  1.1263 +
  1.1264 +$(FINAL_TARGET)/chrome: $(call mkdir_deps,$(FINAL_TARGET)/chrome)
  1.1265 +
  1.1266 +ifneq (,$(JAR_MANIFEST))
  1.1267 +ifndef NO_DIST_INSTALL
  1.1268 +
  1.1269 +ifdef XPI_NAME
  1.1270 +ifdef XPI_ROOT_APPID
  1.1271 +# For add-on packaging we may specify that an application
  1.1272 +# sub-dir should be added to the root chrome manifest with
  1.1273 +# a specific application id.
  1.1274 +MAKE_JARS_FLAGS += --root-manifest-entry-appid='$(XPI_ROOT_APPID)'
  1.1275 +endif
  1.1276 +
  1.1277 +# if DIST_SUBDIR is defined but XPI_ROOT_APPID is not there's
  1.1278 +# no way langpacks will get packaged right, so error out.
  1.1279 +ifneq (,$(DIST_SUBDIR))
  1.1280 +ifndef XPI_ROOT_APPID
  1.1281 +$(error XPI_ROOT_APPID is not defined - langpacks will break.)
  1.1282 +endif
  1.1283 +endif
  1.1284 +endif
  1.1285 +
  1.1286 +libs realchrome:: $(FINAL_TARGET)/chrome
  1.1287 +	$(call py_action,jar_maker,\
  1.1288 +	  $(QUIET) -j $(FINAL_TARGET)/chrome \
  1.1289 +	  $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
  1.1290 +	  $(JAR_MANIFEST))
  1.1291 +
  1.1292 +endif
  1.1293 +
  1.1294 +# This is a temporary check to ensure patches relying on the old behavior
  1.1295 +# of silently picking up jar.mn files continue to work.
  1.1296 +else # No JAR_MANIFEST
  1.1297 +ifneq (,$(wildcard $(srcdir)/jar.mn))
  1.1298 +$(error $(srcdir) contains a jar.mn file but this file is not declared in a JAR_MANIFESTS variable in a moz.build file)
  1.1299 +endif
  1.1300 +endif
  1.1301 +
  1.1302 +ifneq ($(DIST_FILES),)
  1.1303 +DIST_FILES_PATH := $(FINAL_TARGET)
  1.1304 +DIST_FILES_FLAGS := $(XULAPP_DEFINES)
  1.1305 +PP_TARGETS += DIST_FILES
  1.1306 +endif
  1.1307 +
  1.1308 +ifneq ($(DIST_CHROME_FILES),)
  1.1309 +DIST_CHROME_FILES_PATH := $(FINAL_TARGET)/chrome
  1.1310 +DIST_CHROME_FILES_FLAGS := $(XULAPP_DEFINES)
  1.1311 +PP_TARGETS += DIST_CHROME_FILES
  1.1312 +endif
  1.1313 +
  1.1314 +ifneq ($(XPI_PKGNAME),)
  1.1315 +tools realchrome::
  1.1316 +ifdef STRIP_XPI
  1.1317 +ifndef MOZ_DEBUG
  1.1318 +	@echo 'Stripping $(XPI_PKGNAME) package directory...'
  1.1319 +	@echo $(FINAL_TARGET)
  1.1320 +	@cd $(FINAL_TARGET) && find . ! -type d \
  1.1321 +			! -name '*.js' \
  1.1322 +			! -name '*.xpt' \
  1.1323 +			! -name '*.gif' \
  1.1324 +			! -name '*.jpg' \
  1.1325 +			! -name '*.png' \
  1.1326 +			! -name '*.xpm' \
  1.1327 +			! -name '*.txt' \
  1.1328 +			! -name '*.rdf' \
  1.1329 +			! -name '*.sh' \
  1.1330 +			! -name '*.properties' \
  1.1331 +			! -name '*.dtd' \
  1.1332 +			! -name '*.html' \
  1.1333 +			! -name '*.xul' \
  1.1334 +			! -name '*.css' \
  1.1335 +			! -name '*.xml' \
  1.1336 +			! -name '*.jar' \
  1.1337 +			! -name '*.dat' \
  1.1338 +			! -name '*.tbl' \
  1.1339 +			! -name '*.src' \
  1.1340 +			! -name '*.reg' \
  1.1341 +			$(PLATFORM_EXCLUDE_LIST) \
  1.1342 +			-exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
  1.1343 +endif
  1.1344 +endif
  1.1345 +	@echo 'Packaging $(XPI_PKGNAME).xpi...'
  1.1346 +	cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
  1.1347 +endif
  1.1348 +
  1.1349 +ifdef INSTALL_EXTENSION_ID
  1.1350 +ifndef XPI_NAME
  1.1351 +$(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
  1.1352 +endif
  1.1353 +
  1.1354 +tools::
  1.1355 +	$(RM) -r '$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
  1.1356 +	$(NSINSTALL) -D '$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
  1.1357 +	$(call copy_dir,$(FINAL_TARGET),$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID))
  1.1358 +
  1.1359 +endif
  1.1360 +
  1.1361 +#############################################################################
  1.1362 +# MDDEPDIR is the subdirectory where all the dependency files are placed.
  1.1363 +#   This uses a make rule (instead of a macro) to support parallel
  1.1364 +#   builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
  1.1365 +#   processes could simultaneously try to create the same directory.
  1.1366 +#
  1.1367 +#   We use $(CURDIR) in the rule's target to ensure that we don't find
  1.1368 +#   a dependency directory in the source tree via VPATH (perhaps from
  1.1369 +#   a previous build in the source tree) and thus neglect to create a
  1.1370 +#   dependency directory in the object directory, where we really need
  1.1371 +#   it.
  1.1372 +
  1.1373 +ifneq (,$(filter-out all chrome default export realchrome clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
  1.1374 +MDDEPEND_FILES		:= $(strip $(wildcard $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES) $(addsuffix .pp,$(notdir $(sort $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS))) $(TARGETS)))))
  1.1375 +
  1.1376 +ifneq (,$(MDDEPEND_FILES))
  1.1377 +$(call include_deps,$(MDDEPEND_FILES))
  1.1378 +endif
  1.1379 +
  1.1380 +endif
  1.1381 +
  1.1382 +
  1.1383 +ifneq (,$(filter export,$(MAKECMDGOALS)))
  1.1384 +MDDEPEND_FILES		:= $(strip $(wildcard $(addprefix $(MDDEPDIR)/,$(EXTRA_EXPORT_MDDEPEND_FILES))))
  1.1385 +
  1.1386 +ifneq (,$(MDDEPEND_FILES))
  1.1387 +$(call include_deps,$(MDDEPEND_FILES))
  1.1388 +endif
  1.1389 +
  1.1390 +endif
  1.1391 +
  1.1392 +#############################################################################
  1.1393 +
  1.1394 +-include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
  1.1395 +-include $(MY_RULES)
  1.1396 +
  1.1397 +#
  1.1398 +# Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
  1.1399 +# or in $(MY_RULES)
  1.1400 +#
  1.1401 +ifdef ETAGS
  1.1402 +ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),)
  1.1403 +all:: TAGS
  1.1404 +TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
  1.1405 +	$(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
  1.1406 +endif
  1.1407 +endif
  1.1408 +
  1.1409 +################################################################################
  1.1410 +# Install/copy rules
  1.1411 +#
  1.1412 +# The INSTALL_TARGETS variable contains a list of all install target
  1.1413 +# categories. Each category defines a list of files and executables, and an
  1.1414 +# install destination,
  1.1415 +#
  1.1416 +# FOO_FILES := foo bar
  1.1417 +# FOO_EXECUTABLES := baz
  1.1418 +# FOO_DEST := target_path
  1.1419 +# INSTALL_TARGETS += FOO
  1.1420 +#
  1.1421 +# Additionally, a FOO_TARGET variable may be added to indicate the target for
  1.1422 +# which the files and executables are installed. Default is "libs".
  1.1423 +#
  1.1424 +# Finally, a FOO_KEEP_PATH variable may be set to 1 to indicate the paths given
  1.1425 +# in FOO_FILES/FOO_EXECUTABLES are to be kept at the destination. That is,
  1.1426 +# if FOO_FILES is bar/baz/qux.h, and FOO_DEST is $(DIST)/include, the installed
  1.1427 +# file would be $(DIST)/include/bar/baz/qux.h instead of $(DIST)/include/qux.h
  1.1428 +
  1.1429 +# If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
  1.1430 +ifneq (,$(filter $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX),$(install_cmd)))
  1.1431 +ifeq (,$(wildcard $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX)))
  1.1432 +nsinstall_is_usable = $(if $(wildcard $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX)),yes)
  1.1433 +
  1.1434 +define install_cmd_override
  1.1435 +$(1): install_cmd = $$(if $$(nsinstall_is_usable),$$(INSTALL),$$(NSINSTALL_PY) -t) $$(1)
  1.1436 +endef
  1.1437 +endif
  1.1438 +endif
  1.1439 +
  1.1440 +install_target_tier = $(or $($(1)_TARGET),libs)
  1.1441 +INSTALL_TARGETS_TIERS := $(sort $(foreach category,$(INSTALL_TARGETS),$(call install_target_tier,$(category))))
  1.1442 +
  1.1443 +install_target_result = $($(1)_DEST:%/=%)/$(if $($(1)_KEEP_PATH),$(2),$(notdir $(2)))
  1.1444 +install_target_files = $(foreach file,$($(1)_FILES),$(call install_target_result,$(category),$(file)))
  1.1445 +install_target_executables = $(foreach file,$($(1)_EXECUTABLES),$(call install_target_result,$(category),$(file)))
  1.1446 +
  1.1447 +# Work around a GNU make 3.81 bug where it gives $< the wrong value.
  1.1448 +# See details in bug 934864.
  1.1449 +define create_dependency
  1.1450 +$(1): $(2)
  1.1451 +$(1): $(2)
  1.1452 +endef
  1.1453 +
  1.1454 +define install_target_template
  1.1455 +$(call install_cmd_override,$(2))
  1.1456 +$(call create_dependency,$(2),$(1))
  1.1457 +endef
  1.1458 +
  1.1459 +$(foreach category,$(INSTALL_TARGETS),\
  1.1460 +  $(if $($(category)_DEST),,$(error Missing $(category)_DEST)) \
  1.1461 +  $(foreach tier,$(call install_target_tier,$(category)),\
  1.1462 +    $(eval INSTALL_TARGETS_FILES_$(tier) += $(call install_target_files,$(category))) \
  1.1463 +    $(eval INSTALL_TARGETS_EXECUTABLES_$(tier) += $(call install_target_executables,$(category))) \
  1.1464 +  ) \
  1.1465 +  $(foreach file,$($(category)_FILES) $($(category)_EXECUTABLES), \
  1.1466 +    $(eval $(call install_target_template,$(file),$(call install_target_result,$(category),$(file)))) \
  1.1467 +  ) \
  1.1468 +)
  1.1469 +
  1.1470 +$(foreach tier,$(INSTALL_TARGETS_TIERS), \
  1.1471 +  $(eval $(tier):: $(INSTALL_TARGETS_FILES_$(tier)) $(INSTALL_TARGETS_EXECUTABLES_$(tier))) \
  1.1472 +)
  1.1473 +
  1.1474 +install_targets_sanity = $(if $(filter-out $(notdir $@),$(notdir $(<))),$(error Looks like $@ has an unexpected dependency on $< which breaks INSTALL_TARGETS))
  1.1475 +
  1.1476 +$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_FILES_$(tier)))):
  1.1477 +	$(install_targets_sanity)
  1.1478 +	$(call install_cmd,$(IFLAGS1) '$<' '$(@D)')
  1.1479 +
  1.1480 +$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_EXECUTABLES_$(tier)))):
  1.1481 +	$(install_targets_sanity)
  1.1482 +	$(call install_cmd,$(IFLAGS2) '$<' '$(@D)')
  1.1483 +
  1.1484 +################################################################################
  1.1485 +# Preprocessing rules
  1.1486 +#
  1.1487 +# The PP_TARGETS variable contains a list of all preprocessing target
  1.1488 +# categories. Each category has associated variables listing input files, the
  1.1489 +# output directory, extra preprocessor flags, and so on. For example:
  1.1490 +#
  1.1491 +#   FOO := input-file
  1.1492 +#   FOO_PATH := target-directory
  1.1493 +#   FOO_FLAGS := -Dsome_flag
  1.1494 +#   PP_TARGETS += FOO
  1.1495 +#
  1.1496 +# If PP_TARGETS lists a category name <C> (like FOO, above), then we consult the
  1.1497 +# following make variables to see what to do:
  1.1498 +#
  1.1499 +# - <C> lists input files to be preprocessed with mozbuild.action.preprocessor.
  1.1500 +#   We search VPATH for the names given here. If an input file name ends in
  1.1501 +#   '.in', that suffix is omitted from the output file name.
  1.1502 +#
  1.1503 +# - <C>_PATH names the directory in which to place the preprocessed output
  1.1504 +#   files. We create this directory if it does not already exist. Setting
  1.1505 +#   this variable is optional; if unset, we install the files in $(CURDIR).
  1.1506 +#
  1.1507 +# - <C>_FLAGS lists flags to pass to mozbuild.action.preprocessor, in addition
  1.1508 +#   to the usual bunch. Setting this variable is optional.
  1.1509 +#
  1.1510 +# - <C>_TARGET names the 'make' target that should depend on creating the output
  1.1511 +#   files. Setting this variable is optional; if unset, we preprocess the
  1.1512 +#   files for the 'libs' target.
  1.1513 +#
  1.1514 +# - <C>_KEEP_PATH may be set to 1 to indicate the paths given in <C> are to be
  1.1515 +#   kept under <C>_PATH. That is, if <C> is bar/baz/qux.h.in and <C>_PATH is
  1.1516 +#   $(DIST)/include, the preprocessed file would be $(DIST)/include/bar/baz/qux.h
  1.1517 +#   instead of $(DIST)/include/qux.h.
  1.1518 +
  1.1519 +pp_target_tier = $(or $($(1)_TARGET),libs)
  1.1520 +PP_TARGETS_TIERS := $(sort $(foreach category,$(PP_TARGETS),$(call pp_target_tier,$(category))))
  1.1521 +
  1.1522 +pp_target_result = $(or $($(1)_PATH:%/=%),$(CURDIR))/$(if $($(1)_KEEP_PATH),$(2:.in=),$(notdir $(2:.in=)))
  1.1523 +pp_target_results = $(foreach file,$($(1)),$(call pp_target_result,$(category),$(file)))
  1.1524 +
  1.1525 +$(foreach category,$(PP_TARGETS), \
  1.1526 +  $(foreach tier,$(call pp_target_tier,$(category)), \
  1.1527 +    $(eval PP_TARGETS_RESULTS_$(tier) += $(call pp_target_results,$(category))) \
  1.1528 +  ) \
  1.1529 +  $(foreach file,$($(category)), \
  1.1530 +    $(eval $(call create_dependency,$(call pp_target_result,$(category),$(file)), \
  1.1531 +                                    $(file) $(GLOBAL_DEPS))) \
  1.1532 +  ) \
  1.1533 +  $(eval $(call pp_target_results,$(category)): PP_TARGET_FLAGS=$($(category)_FLAGS)) \
  1.1534 +)
  1.1535 +
  1.1536 +$(foreach tier,$(PP_TARGETS_TIERS), \
  1.1537 +  $(eval $(tier):: $(PP_TARGETS_RESULTS_$(tier))) \
  1.1538 +)
  1.1539 +
  1.1540 +PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS_RESULTS_$(tier))))
  1.1541 +$(PP_TARGETS_ALL_RESULTS):
  1.1542 +	$(if $(filter-out $(notdir $@),$(notdir $(<:.in=))),$(error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS))
  1.1543 +	$(RM) '$@'
  1.1544 +	$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) '$<' -o '$@')
  1.1545 +
  1.1546 +# The depfile is based on the filename, and we don't want conflicts. So check
  1.1547 +# there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
  1.1548 +PP_TARGETS_ALL_RESULT_NAMES := $(notdir $(PP_TARGETS_ALL_RESULTS))
  1.1549 +$(foreach file,$(sort $(PP_TARGETS_ALL_RESULT_NAMES)), \
  1.1550 +  $(if $(filter-out 1,$(words $(filter $(file),$(PP_TARGETS_ALL_RESULT_NAMES)))), \
  1.1551 +    $(error Multiple preprocessing rules are creating a $(file) file) \
  1.1552 +  ) \
  1.1553 +)
  1.1554 +
  1.1555 +ifneq (,$(filter $(PP_TARGETS_TIERS) $(PP_TARGETS_ALL_RESULTS),$(MAKECMDGOALS)))
  1.1556 +# If the depfile for a preprocessed file doesn't exist, add a dep to force
  1.1557 +# re-preprocessing.
  1.1558 +$(foreach file,$(PP_TARGETS_ALL_RESULTS), \
  1.1559 +  $(if $(wildcard $(MDDEPDIR)/$(notdir $(file)).pp), \
  1.1560 +    , \
  1.1561 +    $(eval $(file): FORCE) \
  1.1562 +  ) \
  1.1563 +)
  1.1564 +
  1.1565 +MDDEPEND_FILES := $(strip $(wildcard $(addprefix $(MDDEPDIR)/,$(addsuffix .pp,$(notdir $(PP_TARGETS_ALL_RESULTS))))))
  1.1566 +
  1.1567 +ifneq (,$(MDDEPEND_FILES))
  1.1568 +$(call include_deps,$(MDDEPEND_FILES))
  1.1569 +endif
  1.1570 +
  1.1571 +endif
  1.1572 +
  1.1573 +# Pull in non-recursive targets if this is a partial tree build.
  1.1574 +ifndef TOPLEVEL_BUILD
  1.1575 +include $(topsrcdir)/config/makefiles/nonrecursive.mk
  1.1576 +endif
  1.1577 +
  1.1578 +################################################################################
  1.1579 +# Special gmake rules.
  1.1580 +################################################################################
  1.1581 +
  1.1582 +
  1.1583 +#
  1.1584 +# Re-define the list of default suffixes, so gmake won't have to churn through
  1.1585 +# hundreds of built-in suffix rules for stuff we don't need.
  1.1586 +#
  1.1587 +.SUFFIXES:
  1.1588 +
  1.1589 +#
  1.1590 +# Fake targets.  Always run these rules, even if a file/directory with that
  1.1591 +# name already exists.
  1.1592 +#
  1.1593 +.PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE
  1.1594 +
  1.1595 +# Used as a dependency to force targets to rebuild
  1.1596 +FORCE:
  1.1597 +
  1.1598 +# Delete target if error occurs when building target
  1.1599 +.DELETE_ON_ERROR:
  1.1600 +
  1.1601 +tags: TAGS
  1.1602 +
  1.1603 +TAGS: $(CSRCS) $(CPPSRCS) $(wildcard *.h)
  1.1604 +	-etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
  1.1605 +	$(LOOP_OVER_PARALLEL_DIRS)
  1.1606 +	$(LOOP_OVER_DIRS)
  1.1607 +
  1.1608 +ifndef INCLUDED_DEBUGMAKE_MK #{
  1.1609 +  ## Only parse when an echo* or show* target is requested
  1.1610 +  ifneq (,$(call isTargetStem,echo,show))
  1.1611 +    include $(topsrcdir)/config/makefiles/debugmake.mk
  1.1612 +  endif #}
  1.1613 +endif #}
  1.1614 +
  1.1615 +documentation:
  1.1616 +	@cd $(DEPTH)
  1.1617 +	$(DOXYGEN) $(DEPTH)/config/doxygen.cfg
  1.1618 +
  1.1619 +ifdef ENABLE_TESTS
  1.1620 +check::
  1.1621 +	$(LOOP_OVER_PARALLEL_DIRS)
  1.1622 +	$(LOOP_OVER_DIRS)
  1.1623 +	$(LOOP_OVER_TOOL_DIRS)
  1.1624 +endif
  1.1625 +
  1.1626 +
  1.1627 +FREEZE_VARIABLES = \
  1.1628 +  CSRCS \
  1.1629 +  CPPSRCS \
  1.1630 +  EXPORTS \
  1.1631 +  DIRS \
  1.1632 +  LIBRARY \
  1.1633 +  MODULE \
  1.1634 +  TIERS \
  1.1635 +  EXTRA_COMPONENTS \
  1.1636 +  EXTRA_PP_COMPONENTS \
  1.1637 +  $(NULL)
  1.1638 +
  1.1639 +$(foreach var,$(FREEZE_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
  1.1640 +
  1.1641 +CHECK_FROZEN_VARIABLES = $(foreach var,$(FREEZE_VARIABLES), \
  1.1642 +  $(if $(subst $($(var)_FROZEN),,'$($(var))'),$(error Makefile variable '$(var)' changed value after including rules.mk. Was $($(var)_FROZEN), now $($(var)).)))
  1.1643 +
  1.1644 +libs export::
  1.1645 +	$(CHECK_FROZEN_VARIABLES)
  1.1646 +
  1.1647 +PURGECACHES_DIRS ?= $(DIST)/bin
  1.1648 +ifdef MOZ_WEBAPP_RUNTIME
  1.1649 +PURGECACHES_DIRS += $(DIST)/bin/webapprt
  1.1650 +endif
  1.1651 +
  1.1652 +PURGECACHES_FILES = $(addsuffix /.purgecaches,$(PURGECACHES_DIRS))
  1.1653 +
  1.1654 +default all:: $(PURGECACHES_FILES)
  1.1655 +
  1.1656 +$(PURGECACHES_FILES):
  1.1657 +	if test -d $(@D) ; then touch $@ ; fi
  1.1658 +
  1.1659 +.DEFAULT_GOAL := $(or $(OVERRIDE_DEFAULT_GOAL),default)
  1.1660 +
  1.1661 +#############################################################################
  1.1662 +# Derived targets and dependencies
  1.1663 +
  1.1664 +include $(topsrcdir)/config/makefiles/autotargets.mk
  1.1665 +ifneq ($(NULL),$(AUTO_DEPS))
  1.1666 +  default all libs tools export:: $(AUTO_DEPS)
  1.1667 +endif
  1.1668 +
  1.1669 +export:: $(GENERATED_FILES)
  1.1670 +
  1.1671 +GARBAGE += $(GENERATED_FILES)

mercurial