1 # $NetBSD: bsd.clang-analyze.mk,v 1.3 2012/04/04 10:37:18 joerg Exp $
3 .
ifndef CLANG_ANALYZE_SRCS
5 CLANG_ANALYZE_FLAGS
+= --analyze
7 CLANG_ANALYZE_CHECKERS
+= core deadcode security unix
9 .for checker in
${CLANG_ANALYZE_CHECKERS}
10 CLANG_ANALYZE_FLAGS
+= -Xanalyzer
-analyzer-checker
=${checker}
13 .SUFFIXES
: .c .
cc .
cpp .
cxx .C .clang-analyzer
15 CLANG_ANALYZE_CFLAGS
= ${CFLAGS
:N-Wa
,--fatal-warnings
}
16 CLANG_ANALYZE_CXXFLAGS
= ${CXXFLAGS
:N-Wa
,--fatal-warnings
}
19 ${TOOL_CC.clang
} ${CLANG_ANALYZE_FLAGS} \
20 ${CLANG_ANALYZE_CFLAGS} ${CPPFLAGS} \
21 ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} \
22 ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
}
23 .
cc.clang-analyzer .
cpp.clang-analyzer .
cxx.clang-analyzer .C.clang-analyzer
:
24 ${TOOL_CXX.clang
} ${CLANG_ANALYZE_FLAGS} \
25 ${CLANG_ANALYZE_CXXFLAGS} ${CPPFLAGS} \
26 ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} \
27 ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
}
30 ${SRCS
:M
*.
[cC
]} ${SRCS
:M
*.
cc} \
31 ${SRCS
:M
*.
cpp} ${SRCS
:M
*.
cxx} \
32 ${DPSRCS
:M
*.
[cC
]} ${DPSRCS
:M
*.
cc} \
33 ${DPSRCS
:M
*.
cpp} ${DPSRCS
:M
*.
cxx}
34 .if
!empty
(CLANG_ANALYZE_SRCS
)
35 CLANG_ANALYZE_OUTPUT
= ${CLANG_ANALYZE_SRCS
:R
:S
,$,.clang-analyzer
,}
38 analyze
: ${CLANG_ANALYZE_OUTPUT}