| 1 |
# This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 |
|
| 5 |
# /!\ Please make sure to update the following comment when you touch this |
| 6 |
# file. Thank you /!\ |
| 7 |
|
| 8 |
# The traditional Mozilla build system relied on going through the entire |
| 9 |
# build tree a number of times with different targets, and many of the |
| 10 |
# things happening at each step required other things happening in previous |
| 11 |
# steps without any documentation of those dependencies. |
| 12 |
# |
| 13 |
# This new build system tries to start afresh by establishing what files or |
| 14 |
# operations are needed for the build, and applying the necessary rules to |
| 15 |
# have those in place, relying on make dependencies to get them going. |
| 16 |
# |
| 17 |
# As of writing, only building non-compiled parts of Firefox is supported |
| 18 |
# here (a few other things are also left out). This is a starting point, with |
| 19 |
# the intent to grow this build system to make it more complete. |
| 20 |
# |
| 21 |
# This file contains rules and dependencies to get things working. The intent |
| 22 |
# is for a Makefile to define some dependencies and variables, and include |
| 23 |
# this file. What needs to be defined there, and ends up being generated by |
| 24 |
# python/mozbuild/mozbuild/backend/fastermake.py is the following: |
| 25 |
# - TOPSRCDIR/TOPOBJDIR, respectively the top source directory and the top |
| 26 |
# object directory |
| 27 |
# - PYTHON, the path to the python executable |
| 28 |
# - ACDEFINES, which contains a set of -Dvar=name to be used during |
| 29 |
# preprocessing |
| 30 |
# - INSTALL_MANIFESTS, which defines the list of base directories handled |
| 31 |
# by install manifests, see further below |
| 32 |
# |
| 33 |
# A convention used between this file and the Makefile including it is that |
| 34 |
# global Make variables names are uppercase, while "local" Make variables |
| 35 |
# applied to specific targets are lowercase. |
| 36 |
|
| 37 |
# Targets to be triggered for a default build |
| 38 |
default: $(addprefix install-,$(INSTALL_MANIFESTS)) |
| 39 |
|
| 40 |
ifndef NO_XPIDL |
| 41 |
# Targets from the recursive make backend to be built for a default build |
| 42 |
default: $(TOPOBJDIR)/config/makefiles/xpidl/xpidl |
| 43 |
endif |
| 44 |
|
| 45 |
# Mac builds require to copy things in dist/bin/*.app |
| 46 |
# TODO: remove the MOZ_WIDGET_TOOLKIT and MOZ_BUILD_APP variables from |
| 47 |
# faster/Makefile and python/mozbuild/mozbuild/test/backend/test_build.py |
| 48 |
# when this is not required anymore. |
| 49 |
# We however don't need to do this when using the hybrid |
| 50 |
# FasterMake/RecursiveMake backend (FASTER_RECURSIVE_MAKE is set when |
| 51 |
# recursing from the RecursiveMake backend) |
| 52 |
ifndef FASTER_RECURSIVE_MAKE |
| 53 |
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) |
| 54 |
default: |
| 55 |
$(MAKE) -C $(TOPOBJDIR)/$(MOZ_BUILD_APP)/app repackage |
| 56 |
endif |
| 57 |
endif |
| 58 |
|
| 59 |
.PHONY: FORCE |
| 60 |
|
| 61 |
# Files under the faster/ sub-directory, however, are not meant to use the |
| 62 |
# fallback |
| 63 |
$(TOPOBJDIR)/faster/%: ; |
| 64 |
|
| 65 |
# Generic rule to fall back to the recursive make backend. |
| 66 |
# This needs to stay after other $(TOPOBJDIR)/* rules because GNU Make |
| 67 |
# <3.82 apply pattern rules in definition order, not stem length like |
| 68 |
# modern GNU Make. |
| 69 |
$(TOPOBJDIR)/%: FORCE |
| 70 |
$(MAKE) -C $(dir $@) $(notdir $@) |
| 71 |
|
| 72 |
# Install files using install manifests |
| 73 |
# |
| 74 |
# The list of base directories is given in INSTALL_MANIFESTS. The |
| 75 |
# corresponding install manifests are named correspondingly, with forward |
| 76 |
# slashes replaced with underscores, and prefixed with `install_`. That is, |
| 77 |
# the install manifest for `dist/bin` would be `install_dist_bin`. |
| 78 |
$(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(addprefix $(TOPOBJDIR)/,buildid.h source-repo.h) |
| 79 |
@# For now, force preprocessed files to be reprocessed every time. |
| 80 |
@# The overhead is not that big, and this avoids waiting for proper |
| 81 |
@# support for defines tracking in process_install_manifest. |
| 82 |
@touch install_$(subst /,_,$*) |
| 83 |
$(PYTHON3) -m mozbuild.action.process_install_manifest \ |
| 84 |
$(if $(filter copy,$(NSDISTMODE)),--no-symlinks) \ |
| 85 |
--track install_$(subst /,_,$*).track \ |
| 86 |
$(TOPOBJDIR)/$* \ |
| 87 |
-DAB_CD=en-US \ |
| 88 |
$(ACDEFINES) \ |
| 89 |
install_$(subst /,_,$*) |
| 90 |
|
| 91 |
# ============================================================================ |
| 92 |
# Below is a set of additional dependencies and variables used to build things |
| 93 |
# that are not supported by data in moz.build. |
| 94 |
|
| 95 |
$(TOPOBJDIR)/build/.deps/application.ini.stub: $(TOPOBJDIR)/buildid.h $(TOPOBJDIR)/source-repo.h |