Skip to content

Commit

Permalink
Eliminate recursive make call
Browse files Browse the repository at this point in the history
  • Loading branch information
staticfloat committed May 28, 2019
1 parent 8738b01 commit 0be1017
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 0be1017

Please sign in to comment.