# Copyright (c) 2015 - present Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. SHELL = bash # Make infer crash a bit more often to detect issues in the way we call infer within this repo, eg, # using deprecated options. export INFER_STRICT_MODE=1 include $(ROOT_DIR)/Makefile.autoconf PLATFORM = $(shell uname) COPY = cp -f COPY_DIR = cp -Rf REMOVE = rm -f REMOVE_DIR = rm -rf ABSOLUTE_ROOT_DIR = $(shell cd $(ROOT_DIR) && pwd) DEPENDENCIES_DIR = $(ABSOLUTE_ROOT_DIR)/dependencies DOCKER_DIR = $(ABSOLUTE_ROOT_DIR)/docker EXAMPLES_DIR = $(ABSOLUTE_ROOT_DIR)/examples INFER_DIR = $(ABSOLUTE_ROOT_DIR)/infer FCP_DIR = $(ABSOLUTE_ROOT_DIR)/facebook-clang-plugins M4_DIR = $(ABSOLUTE_ROOT_DIR)/m4 SCRIPT_DIR = $(ABSOLUTE_ROOT_DIR)/scripts FCP_CLANG_OCAML_DIR = $(FCP_DIR)/clang-ocaml ANNOTATIONS_DIR = $(INFER_DIR)/annotations BIN_DIR = $(INFER_DIR)/bin ETC_DIR = $(INFER_DIR)/etc LIB_DIR = $(INFER_DIR)/lib MODELS_DIR = $(INFER_DIR)/models JAVA_BUILTINS_DIR = $(MODELS_DIR)/java/builtins JAVA_MODELS_DIR = $(MODELS_DIR)/java/src SRC_DIR = $(INFER_DIR)/src BUILD_DIR = $(INFER_DIR)/_build INFER_BUILD_DIR = $(BUILD_DIR)/infer TEST_BUILD_DIR = $(BUILD_DIR)/test JAVA_LIB_DIR = $(LIB_DIR)/java SPECS_LIB_DIR = $(LIB_DIR)/specs PYTHON_DIR = $(LIB_DIR)/python PYTHON_LIB_DIR = $(PYTHON_DIR)/inferlib CAPTURE_LIB_DIR = $(PYTHON_LIB_DIR)/capture INFERANALYZE_BIN = $(BIN_DIR)/InferAnalyze INFERCLANG_BIN = $(BIN_DIR)/InferClang INFERPRINT_BIN = $(BIN_DIR)/InferPrint INFERUNIT_BIN = $(BIN_DIR)/InferUnit INFER_BIN = $(BIN_DIR)/infer INFERTRACEBUGS_BIN = $(BIN_DIR)/inferTraceBugs INFERTRACEBUGS_BIN_RELPATH = infer/bin/inferTraceBugs ifeq ($(BUILD_JAVA_ANALYZERS),yes) JAVA_HOME=$(USER_JAVA_HOME) endif ANDROID_JAR = $(LIB_DIR)/java/android/android-23.jar GUAVA_JAR = $(DEPENDENCIES_DIR)/java/guava/guava-10.0.1-fork.jar INFER_ANNOTATIONS_JAR = $(ANNOTATIONS_DIR)/annotations.jar JACKSON_JAR = $(DEPENDENCIES_DIR)/java/jackson/jackson-2.2.3.jar JSR_305_JAR = $(DEPENDENCIES_DIR)/java/jsr-305/jsr305.jar JAVA_MODELS_JAR = $(LIB_DIR)/java/models.jar JAVA_DEPS_NO_MODELS = \ $(addprefix $(PYTHON_LIB_DIR)/, \ analyze.py bucklib.py config.py issues.py jwlib.py source.py utils.py) \ $(addprefix $(CAPTURE_LIB_DIR)/, util.py) \ $(ANDROID_JAR) $(GUAVA_JAR) $(JACKSON_JAR) $(JSR_305_JAR) $(INFER_ANNOTATIONS_JAR) \ $(INFER_BIN) $(INFERANALYZE_BIN) $(INFERPRINT_BIN) JAVA_DEPS = $(JAVA_DEPS_NO_MODELS) $(JAVA_MODELS_JAR) # markers to keep track of when clang models have been rebuilt C_MODELS_FILE = $(SPECS_LIB_DIR)/c_models CPP_MODELS_FILE = $(SPECS_LIB_DIR)/cpp_models OBJC_MODELS_FILE = $(SPECS_LIB_DIR)/objc_models CLANG_DEPS_NO_MODELS = \ $(addprefix $(PYTHON_LIB_DIR)/, \ analyze.py config.py issues.py source.py utils.py) \ $(addprefix $(CAPTURE_LIB_DIR)/, make.py util.py) \ $(INFER_BIN) $(INFERANALYZE_BIN) $(INFERCLANG_BIN) $(INFERPRINT_BIN) CLANG_DEPS = $(CLANG_DEPS_NO_MODELS) $(C_MODELS_FILE) $(CPP_MODELS_FILE) \ $(shell find $(MODELS_DIR)/cpp/include -type f) ifneq ($(XCODE_SELECT),no) CLANG_DEPS += $(OBJC_MODELS_FILE) endif define silent_on_success $(1) >/dev/null 2>/dev/null || ($(1) && exit 1) endef