summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2006-09-18 16:14:11 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2006-09-18 16:14:11 -0700
commit8681d431516979dcffd1ca7a65d47026d8ad0336 (patch)
tree06430197d756c4df3cd5d3209f092a70709939a7
parentd19e0d1fe15de6b9a2bfffe30bd041497c021eaf (diff)
Add hooks for running code checkers like sparse & lint over the source
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac10
-rw-r--r--src/Makefile.am18
3 files changed, 32 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 6aacfa8..273cbed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,3 +32,8 @@ ChangeLog:
git-log > ChangeLog
dist-hook: ChangeLog
+
+if LINT
+lint:
+ (cd src && $(MAKE) $(MFLAGS) lint)
+endif LINT
diff --git a/configure.ac b/configure.ac
index bab898c..3c9dbec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,3 @@
-dnl $Id$
dnl
dnl Copyright 2005 Red Hat, Inc.
dnl
@@ -30,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
@@ -44,6 +47,11 @@ XORG_CHECK_MALLOC_ZERO
XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
+dnl Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xv])
+LINT_FLAGS="${LINT_FLAGS} ${XV_CFLAGS}"
+
AC_OUTPUT([Makefile
include/Makefile
include/X11/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index e1d7ff4..394233f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,3 +8,21 @@ libXv_la_LIBADD = @XV_LIBS@
AM_CFLAGS = @XV_CFLAGS@ -I$(top_srcdir)/include @MALLOC_ZERO_CFLAGS@
libXv_la_LDFLAGS = -version-number 1:0:0 -no-undefined
+
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS)
+
+lint:
+ $(LINT) $(ALL_LINT_FLAGS) $(libXv_la_SOURCES) $(XV_LIBS)
+endif LINT
+
+if MAKE_LINT_LIB
+lintlibdir = $(libdir)
+
+lintlib_DATA = $(LINTLIB)
+
+$(LINTLIB): $(libXau_la_SOURCES)
+ $(LINT) -y -oXv -x $(ALL_LINT_FLAGS) $(libXv_la_SOURCES)
+endif MAKE_LINT_LIB
+