parent
b594d74d34
commit
95804e6382
@ -0,0 +1,252 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
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 objcpp
|
||||||
|
endif
|
||||||
|
TARGETS_TO_TEST := $(shell echo $(TARGETS_TO_TEST))
|
||||||
|
|
||||||
|
all: infer inferTraceBugs
|
||||||
|
|
||||||
|
$(INFER_BIN_RELPATH) $(INFERTRACEBUGS_BIN_RELPATH):
|
||||||
|
($(REMOVE) $@ && \
|
||||||
|
cd $(@D) && \
|
||||||
|
$(LN_S) ../lib/python/$(@F) $(@F))
|
||||||
|
|
||||||
|
infer: $(INFER_BIN_RELPATH)
|
||||||
|
$(MAKE) -C $(SRC_DIR) infer
|
||||||
|
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
|
||||||
|
$(MAKE) -C $(ANNOTATIONS_DIR)
|
||||||
|
endif
|
||||||
|
$(MAKE) -C $(MODELS_DIR) all
|
||||||
|
|
||||||
|
ifeq ($(BUILD_C_ANALYZERS),yes)
|
||||||
|
infer: clang_plugin
|
||||||
|
endif
|
||||||
|
|
||||||
|
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 ($(IS_RELEASE_TREE),no)
|
||||||
|
$(MAKE) -C $(FCP_DIR)/libtooling all \
|
||||||
|
CC=$(CC) CXX=$(CXX) \
|
||||||
|
CFLAGS="$(CFLAGS)" 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) \
|
||||||
|
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
|
||||||
|
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
|
||||||
|
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
|
||||||
|
CLANG_PREFIX=$(CLANG_PREFIX) \
|
||||||
|
CLANG_INCLUDES=$(CLANG_INCLUDES)
|
||||||
|
endif
|
||||||
|
|
||||||
|
inferTraceBugs: $(INFERTRACEBUGS_BIN_RELPATH)
|
||||||
|
|
||||||
|
test_this_build: clang_plugin
|
||||||
|
$(MAKE) -C $(SRC_DIR) test_build
|
||||||
|
|
||||||
|
test_oss_build: clang_plugin
|
||||||
|
# make sure we don't break the opensource build
|
||||||
|
$(MAKE) -C $(SRC_DIR) EXTRA_DEPS=opensource LLVM_BUILD_DIR=$(BUILD_DIR)/llvm_opensource TEST_BUILD_DIR=$(BUILD_DIR)/opensource test_build
|
||||||
|
|
||||||
|
test_build: test_this_build
|
||||||
|
ifeq ($(IS_FACEBOOK_TREE),yes)
|
||||||
|
test_build: test_oss_build
|
||||||
|
endif
|
||||||
|
|
||||||
|
ocaml_unit_test: infer
|
||||||
|
$(INFERUNIT_BIN)
|
||||||
|
|
||||||
|
buck_test: infer
|
||||||
|
NO_BUCKD=1 buck clean
|
||||||
|
NO_BUCKD=1 buck test $(TARGETS_TO_TEST)
|
||||||
|
NO_BUCKD=1 ./infer/tests/build_systems/build_integration_tests.py
|
||||||
|
|
||||||
|
buck_test_xml: infer
|
||||||
|
NO_BUCKD=1 buck clean
|
||||||
|
NO_BUCKD=1 buck test --xml test.xml $(TARGETS_TO_TEST)
|
||||||
|
NO_BUCKD=1 ./infer/tests/build_systems/build_integration_tests.py
|
||||||
|
|
||||||
|
inferTraceBugs_test: infer
|
||||||
|
$(INFER_BIN) -o __test-infer-out__ -- \
|
||||||
|
javac $(EXAMPLES_DIR)/Hello.java \
|
||||||
|
> /dev/null
|
||||||
|
@rm -f Hello.class
|
||||||
|
$(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__
|
||||||
|
|
||||||
|
check_missing_mli:
|
||||||
|
@bash -c '\
|
||||||
|
for x in `find infer/src -name "*.ml"`; do \
|
||||||
|
test -f "$$x"i || echo Missing "$$x"i; done'
|
||||||
|
|
||||||
|
test: test_build ocaml_unit_test buck_test inferTraceBugs_test
|
||||||
|
$(MAKE) -C $(SRC_DIR) mod_dep.dot
|
||||||
|
|
||||||
|
test_xml: test_build ocaml_unit_test buck_test_xml inferTraceBugs_test
|
||||||
|
$(MAKE) -C $(SRC_DIR) mod_dep.dot
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(REMOVE_DIR) $(DESTDIR)$(libdir)/infer/
|
||||||
|
$(REMOVE) $(DESTDIR)$(bindir)/inferTraceBugs
|
||||||
|
$(REMOVE) $(DESTDIR)$(bindir)/infer
|
||||||
|
|
||||||
|
install: infer inferTraceBugs
|
||||||
|
# create directory structure
|
||||||
|
test -d $(DESTDIR)$(bindir) || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(bindir)
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/
|
||||||
|
ifeq ($(BUILD_C_ANALYZERS),yes)
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/facebook-clang-plugins/libtooling/build/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/facebook-clang-plugins/libtooling/build/
|
||||||
|
@for i in $$(find facebook-clang-plugins/clang/ -not -wholename 'src/*' -type d); do \
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/$$i || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/$$i; \
|
||||||
|
done
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/clang_wrappers/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/clang_wrappers/
|
||||||
|
endif
|
||||||
|
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/java/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/java/
|
||||||
|
endif
|
||||||
|
ifneq ($(XCODE_SELECT),no)
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/xcode_wrappers/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/xcode_wrappers/
|
||||||
|
endif
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/annotations/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/annotations/
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/wrappers/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/wrappers/
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/specs/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/specs/
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/python/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/python/
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/python/inferlib/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/python/inferlib/
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/python/inferlib/capture/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/python/inferlib/capture/
|
||||||
|
test -d $(DESTDIR)$(libdir)/infer/infer/bin/ || \
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/bin/
|
||||||
|
|
||||||
|
# copy files
|
||||||
|
ifeq ($(BUILD_C_ANALYZERS),yes)
|
||||||
|
$(INSTALL_DATA) -C facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib \
|
||||||
|
$(DESTDIR)$(libdir)/infer/facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib
|
||||||
|
@for i in $$(find facebook-clang-plugins/clang/ -not -wholename 'src/*' -not -name setup.sh -not -name installed.version -not -type d); do \
|
||||||
|
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
||||||
|
done
|
||||||
|
@for i in $$(find infer/lib/clang_wrappers/*); do \
|
||||||
|
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
||||||
|
done
|
||||||
|
@for i in $$(find infer/lib/specs/*); do \
|
||||||
|
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
||||||
|
done
|
||||||
|
$(INSTALL_PROGRAM) -C $(INFERCLANG_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
|
||||||
|
endif
|
||||||
|
ifneq ($(XCODE_SELECT),no)
|
||||||
|
@for i in $$(find infer/lib/xcode_wrappers/*); do \
|
||||||
|
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
||||||
|
done
|
||||||
|
endif
|
||||||
|
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
|
||||||
|
$(INSTALL_DATA) -C infer/annotations/annotations.jar \
|
||||||
|
$(DESTDIR)$(libdir)/infer/infer/annotations/annotations.jar
|
||||||
|
@for i in infer/lib/java/*.jar; do \
|
||||||
|
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
||||||
|
done
|
||||||
|
$(INSTALL_PROGRAM) -C $(INFERJAVA_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
|
||||||
|
endif
|
||||||
|
@for i in $$(find infer/lib/wrappers/*); do \
|
||||||
|
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
||||||
|
done
|
||||||
|
@for i in $$(find infer/lib/python/inferlib/* -type f); do \
|
||||||
|
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
||||||
|
done
|
||||||
|
$(INSTALL_PROGRAM) -C infer/lib/python/infer \
|
||||||
|
$(DESTDIR)$(libdir)/infer/infer/lib/python/infer
|
||||||
|
$(INSTALL_PROGRAM) -C infer/lib/python/inferTraceBugs \
|
||||||
|
$(DESTDIR)$(libdir)/infer/infer/lib/python/inferTraceBugs
|
||||||
|
$(INSTALL_PROGRAM) -C $(INFERANALYZE_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
|
||||||
|
$(INSTALL_PROGRAM) -C $(INFERPRINT_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
|
||||||
|
$(INSTALL_PROGRAM) -C $(INFERSTATS_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
|
||||||
|
(cd $(DESTDIR)$(libdir)/infer/infer/bin/ && \
|
||||||
|
$(REMOVE) infer && \
|
||||||
|
$(LN_S) $(libdir)/infer/infer/lib/python/infer infer)
|
||||||
|
(cd $(DESTDIR)$(bindir)/ && \
|
||||||
|
$(REMOVE) infer && \
|
||||||
|
$(LN_S) $(libdir)/infer/infer/lib/python/infer infer)
|
||||||
|
(cd $(DESTDIR)$(bindir)/ && \
|
||||||
|
$(REMOVE) inferTraceBugs && \
|
||||||
|
$(LN_S) $(libdir)/infer/infer/lib/python/inferTraceBugs inferTraceBugs)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(REMOVE) test.xml
|
||||||
|
ifeq ($(IS_RELEASE_TREE),no)
|
||||||
|
ifeq ($(BUILD_C_ANALYZERS),yes)
|
||||||
|
$(MAKE) -C $(FCP_DIR) clean
|
||||||
|
$(MAKE) -C $(FCP_DIR)/clang-ocaml clean
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
$(MAKE) -C $(SRC_DIR) clean
|
||||||
|
$(MAKE) -C $(ANNOTATIONS_DIR) clean
|
||||||
|
$(MAKE) -C $(MODELS_DIR) clean
|
||||||
|
$(REMOVE) $(INFER_BIN_RELPATH) $(INFERTRACEBUGS_BIN_RELPATH)
|
||||||
|
|
||||||
|
conf-clean: clean
|
||||||
|
$(REMOVE) infer/lib/python/inferlib/*.pyc
|
||||||
|
$(REMOVE) infer/lib/python/inferlib/*/*.pyc
|
||||||
|
$(REMOVE) .buckversion
|
||||||
|
$(REMOVE) Makefile
|
||||||
|
$(REMOVE) Makefile.config
|
||||||
|
$(REMOVE) acinclude.m4
|
||||||
|
$(REMOVE) aclocal.m4
|
||||||
|
$(REMOVE_DIR) autom4te.cache/
|
||||||
|
$(REMOVE) config.log
|
||||||
|
$(REMOVE) config.status
|
||||||
|
$(REMOVE) configure
|
||||||
|
$(REMOVE) infer/models/Makefile
|
||||||
|
$(REMOVE) infer/models/c/Makefile
|
||||||
|
$(REMOVE_DIR) infer/models/c/out/
|
||||||
|
$(REMOVE) infer/models/cpp/Makefile
|
||||||
|
$(REMOVE_DIR) infer/models/cpp/out/
|
||||||
|
$(REMOVE) infer/models/java/Makefile
|
||||||
|
$(REMOVE_DIR) infer/models/java/infer-out/
|
||||||
|
$(REMOVE) infer/models/objc/Makefile
|
||||||
|
$(REMOVE_DIR) infer/models/objc/out/
|
||||||
|
$(REMOVE) infer/src/Makefile
|
||||||
|
|
||||||
|
.PHONY: all buck_test buck_test_xml clean clang_plugin clang_setup infer inferTraceBugs
|
||||||
|
.PHONY: inferTraceBugs_test ocaml_unit_test check_missing_mli test test_xml test_build install
|
||||||
|
.PHONY: uninstall
|
@ -0,0 +1,79 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) 2013 - 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 -x
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
|
||||||
|
ROOT_INFER_DIR="$SCRIPT_DIR"/..
|
||||||
|
CLANG_PLUGIN_DIR="$ROOT_INFER_DIR"/facebook-clang-plugins
|
||||||
|
PLATFORM=`uname`
|
||||||
|
INFER_SOURCE="$ROOT_INFER_DIR"/infer-source
|
||||||
|
|
||||||
|
# Build infer and facebook-clang-plugins
|
||||||
|
cd "$ROOT_INFER_DIR"
|
||||||
|
# This assumes the current commit is the one with the release bump
|
||||||
|
./build-infer.sh
|
||||||
|
|
||||||
|
# Get a copy of the github repo
|
||||||
|
git clone https://github.com/facebook/infer.git "$INFER_SOURCE"
|
||||||
|
pushd "$INFER_SOURCE"
|
||||||
|
# Name of the release package
|
||||||
|
VERSION=`git describe --abbrev=0 --tags`
|
||||||
|
if [ "$PLATFORM" == 'Darwin' ]; then
|
||||||
|
RELEASE_NAME=infer-osx-"$VERSION"
|
||||||
|
else
|
||||||
|
RELEASE_NAME=infer-linux64-"$VERSION"
|
||||||
|
fi
|
||||||
|
RELEASE_TARBALL="$RELEASE_NAME".tar.xz
|
||||||
|
PKG_DIR="$ROOT_INFER_DIR"/"$RELEASE_NAME"
|
||||||
|
PKG_PLUGIN_DIR="$PKG_DIR"/facebook-clang-plugins
|
||||||
|
|
||||||
|
git checkout "$VERSION"
|
||||||
|
git submodule update --init
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Copy infer source
|
||||||
|
mkdir -p "$PKG_DIR"
|
||||||
|
rsync -a \
|
||||||
|
--exclude="**/.git" \
|
||||||
|
--exclude="**/.gitmodules" \
|
||||||
|
--exclude="**/.gitignore" \
|
||||||
|
--exclude="facebook-clang-plugins/clang/src/clang-*.tar.*" \
|
||||||
|
"$INFER_SOURCE"/ "$PKG_DIR"/
|
||||||
|
touch "$PKG_DIR"/.release
|
||||||
|
rsync -a "$ROOT_INFER_DIR"/configure "$PKG_DIR"/configure
|
||||||
|
|
||||||
|
mkdir -pv "$PKG_PLUGIN_DIR"/clang/{bin,lib,include}
|
||||||
|
mkdir -pv "$PKG_PLUGIN_DIR"/libtooling/build
|
||||||
|
mkdir -pv "$PKG_PLUGIN_DIR"/clang-ocaml/build
|
||||||
|
rsync -a "$CLANG_PLUGIN_DIR"/{CONTRIBUTING.md,LICENSE,LLVM-LICENSE,PATENTS,README.md} "$PKG_PLUGIN_DIR"
|
||||||
|
rsync -a "$CLANG_PLUGIN_DIR"/clang/bin/clang* "$PKG_PLUGIN_DIR"/clang/bin/
|
||||||
|
rsync -a --exclude '*.a' "$CLANG_PLUGIN_DIR"/clang/lib/ "$PKG_PLUGIN_DIR"/clang/lib/
|
||||||
|
rsync -a "$CLANG_PLUGIN_DIR"/clang/include/ "$PKG_PLUGIN_DIR"/clang/include/
|
||||||
|
rsync -a "$CLANG_PLUGIN_DIR"/libtooling/build/ "$PKG_PLUGIN_DIR"/libtooling/build/
|
||||||
|
rsync -a "$CLANG_PLUGIN_DIR"/clang-ocaml/build/ "$PKG_PLUGIN_DIR"/clang-ocaml/build/
|
||||||
|
|
||||||
|
# no clang source in release versions, so remove the corresponding
|
||||||
|
# checksum check
|
||||||
|
grep -v -e '\bsrc/clang-.*\.tar\.*' \
|
||||||
|
< "$CLANG_PLUGIN_DIR"/clang/installed.version \
|
||||||
|
> "$PKG_PLUGIN_DIR"/clang/installed.version
|
||||||
|
|
||||||
|
FBONLY=FB-ONLY
|
||||||
|
if grep -Ir --exclude="$SCRIPT_NAME" "$FBONLY" "$PKG_DIR"; then
|
||||||
|
echo "Found files marked $FBONLY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$ROOT_INFER_DIR" && tar cJf "$RELEASE_TARBALL" "$RELEASE_NAME"
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
rm -rf "$PKG_DIR" "$INFER_SOURCE"
|
Loading…
Reference in new issue