From 0be101771ecbeda790cece6fed7d2268fe196fda Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Tue, 28 May 2019 23:39:06 +0000 Subject: [PATCH] Eliminate recursive `make` call --- src/Makefile | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Makefile b/src/Makefile index 597245a6bce76..00bd3e0445891 100644 --- a/src/Makefile +++ b/src/Makefile @@ -326,10 +326,22 @@ cleanall: clean clean-flisp clean-support $(build_shlibdir)/libGCCheckerPlugin.$(SHLIB_EXT): $(SRCDIR)/clangsa/GCChecker.cpp @$(call PRINT_CC, $(CXX) -g -shared -fno-rtti -fPIC -o $@ -std=c++11 -DCLANG_PLUGIN -I$(build_includedir) -I$(LLVM_SRC_DIR)/include -L$(build_libdir) $< -lclangAnalysis -lclangStaticAnalyzerCore -lclangASTMatchers -lclangAST -lclangLex -lclangBasic) +# Throw an error if a proper version of `clang` is not available. +analyzegc-deps-check: +ifeq ($(USE_BINARYBUILDER_LLVM),0) +ifneq ($(BUILD_LLVM_CLANG),1) + $(error Clang must be available to use the clang analyzer. Either build it (BUILD_LLVM_CLANG) or use BinaryBuilder) +endif +endif + + define CLANG_ANALYZE -clang-sa-$(1): $$(build_shlibdir)/libGCCheckerPlugin.$$(SHLIB_EXT) +clang-sa-$(1): $$(build_shlibdir)/libGCCheckerPlugin.$$(SHLIB_EXT) | analyzegc-deps-check @$$(call PRINT_ANALYZE, $$(build_depsbindir)/clang --analyze -Xanalyzer -analyzer-output=text -Xclang -load -Xclang $$(build_shlibdir)/libGCCheckerPlugin.$$(SHLIB_EXT) $$(CPPFLAGS) $$(CFLAGS) $$(DEBUGFLAGS) -Xclang -analyzer-checker=core$$(COMMA)julia.GCChecker --analyzer-no-default-checks -fcolor-diagnostics -Werror -x c $$(SRCDIR)/$(1).c) .PHONY: clang-sa-$(1) + +# Add this as a target of `analyzegc` +analyzegc: clang-sa-$(1) endef # Build a Makefile target for each file we want to analyze @@ -339,12 +351,6 @@ $(foreach S,$(RUNTIME_C_SRCS),$(eval $(call CLANG_ANALYZE,$(S)))) # before attempting this static analysis, so that all necessary headers # and dependencies are properly installed: # make -c deps install-libuv install-utf8proc install-unwind -analyzegc: $(BUILDDIR)/julia_version.h $(BUILDDIR)/julia_flisp.boot.inc $(build_shlibdir)/libGCCheckerPlugin.$(SHLIB_EXT) -ifeq ($(USE_BINARYBUILDER_LLVM),0) -ifneq ($(BUILD_LLVM_CLANG),1) - $(error Clang must be available to use the clang analyzer. Either build it (BUILD_LLVM_CLANG) or use BinaryBuilder) -endif -endif - $(MAKE) $(addprefix clang-sa-,$(RUNTIME_C_SRCS)) +analyzegc: $(BUILDDIR)/julia_version.h $(BUILDDIR)/julia_flisp.boot.inc .PHONY: default all debug release clean cleanall clean-* libccalltest libllvmcalltest julia_flisp.boot.inc.phony