summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2007-11-27 17:54:34 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2007-11-27 17:54:34 -0800
commit1614ea1074d62f32f51032141b0c55250380ca17 (patch)
treeeb431471e3d93ef0dfb75648b890e4050674ffd9
parent8a2bb8793eed1c7f690be5c00772b2a64b9632fd (diff)
Add hooks for checking code with lint/sparse/etc.
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac9
-rw-r--r--src/Makefile.am16
3 files changed, 30 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 0ee0095..a7443ff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,3 +11,8 @@ ChangeLog:
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 bb595e6..6cd40f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,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)
+
# Determine .so library version per platform
# based on SharedXextRev in monolith xc/config/cf/*Lib.tmpl
AC_CANONICAL_HOST
@@ -45,6 +49,11 @@ XORG_RELEASE_VERSION
XORG_PROG_RAWCPP
XORG_MANPAGE_SECTIONS
+dnl Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xext])
+LINT_FLAGS="${LINT_FLAGS} ${XEXT_CFLAGS}"
+
AC_OUTPUT([Makefile
man/Makefile
src/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index fbe8b24..bfd3740 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,3 +23,19 @@ libXext_la_SOURCES = \
extutil.c \
globals.c
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS)
+
+lint:
+ $(LINT) $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) $(XEXT_LIBS)
+endif LINT
+
+if MAKE_LINT_LIB
+lintlibdir = $(libdir)
+
+lintlib_DATA = $(LINTLIB)
+
+$(LINTLIB): $(libXext_la_SOURCES)
+ $(LINT) -y -oXext -x $(ALL_LINT_FLAGS) $(libXext_la_SOURCES)
+endif MAKE_LINT_LIB