github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/make/core/goma.mk (about)

     1  #
     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  # Used by the compiler wrapper, but should only be set by gomacc
    18  unexport GOMACC_PATH
    19  
    20  # Notice: this works only with Google's Goma build infrastructure.
    21  ifneq ($(filter-out false,$(USE_GOMA)),)
    22    # Goma requires a lot of processes and file descriptors.
    23    ifeq ($(shell echo $$(($$(ulimit -u) < 2500 || $$(ulimit -n) < 16000))),1)
    24      $(warning Max user processes and/or open files are insufficient)
    25      ifeq ($(shell uname),Darwin)
    26        $(error See go/ma/how-to-use-goma/how-to-use-goma-for-android to relax the limit)
    27      else
    28        $(error Adjust the limit by ulimit -u and ulimit -n)
    29      endif
    30    endif
    31  
    32    ifdef GOMA_DIR
    33      goma_dir := $(GOMA_DIR)
    34    else
    35      goma_dir := $(HOME)/goma
    36    endif
    37    goma_ctl := $(goma_dir)/goma_ctl.py
    38    GOMA_CC := $(goma_dir)/gomacc
    39  
    40    $(if $(wildcard $(goma_ctl)),, \
    41     $(warning You should have goma in $$GOMA_DIR or $(HOME)/goma) \
    42     $(error See go/ma/how-to-use-goma/how-to-use-goma-for-android for detail))
    43  
    44    # Append gomacc to existing *_WRAPPER variables so it's possible to
    45    # use both ccache and gomacc.
    46    CC_WRAPPER := $(strip $(CC_WRAPPER) $(GOMA_CC))
    47    CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(GOMA_CC))
    48    JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(GOMA_CC))
    49  
    50    # gomacc can start goma client's daemon process automatically, but
    51    # it is safer and faster to start up it beforehand. We run this as a
    52    # background process so this won't slow down the build.
    53    ifndef NOSTART_GOMA
    54      $(shell ( $(goma_ctl) ensure_start ) &> /dev/null &)
    55    endif
    56  
    57    goma_ctl :=
    58    goma_dir :=
    59  endif