summaryrefslogtreecommitdiff
path: root/librdfa/Makefile.am
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2013-11-08 08:45:18 -0800
committerDave Beckett <dave@dajobe.org>2013-11-08 08:45:18 -0800
commitd56cd106a2a79e18559bccaef167f940317e7598 (patch)
tree63e2f0524d4a54964aa6151fd5e8367ad5d16323 /librdfa/Makefile.am
parentb9bd0316a30b9bc3994934ddcb869c0a4a02a098 (diff)
downloadraptor-d56cd106a2a79e18559bccaef167f940317e7598.tar.gz
Add analyze target
Diffstat (limited to 'librdfa/Makefile.am')
-rw-r--r--librdfa/Makefile.am26
1 files changed, 26 insertions, 0 deletions
diff --git a/librdfa/Makefile.am b/librdfa/Makefile.am
index 1be09e4a..6391e0bb 100644
--- a/librdfa/Makefile.am
+++ b/librdfa/Makefile.am
@@ -3,6 +3,14 @@
# Makefile for librdfa convienience library
#
+ANALYZE = clang
+ANALYZE_FLAGS = "--analyze"
+# Based on COMPILE target
+ANALYZE_COMMAND = $(ANALYZE) \
+ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \
+ $(ANALYZE_FLAGS)
+
if LIBRDFA
noinst_LTLIBRARIES = librdfa.la
AM_CPPFLAGS = -DLIBRDFA_IN_RAPTOR -I$(srcdir)
@@ -53,3 +61,21 @@ strtok_r.h \
config.h
endif
+
+if MAINTAINER_MODE
+# Run Clang static analyzer over sources.
+analyze: $(SOURCES)
+ @list='$(SOURCES)'; \
+ result=0; \
+ for file in $$list; do \
+ if echo $$file | grep '\.c$$' >/dev/null 2>&1; then \
+ $(RECHO) "Analyzing $$file"; \
+ $(ANALYZE_COMMAND) $(srcdir)/$$file; \
+ status=$$?; \
+ if test $$status != 0; then \
+ result=1; \
+ fi; \
+ fi; \
+ done; \
+ set -e; exit $$result
+endif