[infer] add common C2/branch build scripts

Reviewed By: skcho

Differential Revision: D27045665

fbshipit-source-id: ddd8a4da1
master
Martin Trojer 4 years ago committed by Facebook GitHub Bot
parent abb6131e88
commit 605d6db7a7

@ -387,24 +387,26 @@ byte_infer: byte
opt: opt:
$(QUIET)$(MAKE) BUILD_MODE=opt infer $(QUIET)$(MAKE) BUILD_MODE=opt infer
PLUGIN_SETUP_SCRIPT ?= setup.sh
.PHONY: clang_setup .PHONY: clang_setup
clang_setup: clang_setup:
# if clang is already built then let the user know they might not need to rebuild clang # if clang is already built then let the user know they might not need to rebuild clang
$(QUIET)export CC="$(CC)" CFLAGS="$(CFLAGS)"; \ $(QUIET)export CC="$(CC)" CFLAGS="$(CFLAGS)"; \
export CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)"; \ export CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)"; \
export CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"; \ export CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"; \
$(FCP_DIR)/clang/setup.sh --only-check-install || { \ $(FCP_DIR)/clang/$(PLUGIN_SETUP_SCRIPT) --only-check-install || { \
if [ -x '$(FCP_DIR)'/clang/install/bin/clang ]; then \ if [ -x '$(FCP_DIR)'/clang/install/bin/clang ]; then \
echo '$(TERM_INFO)*** Now building clang, this will take a while...$(TERM_RESET)' >&2; \ echo '$(TERM_INFO)*** Now building clang, this will take a while...$(TERM_RESET)' >&2; \
echo '$(TERM_INFO)*** If you believe that facebook-clang-plugins/clang/install is up-to-date you can$(TERM_RESET)' >&2; \ echo '$(TERM_INFO)*** If you believe that facebook-clang-plugins/clang/install is up-to-date you can$(TERM_RESET)' >&2; \
echo '$(TERM_INFO)*** interrupt the compilation (Control-C) and run this to prevent clang from being rebuilt:$(TERM_RESET)' >&2; \ echo '$(TERM_INFO)*** interrupt the compilation (Control-C) and run this to prevent clang from being rebuilt:$(TERM_RESET)' >&2; \
echo >&2 ; \ echo >&2 ; \
echo '$(TERM_INFO) $(FCP_DIR)/clang/setup.sh --only-record-install$(TERM_RESET)' >&2; \ echo '$(TERM_INFO) $(FCP_DIR)/clang/$(PLUGIN_SETUP_SCRIPT) --only-record-install$(TERM_RESET)' >&2; \
echo >&2 ; \ echo >&2 ; \
echo '$(TERM_INFO)(TIP: you can also force a clang rebuild by removing $(FCP_DIR)/clang/installed.version)$(TERM_RESET)' >&2; \ echo '$(TERM_INFO)(TIP: you can also force a clang rebuild by removing $(FCP_DIR)/clang/installed.version)$(TERM_RESET)' >&2; \
echo >&2 ; \ echo >&2 ; \
fi; \ fi; \
$(FCP_DIR)/clang/setup.sh $(FCP_COMPILE_ARGS); \ $(FCP_DIR)/clang/$(PLUGIN_SETUP_SCRIPT) $(FCP_COMPILE_ARGS); \
} }
.PHONY: clang_plugin .PHONY: clang_plugin

@ -21,6 +21,9 @@ INFER_OPAM_DEFAULT_SWITCH="ocaml-variants.4.11.1+flambda"
INFER_OPAM_DEFAULT_COMPILER="$INFER_OPAM_DEFAULT_SWITCH" INFER_OPAM_DEFAULT_COMPILER="$INFER_OPAM_DEFAULT_SWITCH"
INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_DEFAULT_SWITCH} INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_DEFAULT_SWITCH}
INFER_OPAM_COMPILER=${INFER_OPAM_COMPILER:-$INFER_OPAM_DEFAULT_COMPILER} INFER_OPAM_COMPILER=${INFER_OPAM_COMPILER:-$INFER_OPAM_DEFAULT_COMPILER}
PLUGIN_DIR="$INFER_ROOT/facebook-clang-plugins"
PLUGIN_SETUP_SCRIPT=${PLUGIN_SETUP_SCRIPT:-setup.sh}
PLUGIN_SETUP="${PLUGIN_DIR}/clang/${PLUGIN_SETUP_SCRIPT}"
function usage() { function usage() {
echo "Usage: $0 [-y] [targets]" echo "Usage: $0 [-y] [targets]"
@ -165,7 +168,7 @@ fi
./configure $INFER_CONFIGURE_OPTS ./configure $INFER_CONFIGURE_OPTS
if [ "$BUILD_CLANG" == "yes" ]; then if [ "$BUILD_CLANG" == "yes" ]; then
if ! facebook-clang-plugins/clang/setup.sh --only-check-install; then if ! "$PLUGIN_SETUP" --only-check-install; then
echo "" echo ""
echo " Warning: you are not using a release of Infer. The C and" echo " Warning: you are not using a release of Infer. The C and"
echo " Objective-C analyses require a custom clang to be compiled" echo " Objective-C analyses require a custom clang to be compiled"

Loading…
Cancel
Save