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.

149 lines
3.8 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.
@SET_MAKE@
ROOT_DIR = .
include $(ROOT_DIR)/Makefile.config
TARGETS_TO_TEST=
ifeq (@BUILD_C_ANALYZERS@,yes)
TARGETS_TO_TEST += c cpp
endif
ifeq (@BUILD_JAVA_ANALYZERS@,yes)
TARGETS_TO_TEST += java
endif
ifneq (@XCODE_SELECT@,no)
TARGETS_TO_TEST += objc
endif
TARGETS_TO_TEST := $(shell echo $(TARGETS_TO_TEST))
all: $(INFER_ANALYZERS)
java: inferTraceBugs
ifneq (@BUILD_JAVA_ANALYZERS@,yes)
@echo
@echo " error: java analyzers disabled by ./configure"
@echo " to enable them again, see"
@echo
@echo " ./configure --help"
@echo
@exit 1
else
$(MAKE) -C $(INFER_DIR) java
endif
clang: inferTraceBugs
ifneq (@BUILD_C_ANALYZERS@,yes)
@echo
@echo " error: clang analyzers disabled by ./configure"
@echo " to enable them again, see"
@echo
@echo " ./configure --help"
@echo
@exit 1
else
$(MAKE) -C $(INFER_DIR) clang
endif
ifeq (@BUILD_C_ANALYZERS@,yes)
clang_setup:
export CC="@CC@" CFLAGS="@CFLAGS@"; \
export CXX="@CXX@" CXXFLAGS="@CXXFLAGS@"; \
export CPP="@CPP@" LDFLAGS="@LDFLAGS@" LIBS="@LIBS@"; \
$(FCP_DIR)/clang/setup.sh
clang_plugin: clang_setup
ifeq (@INFER_IS_RELEASE@,no)
$(MAKE) -C $(FCP_DIR)/libtooling all \
CC=@CC@ CXX=@CXX@ \
CXX="@CXX@" CXXFLAGS="@CXXFLAGS@" \
CPP="@CPP@" LDFLAGS="@LDFLAGS@" LIBS="@LIBS@" \
LOCAL_CLANG=@CLANG_PREFIX@/bin/clang \
CLANG_PREFIX=@CLANG_PREFIX@ \
CLANG_INCLUDES=@CLANG_INCLUDES@
$(MAKE) -C $(FCP_DIR)/clang-ocaml all \
build/clang_ast_proj.ml build/clang_ast_proj.mli \
CC=@CC@ CXX=@CXX@ \
CXX="@CXX@" CXXFLAGS="@CXXFLAGS@" \
CPP="@CPP@" LDFLAGS="@LDFLAGS@" LIBS="@LIBS@" \
LOCAL_CLANG=@CLANG_PREFIX@/bin/clang \
CLANG_PREFIX=@CLANG_PREFIX@ \
CLANG_INCLUDES=@CLANG_INCLUDES@
endif
clang: clang_plugin
endif
unit:
$(MAKE) -C $(SRC_DIR) unit
test_build:
$(MAKE) -C $(SRC_DIR) test_clean
$(MAKE) -C $(SRC_DIR) test_build
ifeq (@BUILD_C_ANALYZERS@,yes)
test_build: clang_plugin
endif
ocaml_unit_test: $(INFER_ANALYZERS) unit
$(INFERUNIT_BIN)
buck_test: $(INFER_ANALYZERS)
NO_BUCKD=1 buck clean
NO_BUCKD=1 buck test $(TARGETS_TO_TEST)
ifeq (@BUILD_JAVA_ANALYZERS@,yes)
NO_BUCKD=1 ./infer/tests/build_systems/build_integration_tests.py
endif
buck_test_xml: $(INFER_ANALYZERS)
NO_BUCKD=1 buck clean
NO_BUCKD=1 buck test --xml test.xml $(TARGETS_TO_TEST)
ifeq (@BUILD_JAVA_ANALYZERS@,yes)
NO_BUCKD=1 ./infer/tests/build_systems/build_integration_tests.py
endif
inferTraceBugs:
make -C infer $(INFERTRACEBUGS_BIN)
inferTraceBugs_test: $(INFER_ANALYZERS)
ifeq (@BUILD_JAVA_ANALYZERS@,yes)
$(INFER_BIN) -o __test-infer-out__ -- \
javac $(EXAMPLES_DIR)/Hello.java \
> /dev/null
@rm -f Hello.class
else
$(INFER_BIN) -o __test-infer-out__ \
-- clang -c $(EXAMPLES_DIR)/hello.c \
> /dev/null
@rm -f hello.o
endif
$(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \
--select 0 --max-level max > /dev/null
$(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \
--select 0 --max-level 0 > /dev/null
$(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \
--select 0 --max-level max --no-source > /dev/null
$(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \
--only-show > /dev/null
@rm -fr __test-infer-out__
test: ocaml_unit_test buck_test inferTraceBugs_test
test_xml: buck_test_xml
clean:
@rm -fv test.xml
ifeq (@BUILD_C_ANALYZERS@,yes)
$(MAKE) -C $(FCP_DIR) clean
$(MAKE) -C $(FCP_DIR)/clang-ocaml clean
endif
$(MAKE) -C $(INFER_DIR) clean
.PHONY: all buck_test buck_test_xml clean clang
.PHONY: clang_plugin clang_setup inferTraceBugs inferTraceBugs_test java
.PHONY: ocaml_unit_test test test_xml test_build unit