From 5d3a24eb9c9e6418b775e8672d1da465658bdfc8 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 5 Feb 2019 05:37:13 -0800 Subject: [PATCH] [make] let user know how to stop clang rebuilds Summary: Building clang takes long and sometimes only some minor step in the setup script has changed, triggering a spurious rebuild. Print a big bold message letting the user know of their options, but only if clang has been installed previously. ``` (warn_clang)jul@devvm2701:~/infer$ make -j 19 [04:02:44][2288770] Facebook setup... *** Now building clang, this will take a while... *** If you believe that facebook-clang-plugins/clang/install is up-to-date you can(TERM_RESET) *** interrupt the compilation (Control-C) and run this to prevent clang from being rebuilt: /home/jul/infer/facebook-clang-plugins/clang/setup.sh --only-record-install (TIP: you can also force a clang rebuild by removing /home/jul/infer/facebook-clang-plugins/clang/installed.version) [...] ``` Reviewed By: katiejots Differential Revision: D13956431 fbshipit-source-id: da163643d --- Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 282211992..eb41e0aba 100644 --- a/Makefile +++ b/Makefile @@ -302,11 +302,23 @@ opt: .PHONY: clang_setup clang_setup: +# if clang is already built then let the user know they might not need to rebuild clang $(QUIET)export CC="$(CC)" CFLAGS="$(CFLAGS)"; \ export CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)"; \ export CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"; \ - $(FCP_DIR)/clang/setup.sh --only-check-install || \ - $(FCP_DIR)/clang/setup.sh + $(FCP_DIR)/clang/setup.sh --only-check-install || { \ + 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)*** 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 >&2 ; \ + echo '$(TERM_INFO) $(FCP_DIR)/clang/setup.sh --only-record-install$(TERM_RESET)' >&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 >&2 ; \ + fi; \ + $(FCP_DIR)/clang/setup.sh; \ + } .PHONY: clang_plugin clang_plugin: clang_setup