You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.3 KiB

# 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)
move all config variables to Makefile.config.in Summary: Hardcoding `variable@` in Makefiles is Bad™ because it prevents the users from overwriting them easily with `make variable="my custom value"`. The right way to do it is thus: ``` variable = variable@ # then use $(variable) everywhere ``` This diff puts all the `variable = variable@` lines in Makefile.config.in, and changes every occurrence of a `variable@` to `$(variable)` everywhere else. I mostly automated generating this diff. Here are the steps I did: - find out which `variable@`s we use: find . -name 'Makefile*' -exec grep -e '@[^@ []\+@' -o -h \{\} \+ | sort | uniq > config_variables - write this `replace.sh` script to replace every `variable@` with `$(variable)`: ``` #!/bin/sh config_vars_file=$1 shift for line in $(cat $config_vars_file); do var=$(echo $line | tr -d @) sed -i -e "s/$line/\$($var)/g" $@ > /dev/null done ``` - run the script as such: find . -name 'Makefile.*in' \( -not -wholename './Makefile.config.in' \) -exec ./replace.sh config_variables \{\} \+ - put all the `VARIABLE = VARIABLE@` lines in Makefile.config.in - move all `Makefile.in` to `Makefile`, since they don't need to be generated by `./configure` anymore: ``` for i in $(find . -name 'Makefile.*in' \( -not -wholename './Makefile.config.in' \)); do \ rm $(dirname $i)/$(basename $i .in) && git mv $i $(dirname $i)/$(basename $i .in) ; \ done ``` - delete all Makefile except Makefile.config from configure.ac - manually inspect and remove remaining instances of `VAR = $(VAR)` in makefiles, looking at the output of `git grep '^\(\w\+\) = $(\1)'` Reviewed By: jberdine Differential Revision: D3358379 fbshipit-source-id: 5d37f02
9 years ago
COPY = cp -f
move all config variables to Makefile.config.in Summary: Hardcoding `variable@` in Makefiles is Bad™ because it prevents the users from overwriting them easily with `make variable="my custom value"`. The right way to do it is thus: ``` variable = variable@ # then use $(variable) everywhere ``` This diff puts all the `variable = variable@` lines in Makefile.config.in, and changes every occurrence of a `variable@` to `$(variable)` everywhere else. I mostly automated generating this diff. Here are the steps I did: - find out which `variable@`s we use: find . -name 'Makefile*' -exec grep -e '@[^@ []\+@' -o -h \{\} \+ | sort | uniq > config_variables - write this `replace.sh` script to replace every `variable@` with `$(variable)`: ``` #!/bin/sh config_vars_file=$1 shift for line in $(cat $config_vars_file); do var=$(echo $line | tr -d @) sed -i -e "s/$line/\$($var)/g" $@ > /dev/null done ``` - run the script as such: find . -name 'Makefile.*in' \( -not -wholename './Makefile.config.in' \) -exec ./replace.sh config_variables \{\} \+ - put all the `VARIABLE = VARIABLE@` lines in Makefile.config.in - move all `Makefile.in` to `Makefile`, since they don't need to be generated by `./configure` anymore: ``` for i in $(find . -name 'Makefile.*in' \( -not -wholename './Makefile.config.in' \)); do \ rm $(dirname $i)/$(basename $i .in) && git mv $i $(dirname $i)/$(basename $i .in) ; \ done ``` - delete all Makefile except Makefile.config from configure.ac - manually inspect and remove remaining instances of `VAR = $(VAR)` in makefiles, looking at the output of `git grep '^\(\w\+\) = $(\1)'` Reviewed By: jberdine Differential Revision: D3358379 fbshipit-source-id: 5d37f02
9 years ago
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
move all config variables to Makefile.config.in Summary: Hardcoding `variable@` in Makefiles is Bad™ because it prevents the users from overwriting them easily with `make variable="my custom value"`. The right way to do it is thus: ``` variable = variable@ # then use $(variable) everywhere ``` This diff puts all the `variable = variable@` lines in Makefile.config.in, and changes every occurrence of a `variable@` to `$(variable)` everywhere else. I mostly automated generating this diff. Here are the steps I did: - find out which `variable@`s we use: find . -name 'Makefile*' -exec grep -e '@[^@ []\+@' -o -h \{\} \+ | sort | uniq > config_variables - write this `replace.sh` script to replace every `variable@` with `$(variable)`: ``` #!/bin/sh config_vars_file=$1 shift for line in $(cat $config_vars_file); do var=$(echo $line | tr -d @) sed -i -e "s/$line/\$($var)/g" $@ > /dev/null done ``` - run the script as such: find . -name 'Makefile.*in' \( -not -wholename './Makefile.config.in' \) -exec ./replace.sh config_variables \{\} \+ - put all the `VARIABLE = VARIABLE@` lines in Makefile.config.in - move all `Makefile.in` to `Makefile`, since they don't need to be generated by `./configure` anymore: ``` for i in $(find . -name 'Makefile.*in' \( -not -wholename './Makefile.config.in' \)); do \ rm $(dirname $i)/$(basename $i .in) && git mv $i $(dirname $i)/$(basename $i .in) ; \ done ``` - delete all Makefile except Makefile.config from configure.ac - manually inspect and remove remaining instances of `VAR = $(VAR)` in makefiles, looking at the output of `git grep '^\(\w\+\) = $(\1)'` Reviewed By: jberdine Differential Revision: D3358379 fbshipit-source-id: 5d37f02
9 years ago
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