diff --git a/.gitignore b/.gitignore index 1acc7d638..89a02e6af 100644 --- a/.gitignore +++ b/.gitignore @@ -105,6 +105,7 @@ buck-out/ /infer/bin/infer-run /infer/bin/InferCreateTraceViewLinks /infer/bin/InferUnit +/infer/bin/infertop.bc /infer/bin/llvm_sil /infer/man diff --git a/Makefile b/Makefile index 519932e04..0fbd9b4a5 100644 --- a/Makefile +++ b/Makefile @@ -202,14 +202,20 @@ endif endif -.PHONY: toplevel -toplevel: src_build_common +.PHONY: toplevel toplevel_test +toplevel toplevel_test: src_build_common + +toplevel: $(QUIET)$(call silent_on_success,Building Infer REPL,\ $(MAKE_SOURCE) toplevel) $(QUIET)echo $(QUIET)echo "You can now use the infer REPL:" $(QUIET)echo " \"$(ABSOLUTE_ROOT_DIR)/scripts/infer_repl\"" +toplevel_test: test_build + $(QUIET)$(call silent_on_success,Building Infer REPL (test mode),\ + $(MAKE_SOURCE) BUILD_MODE=test toplevel) + ifeq ($(IS_FACEBOOK_TREE),yes) byte src_build_common src_build test_build: fb-setup endif @@ -355,7 +361,7 @@ $(BUILD_SYSTEMS_TESTS:%=build_%_replace): infer $(call silence_make,\ $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_replace,%,$@) replace)) -build_infertop_print build_infertop_test build_infertop_replace: test_build +build_infertop_print build_infertop_test build_infertop_replace: toplevel_test .PHONY: build_systems_tests build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test) diff --git a/Makefile.config b/Makefile.config index 3bb56193e..01466a6c4 100644 --- a/Makefile.config +++ b/Makefile.config @@ -52,7 +52,6 @@ PYTHON_DIR = $(LIB_DIR)/python PYTHON_LIB_DIR = $(PYTHON_DIR)/inferlib CAPTURE_LIB_DIR = $(PYTHON_LIB_DIR)/capture -INFERUNIT_BIN = $(BIN_DIR)/InferUnit INFER_BIN = $(BIN_DIR)/infer INFER_COMMANDS = \ infer-analyze \ @@ -63,6 +62,9 @@ INFER_COMMANDS = \ infer-reportdiff \ infer-run \ +INFERTOP_BIN = $(BIN_DIR)/infertop.bc +INFERUNIT_BIN = $(BIN_DIR)/InferUnit + INFER_CREATE_TRACEVIEW_LINKS = InferCreateTraceViewLinks INFER_CREATE_TRACEVIEW_LINKS_BIN = $(BIN_DIR)/$(INFER_CREATE_TRACEVIEW_LINKS) diff --git a/infer/src/Makefile b/infer/src/Makefile index 6a1e3006c..dd19d674e 100644 --- a/infer/src/Makefile +++ b/infer/src/Makefile @@ -184,8 +184,12 @@ $(INFER_BUILD_DIR)/infertop.bc: $(SRC_DIR)/infertop.ml $(SRC_BUILD_COMMON) $(MAK dune build $@ $(QUIET)touch $@ +$(INFERTOP_BIN): $(INFER_BUILD_DIR)/infertop.bc + $(QUIET)$(INSTALL_PROGRAM) $< $@ + $(QUIET)touch $@ + .PHONY: toplevel -toplevel: $(INFER_BUILD_DIR)/infertop.bc +toplevel: $(INFERTOP_BIN) .PHONY: checkCopyright checkCopyright: $(CHECKCOPYRIGHT_BIN) diff --git a/infer/tests/build_systems/infertop/Makefile b/infer/tests/build_systems/infertop/Makefile index d3021cb77..d41d96e81 100644 --- a/infer/tests/build_systems/infertop/Makefile +++ b/infer/tests/build_systems/infertop/Makefile @@ -11,8 +11,8 @@ include $(TESTS_DIR)/base.make toplevel.exp.test: $(BUILD_DIR)/test/infertop.bc $(SCRIPT_DIR)/infer_repl \ $(SCRIPT_DIR)/toplevel_init $(INFER_DIR)/tests/repl/infer_batch_script.mltop $(QUIET)$(call silent_on_success,Testing infer OCaml REPL,\ - TOPLEVEL_DIR=$(BUILD_DIR)/test $(SCRIPT_DIR)/infer_repl \ - $(INFER_DIR)/tests/repl/infer_batch_script.mltop > $@) + BUILD_DIR=$(BUILD_DIR)/test \ + $(SCRIPT_DIR)/infer_repl $(INFER_DIR)/tests/repl/infer_batch_script.mltop > $@) .PHONY: print print: toplevel.exp.test diff --git a/scripts/infer_repl b/scripts/infer_repl index 221f2c798..248630445 100755 --- a/scripts/infer_repl +++ b/scripts/infer_repl @@ -5,8 +5,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # where to find toplevel.bc, can be overridden -TOPLEVEL_DIR=${TOPLEVEL_DIR:-"$SCRIPT_DIR"/../infer/src/_build/default} -INCLUDE_FLAGS=$(find "$TOPLEVEL_DIR" -type d -name '*.objs' -exec printf -- '-I {}\n' \;) +BUILD_DIR=${BUILD_DIR:-"$SCRIPT_DIR"/../infer/src/_build/default} +INCLUDE_FLAGS=$(find "$BUILD_DIR" -type d -name '*.objs' -exec printf -- '-I {}\n' \;) # The -init option is effective only in interactive mode. # In batch mode, scripts need to import toplevel_init themselves. @@ -19,7 +19,7 @@ INCLUDE_FLAGS=$(find "$TOPLEVEL_DIR" -type d -name '*.objs' -exec printf -- '-I set -x # infertop expects to be run from where dune is located cd "$SCRIPT_DIR"/../infer -"$TOPLEVEL_DIR"/infertop.bc \ +./bin/infertop.bc \ -init "$SCRIPT_DIR"/toplevel_init \ $INCLUDE_FLAGS \ -I "$SCRIPT_DIR" \