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.
41 lines
1.5 KiB
41 lines
1.5 KiB
# Copyright (c) 2016-present, Facebook, Inc.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
TESTS_DIR = ../..
|
|
|
|
CMAKE_DIR = ../codetoanalyze/cmake
|
|
CMAKE_BUILD_DIR = $(CMAKE_DIR)/_build
|
|
CMAKE_ANALYZE_DIR = $(CMAKE_DIR)/_build_infer
|
|
|
|
ANALYZER = checkers
|
|
CLEAN_EXTRA = $(CMAKE_BUILD_DIR) $(CMAKE_ANALYZE_DIR)
|
|
INFER_OPTIONS = --project-root $(TESTS_DIR)
|
|
SOURCES = $(CMAKE_DIR)/hello.c
|
|
OBJECTS = $(CMAKE_BUILD_DIR)/CMakeFiles/Hello.dir/hello.c.o
|
|
INFERPRINT_OPTIONS = --issues-tests
|
|
|
|
include $(TESTS_DIR)/infer.make
|
|
|
|
$(CMAKE_BUILD_DIR)/Makefile: $(CMAKE_DIR)/CMakeLists.txt
|
|
$(QUIET)$(MKDIR_P) $(CMAKE_BUILD_DIR)
|
|
$(QUIET)cd $(CMAKE_BUILD_DIR) && \
|
|
$(CMAKE) ..
|
|
|
|
$(OBJECTS): $(SOURCES) $(CMAKE_BUILD_DIR)/Makefile
|
|
cd $(CMAKE_BUILD_DIR) && \
|
|
$(MAKE)
|
|
|
|
infer-out/report.json: $(SOURCES) $(CMAKE_DIR)/CMakeLists.txt $(CLANG_DEPS)
|
|
# nuke the build dir and recreate everything to avoid stale compilation/analysis results
|
|
$(QUIET)$(REMOVE_DIR) $(CMAKE_ANALYZE_DIR)
|
|
$(QUIET)$(MKDIR_P) $(CMAKE_ANALYZE_DIR)
|
|
$(QUIET)cd $(CMAKE_ANALYZE_DIR) && \
|
|
$(call silent_on_success,Testing CMake integration: Generate Makefiles,\
|
|
$(INFER_BIN) compile $(INFER_OPTIONS) -- cmake ..)
|
|
$(QUIET)$(call silent_on_success,Testing CMake integration: Run Makefiles,\
|
|
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -- $(MAKE) -C $(CMAKE_ANALYZE_DIR))
|
|
# cmake makes all paths absolute
|
|
$(QUIET)sed -i -e 's#$(abspath $(TESTS_DIR))/##g' $@
|