Bug 1708422: part 8) Move `mozInlineSpellChecker::CheckWordsAndAddRangesForMisspellin...
[gecko.git] / client.mk
blobbe5ca9baf6e954263067487fb18194dbe76c9c96
1 # -*- makefile -*-
2 # vim:set ts=8 sw=8 sts=8 noet:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # Defines main targets for driving the Firefox build system.
9 # This make file should not be invoked directly. Instead, use
10 # `mach` (likely `mach build`) for invoking the build system.
12 # Options:
13 # MOZ_OBJDIR - Destination object directory
14 # MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
16 #######################################################################
18 ifndef MACH
19 $(error client.mk must be used via `mach`. Try running \
20 `./mach $(firstword $(MAKECMDGOALS) $(.DEFAULT_GOAL))`)
21 endif
23 ### Load mozconfig options
24 include $(OBJDIR)/.mozconfig-client-mk
26 ifdef MOZ_PARALLEL_BUILD
27 MOZ_MAKE_FLAGS := $(filter-out -j%,$(MOZ_MAKE_FLAGS))
28 MOZ_MAKE_FLAGS += -j$(MOZ_PARALLEL_BUILD)
29 endif
31 # Automatically add -jN to make flags if not defined. N defaults to number of cores.
32 ifeq (,$(findstring -j,$(MOZ_MAKE_FLAGS)))
33 cores=$(shell python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')
34 MOZ_MAKE_FLAGS += -j$(cores)
35 endif
37 ### Set up make flags
38 ifdef MOZ_AUTOMATION
39 ifeq (4.0,$(firstword $(sort 4.0 $(MAKE_VERSION))))
40 MOZ_MAKE_FLAGS += --output-sync=line
41 endif
42 endif
44 MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
46 ### Rules
47 # The default rule is build
48 build::
50 # In automation, manage an sccache daemon. The starting of the server
51 # needs to be in a make file so sccache inherits the jobserver.
52 ifdef MOZBUILD_MANAGE_SCCACHE_DAEMON
53 build::
54 # Terminate any sccache server that might still be around.
55 -$(MOZBUILD_MANAGE_SCCACHE_DAEMON) --stop-server > /dev/null 2>&1
56 # Start a new server, ensuring it gets the jobserver file descriptors
57 # from make (but don't use the + prefix when make -n is used, so that
58 # the command doesn't run in that case)
59 mkdir -p $(UPLOAD_PATH)
60 $(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env SCCACHE_LOG=sccache=debug SCCACHE_ERROR_LOG=$(UPLOAD_PATH)/sccache.log $(MOZBUILD_MANAGE_SCCACHE_DAEMON) --start-server
61 endif
63 ### Build it
64 build::
65 +$(MOZ_MAKE)
67 ifdef MOZ_AUTOMATION
68 build::
69 +$(MOZ_MAKE) automation/build
70 endif
72 # This makefile doesn't support parallel execution. It does pass
73 # MOZ_MAKE_FLAGS to sub-make processes, so they will correctly execute
74 # in parallel.
75 .NOTPARALLEL:
77 .PHONY: \
78 build