1*9152e1c5SLionel Sambuc# $NetBSD: bsd.clang-analyze.mk,v 1.3 2012/04/04 10:37:18 joerg Exp $ 2*9152e1c5SLionel Sambuc 3*9152e1c5SLionel Sambuc.ifndef CLANG_ANALYZE_SRCS 4*9152e1c5SLionel Sambuc 5*9152e1c5SLionel SambucCLANG_ANALYZE_FLAGS+= --analyze 6*9152e1c5SLionel Sambuc 7*9152e1c5SLionel SambucCLANG_ANALYZE_CHECKERS+= core deadcode security unix 8*9152e1c5SLionel Sambuc 9*9152e1c5SLionel Sambuc.for checker in ${CLANG_ANALYZE_CHECKERS} 10*9152e1c5SLionel SambucCLANG_ANALYZE_FLAGS+= -Xanalyzer -analyzer-checker=${checker} 11*9152e1c5SLionel Sambuc.endfor 12*9152e1c5SLionel Sambuc 13*9152e1c5SLionel Sambuc.SUFFIXES: .c .cc .cpp .cxx .C .clang-analyzer 14*9152e1c5SLionel Sambuc 15*9152e1c5SLionel SambucCLANG_ANALYZE_CFLAGS= ${CFLAGS:N-Wa,--fatal-warnings} 16*9152e1c5SLionel SambucCLANG_ANALYZE_CXXFLAGS= ${CXXFLAGS:N-Wa,--fatal-warnings} 17*9152e1c5SLionel Sambuc 18*9152e1c5SLionel Sambuc.c.clang-analyzer: 19*9152e1c5SLionel Sambuc ${TOOL_CC.clang} ${CLANG_ANALYZE_FLAGS} \ 20*9152e1c5SLionel Sambuc ${CLANG_ANALYZE_CFLAGS} ${CPPFLAGS} \ 21*9152e1c5SLionel Sambuc ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ 22*9152e1c5SLionel Sambuc ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 23*9152e1c5SLionel Sambuc.cc.clang-analyzer .cpp.clang-analyzer .cxx.clang-analyzer .C.clang-analyzer: 24*9152e1c5SLionel Sambuc ${TOOL_CXX.clang} ${CLANG_ANALYZE_FLAGS} \ 25*9152e1c5SLionel Sambuc ${CLANG_ANALYZE_CXXFLAGS} ${CPPFLAGS} \ 26*9152e1c5SLionel Sambuc ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} \ 27*9152e1c5SLionel Sambuc ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} 28*9152e1c5SLionel Sambuc 29*9152e1c5SLionel SambucCLANG_ANALYZE_SRCS= \ 30*9152e1c5SLionel Sambuc ${SRCS:M*.[cC]} ${SRCS:M*.cc} \ 31*9152e1c5SLionel Sambuc ${SRCS:M*.cpp} ${SRCS:M*.cxx} \ 32*9152e1c5SLionel Sambuc ${DPSRCS:M*.[cC]} ${DPSRCS:M*.cc} \ 33*9152e1c5SLionel Sambuc ${DPSRCS:M*.cpp} ${DPSRCS:M*.cxx} 34*9152e1c5SLionel Sambuc.if !empty(CLANG_ANALYZE_SRCS) 35*9152e1c5SLionel SambucCLANG_ANALYZE_OUTPUT= ${CLANG_ANALYZE_SRCS:R:S,$,.clang-analyzer,} 36*9152e1c5SLionel Sambuc.endif 37*9152e1c5SLionel Sambuc 38*9152e1c5SLionel Sambucanalyze: ${CLANG_ANALYZE_OUTPUT} 39*9152e1c5SLionel Sambuc 40*9152e1c5SLionel Sambuc.endif 41