2015-09-24 04:40:54 +03:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
# /!\ Please make sure to update the following comment when you touch this
|
|
|
|
# file. Thank you /!\
|
|
|
|
|
|
|
|
# The traditional Mozilla build system relied on going through the entire
|
|
|
|
# build tree a number of times with different targets, and many of the
|
|
|
|
# things happening at each step required other things happening in previous
|
|
|
|
# steps without any documentation of those dependencies.
|
|
|
|
#
|
|
|
|
# This new build system tries to start afresh by establishing what files or
|
|
|
|
# operations are needed for the build, and applying the necessary rules to
|
|
|
|
# have those in place, relying on make dependencies to get them going.
|
|
|
|
#
|
|
|
|
# As of writing, only building non-compiled parts of Firefox is supported
|
|
|
|
# here (a few other things are also left out). This is a starting point, with
|
|
|
|
# the intent to grow this build system to make it more complete.
|
|
|
|
#
|
|
|
|
# This file contains rules and dependencies to get things working. The intent
|
|
|
|
# is for a Makefile to define some dependencies and variables, and include
|
|
|
|
# this file. What needs to be defined there, and ends up being generated by
|
|
|
|
# python/mozbuild/mozbuild/backend/fastermake.py is the following:
|
|
|
|
# - TOPSRCDIR/TOPOBJDIR, respectively the top source directory and the top
|
|
|
|
# object directory
|
|
|
|
# - PYTHON, the path to the python executable
|
|
|
|
# - ACDEFINES, which contains a set of -Dvar=name to be used during
|
|
|
|
# preprocessing
|
|
|
|
# - MOZ_CHROME_FILE_FORMAT, which defines whether to use file copies or
|
|
|
|
# symbolic links
|
|
|
|
# - JAR_MN_TARGETS, which defines the targets to use for jar manifest
|
|
|
|
# processing, see further below
|
|
|
|
# - PP_TARGETS, which defines the file paths of preprocessed files, see
|
|
|
|
# further below
|
|
|
|
# - INSTALL_MANIFESTS, which defines the list of base directories handled
|
|
|
|
# by install manifests, see further below
|
|
|
|
# - MANIFEST_TARGETS, which defines the file paths of chrome manifests, see
|
|
|
|
# further below
|
|
|
|
#
|
|
|
|
# A convention used between this file and the Makefile including it is that
|
|
|
|
# global Make variables names are uppercase, while "local" Make variables
|
|
|
|
# applied to specific targets are lowercase.
|
|
|
|
|
|
|
|
# Targets to be triggered for a default build
|
|
|
|
default: $(addprefix install-,$(INSTALL_MANIFESTS))
|
|
|
|
default: $(addprefix jar-,$(JAR_MN_TARGETS))
|
|
|
|
|
|
|
|
# Explicit files to be built for a default build
|
|
|
|
default: $(addprefix $(TOPOBJDIR)/,$(PP_TARGETS))
|
|
|
|
default: $(addprefix $(TOPOBJDIR)/,$(MANIFEST_TARGETS))
|
|
|
|
default: $(TOPOBJDIR)/dist/bin/greprefs.js
|
|
|
|
default: $(TOPOBJDIR)/dist/bin/platform.ini
|
|
|
|
default: $(TOPOBJDIR)/dist/bin/webapprt/webapprt.ini
|
|
|
|
|
2015-09-25 11:18:45 +03:00
|
|
|
# Targets from the recursive make backend to be built for a default build
|
|
|
|
default: $(TOPOBJDIR)/config/makefiles/xpidl/xpidl
|
|
|
|
|
2015-09-24 04:40:54 +03:00
|
|
|
.PHONY: FORCE
|
|
|
|
|
|
|
|
# Extra define to trigger some workarounds. We should strive to limit the
|
|
|
|
# use of those. As of writing the only one is in
|
|
|
|
# toolkit/content/buildconfig.html.
|
|
|
|
ACDEFINES += -DBUILD_FASTER
|
|
|
|
|
|
|
|
# Generic rule to fall back to the recursive make backend
|
|
|
|
$(TOPOBJDIR)/%: FORCE
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
|
|
|
|
|
|
|
# Files under the faster/ sub-directory, however, are not meant to use the
|
|
|
|
# fallback
|
|
|
|
$(TOPOBJDIR)/faster/%: ;
|
|
|
|
|
|
|
|
# And files under dist/ are meant to be copied from their first dependency
|
|
|
|
# if there is no other rule.
|
|
|
|
$(TOPOBJDIR)/dist/%:
|
|
|
|
rm -f $@
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
# Install files using install manifests
|
|
|
|
#
|
|
|
|
# The list of base directories is given in INSTALL_MANIFESTS. The
|
|
|
|
# corresponding install manifests are named correspondingly, with forward
|
|
|
|
# slashes replaced with underscores, and prefixed with `install_`. That is,
|
|
|
|
# the install manifest for `dist/bin` would be `install_dist_bin`.
|
|
|
|
$(addprefix install-,$(INSTALL_MANIFESTS)): install-%:
|
|
|
|
$(PYTHON) -m mozbuild.action.process_install_manifest \
|
|
|
|
--no-remove \
|
|
|
|
--no-remove-empty-directories \
|
|
|
|
$(TOPOBJDIR)/$* \
|
|
|
|
install_$(subst /,_,$*)
|
|
|
|
|
|
|
|
# Preprocessed files. Ideally they would be using install manifests but
|
|
|
|
# right now, it's not possible because of things like APP_BUILDID or
|
|
|
|
# nsURLFormatter.js.
|
|
|
|
#
|
|
|
|
# The list of preprocessed files is defined in PP_TARGETS. The list is
|
|
|
|
# relative to TOPOBJDIR.
|
|
|
|
# The source file for each of those preprocessed files is defined as a Make
|
|
|
|
# dependency for the $(TOPOBJDIR)/path target. For example:
|
|
|
|
# PP_TARGETS = foo/bar
|
|
|
|
# $(TOPOBJDIR)/foo/bar: /path/to/source/for/foo/bar.in
|
|
|
|
# The file name for the source doesn't need to be different.
|
|
|
|
# Additionally, extra defines can be specified for a given preprocessing
|
|
|
|
# by setting the `defines` variable specifically for the given target.
|
|
|
|
# For example:
|
|
|
|
# $(TOPOBJDIR)/foo/bar: defines = -Dqux=foobar
|
|
|
|
$(addprefix $(TOPOBJDIR)/,$(PP_TARGETS)): Makefile
|
|
|
|
$(addprefix $(TOPOBJDIR)/,$(PP_TARGETS)): $(TOPOBJDIR)/%:
|
|
|
|
$(PYTHON) -m mozbuild.action.preprocessor \
|
|
|
|
--depend $(TOPOBJDIR)/faster/.deps/$(subst /,_,$*) \
|
|
|
|
-DAB_CD=en-US \
|
|
|
|
$(defines) \
|
|
|
|
$(ACDEFINES) \
|
2015-09-30 10:33:04 +03:00
|
|
|
$(MOZ_DEBUG_DEFINES) \
|
2015-09-24 04:40:54 +03:00
|
|
|
$< \
|
|
|
|
-o $@
|
|
|
|
|
|
|
|
# Include the dependency files from the above preprocessed files rule.
|
|
|
|
$(foreach pp_target,$(PP_TARGETS), \
|
|
|
|
$(eval -include $(TOPOBJDIR)/faster/.deps/$(subst /,_,$(pp_target))))
|
|
|
|
|
|
|
|
# Install files from jar manifests. Ideally, they would be using install
|
|
|
|
# manifests, but the code to read jar manifests and emit appropriate
|
|
|
|
# install manifests is not there yet.
|
|
|
|
# Things missing:
|
|
|
|
# - DEFINES from config/config.mk
|
|
|
|
# - L10N
|
|
|
|
# - -e when USE_EXTENSION_MANIFEST is set in moz.build
|
|
|
|
#
|
|
|
|
# The list given in JAR_MN_TARGETS corresponds to the list of `jar-%` targets
|
|
|
|
# to be processed, with the `jar-` prefix stripped.
|
|
|
|
# The Makefile is expected to specify the source jar manifest as a dependency
|
|
|
|
# to each target. There is no expectation that the `jar-%` target name matches
|
|
|
|
# the source file name in any way. For example:
|
|
|
|
# JAR_MN_TARGETS = foo
|
|
|
|
# jar-foo: /path/to/some/jar.mn
|
|
|
|
# Additionally, extra defines can be specified for the processing of the jar
|
|
|
|
# manifest by settig the `defines` variable specifically for the given target.
|
|
|
|
# For example:
|
|
|
|
# jar-foo: defines = -Dqux=foo
|
|
|
|
# The default base path where files are going to be installed is `dist/bin`.
|
|
|
|
# It is possible to use a different path by setting the `install_target`
|
|
|
|
# variable. For example:
|
|
|
|
# jar-foo: install_target = dist/bin/foo
|
|
|
|
# When processing jar manifests, relative paths given inside a jar manifest
|
|
|
|
# can be resolved from an object directory. The default path for that object
|
|
|
|
# directory is the translation of the jar manifest directory path from the
|
|
|
|
# source directory to the object directory. That is, for
|
|
|
|
# $(TOPSRCDIR)/path/to/jar.mn, the default would be $(TOPOBJDIR)/path/to.
|
|
|
|
# In case a different path must be used for the object directory, the `objdir`
|
|
|
|
# variable can be set. For example:
|
|
|
|
# jar-foo: objdir=/some/other/path
|
|
|
|
jar-%: objdir ?= $(dir $(patsubst $(TOPSRCDIR)%,$(TOPOBJDIR)%,$<))
|
|
|
|
jar-%: install_target ?= dist/bin
|
|
|
|
jar-%:
|
|
|
|
cd $(objdir) && \
|
|
|
|
$(PYTHON) -m mozbuild.action.jar_maker \
|
|
|
|
-j $(TOPOBJDIR)/$(install_target)/chrome \
|
|
|
|
-t $(TOPSRCDIR) \
|
|
|
|
-f $(MOZ_CHROME_FILE_FORMAT) \
|
|
|
|
-c $(dir $<)/en-US \
|
|
|
|
-DAB_CD=en-US \
|
|
|
|
$(defines) \
|
|
|
|
$(ACDEFINES) \
|
2015-09-30 10:33:04 +03:00
|
|
|
$(MOZ_DEBUG_DEFINES) \
|
2015-09-24 04:40:54 +03:00
|
|
|
$<
|
|
|
|
|
|
|
|
# Create some chrome manifests
|
|
|
|
# This rule is forced to run every time because it may be updating files that
|
|
|
|
# already exit.
|
|
|
|
#
|
|
|
|
# The list of chrome manifests is given in MANIFEST_TARGETS, relative to the
|
|
|
|
# top object directory. The content for those manifests is given in the
|
|
|
|
# `content` variable associated with the target. For example:
|
|
|
|
# MANIFEST_TARGETS = foo
|
|
|
|
# $(TOPOBJDIR)/foo: content = "manifest foo.manifest" "manifest bar.manifest"
|
|
|
|
$(addprefix $(TOPOBJDIR)/,$(MANIFEST_TARGETS)): FORCE
|
|
|
|
$(PYTHON) -m mozbuild.action.buildlist \
|
|
|
|
$@ \
|
|
|
|
$(content)
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
# Below is a set of additional dependencies and variables used to build things
|
|
|
|
# that are not supported by data in moz.build.
|
|
|
|
|
|
|
|
# GENERATED_FILES are not supported yet, and even if they were, the
|
|
|
|
# dependencies are missing information.
|
|
|
|
$(foreach p,linux osx windows,jar-browser-themes-$(p)-jar.mn): \
|
|
|
|
jar-browser-themes-%-jar.mn: \
|
|
|
|
$(TOPOBJDIR)/browser/themes/%/tab-selected-end.svg \
|
|
|
|
$(TOPOBJDIR)/browser/themes/%/tab-selected-start.svg
|
|
|
|
|
|
|
|
# Extra dependencies and/or definitions for preprocessed files.
|
|
|
|
$(TOPOBJDIR)/dist/bin/application.ini: $(TOPOBJDIR)/config/buildid
|
|
|
|
$(TOPOBJDIR)/dist/bin/application.ini: defines += \
|
|
|
|
-DAPP_BUILDID=$(shell cat $(TOPOBJDIR)/config/buildid)
|
|
|
|
|
|
|
|
# Files to build with the recursive backend and simply copy
|
|
|
|
$(TOPOBJDIR)/dist/bin/greprefs.js: $(TOPOBJDIR)/modules/libpref/greprefs.js
|
|
|
|
$(TOPOBJDIR)/dist/bin/platform.ini: $(TOPOBJDIR)/toolkit/xre/platform.ini
|
|
|
|
$(TOPOBJDIR)/dist/bin/webapprt/webapprt.ini: $(TOPOBJDIR)/webapprt/webapprt.ini
|
2015-09-25 11:18:45 +03:00
|
|
|
|
|
|
|
# The xpidl target in config/makefiles/xpidl requires the install manifest for
|
|
|
|
# dist/idl to have been processed.
|
|
|
|
$(TOPOBJDIR)/config/makefiles/xpidl/xpidl: $(TOPOBJDIR)/install-dist_idl
|