blob: 5b5830c41b9c56c7ca3f192441bc456877b86fab [file] [log] [blame]
Shinichiro Hamajiee482fd2015-08-17 17:38:24 +09001#
2# Copyright (C) 2015 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Notice: this works only with Google's Goma build infrastructure.
18ifneq ($(USE_GOMA),)
Shinichiro Hamajid8f268e2015-09-24 15:19:08 +090019 # Check if USE_NINJA is not false because GNU make won't work well
20 # with goma. Note this file is evaluated twice, once by GNU make and
21 # once by kati with USE_NINJA=false. We do this check in the former
22 # pass.
23 ifndef KATI
24 ifeq ($(USE_NINJA),false)
25 $(error USE_GOMA=true is not compatible with USE_NINJA=false)
26 endif
Shinichiro Hamajiee482fd2015-08-17 17:38:24 +090027 endif
28
29 ifdef GOMA_DIR
30 goma_dir := $(GOMA_DIR)
31 else
32 goma_dir := $(HOME)/goma
33 endif
34 goma_ctl := $(goma_dir)/goma_ctl.py
35 goma_cc := $(goma_dir)/gomacc
36
37 $(if $(wildcard $(goma_ctl)),, \
38 $(warning You should have goma in $$GOMA_DIR or $(HOME)/goma) \
39 $(error See go/ma/how-to-use-goma/how-to-use-goma-for-android for detail))
40
41 # Append gomacc to existing *_WRAPPER variables so it's possible to
42 # use both ccache and gomacc.
43 CC_WRAPPER := $(strip $(CC_WRAPPER) $(goma_cc))
44 CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(goma_cc))
45
46 # Ninja file generated by kati uses this for remote jobs (i.e.,
47 # commands which contain gomacc). Note the parallelism of all other
48 # jobs will be limited the number of cores.
49 KATI_REMOTE_NUM_JOBS_FLAG := --remote_num_jobs=500
50
51 # gomacc can start goma client's daemon process automatically, but
52 # it is safer and faster to start up it beforehand. We run this as a
53 # background process so this won't slow down the build.
54 $(shell $(goma_ctl) ensure_start &> /dev/null &)
55
56 goma_cc :=
57 goma_ctl :=
58 goma_dir :=
59endif