summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac8
-rw-r--r--src/Makefile.am15
3 files changed, 29 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 77a88c8..725a8e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,3 +34,9 @@ ChangeLog:
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
dist-hook: ChangeLog
+
+if LINT
+# Check source code with tools like lint & sparse
+lint:
+ (cd src && $(MAKE) $(MFLAGS) lint)
+endif LINT
diff --git a/configure.ac b/configure.ac
index ef80ce0..8ccfb7b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,10 @@ AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
+# Require xorg-macros version 1.1.0 or newer for XORG_WITH_LINT macro
+m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.1)
+
# Check for progs
AC_PROG_CC
AC_PROG_LIBTOOL
@@ -38,6 +42,10 @@ PKG_CHECK_MODULES(XSCRNSAVER, x11 xext xextproto [scrnsaverproto >= 1.1])
AC_SUBST(XSCRNSAVER_CFLAGS)
AC_SUBST(XSCRNSAVER_LIBS)
+
+dnl Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xss])
XORG_CHECK_MALLOC_ZERO
XORG_MANPAGE_SECTIONS
diff --git a/src/Makefile.am b/src/Makefile.am
index 10f8eea..3430a27 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,4 +8,19 @@ libXss_la_LIBADD = $(XSCRNSAVER_LIBS)
libXss_la_LDFLAGS = -version-info 1:0:0 -no-undefined
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
+lint:
+ $(LINT) $(ALL_LINT_FLAGS) $(libXss_la_SOURCES)
+endif LINT
+
+if MAKE_LINT_LIB
+lintlibdir = $(libdir)
+
+lintlib_DATA = $(LINTLIB)
+
+$(LINTLIB): $(libXss_la_SOURCES)
+ $(LINT) -y -oXss -x $(ALL_LINT_FLAGS) $(libXss_la_SOURCES)
+endif MAKE_LINT_LIB