Index: configure.ac
===================================================================
RCS file: /cvsroot/ltp/ltp/configure.ac,v
retrieving revision 1.13
diff -u -r1.13 configure.ac
--- configure.ac	25 May 2009 15:01:45 -0000	1.13
+++ configure.ac	12 Jul 2009 05:46:28 -0000
@@ -2,15 +2,19 @@
 AC_INIT([ltp], [cvs], [ltp-results@lists.sourceforge.net])
 AM_INIT_AUTOMAKE([1.10])
 AC_CONFIG_HEADERS([include/config.h])
-AC_CONFIG_FILES([config.mk m4/Makefile])
+AC_CONFIG_FILES([ include/mk/config.mk lib/ltp.pc ltp-devel.spec m4/Makefile \
+README.ltp-devel ])
 
 AC_CANONICAL_HOST
 AC_PROG_CC
 AC_PROG_AR
 AC_PROG_RANLIB
+AC_PREFIX_DEFAULT(/opt/ltp)
 
 AC_CHECK_HEADERS_ONCE([ \
 ifaddrs.h \
+libaio.h \
+mm.h \
 sys/capability.h \
 sys/inotify.h \
 ])
Index: config.mk.in
===================================================================
RCS file: config.mk.in
diff -N config.mk.in
--- config.mk.in	31 Mar 2009 13:58:13 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-CC = @CC@
-AR = @AR@
-RANLIB = @RANLIB@
-
-CPPFLAGS = @CPPFLAGS@
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
-
-AIO_LIBS = @AIO_LIBS@
-SELINUX_LIBS = @SELINUX_LIBS@
-CRYPTO_LIB = @CRYPTO_LIB@
Index: ltp-devel.spec.in
===================================================================
RCS file: ltp-devel.spec.in
diff -N ltp-devel.spec.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ltp-devel.spec.in	12 Jul 2009 05:46:28 -0000
@@ -0,0 +1,68 @@
+#
+# RPM Package Manager (RPM) spec file for ltp-devel
+#
+Summary: Linux Test Project (LTP) Software Development Kit (SDK)
+Name: ltp-devel
+Version: 2.0
+Release: 0.0
+Prefix: @prefix@
+License: GPL
+Group: Development/Libraries
+URL: http://www.linuxtestproject.org
+Vendor: IBM Corp
+Packager: Subrata Modak <subrata.modak@@in.ibm.com>
+AutoReqProv:    0
+Provides:       LTP
+#ExclusiveArch:  i386
+ExclusiveOS:    linux
+%description
+This is a development package of the Linux Test Project (LTP).
+It is intended to be used to build testcases using the provided API.
+%files
+@prefix@/lib/libltp.a
+@datarootdir@/pkgconfig/ltp.pc
+@prefix@/bin/ltp-pan
+@prefix@/bin/ltp-scanner
+@prefix@/bin/ltp-bump
+@prefix@/include/linux_syscall_numbers.h
+@prefix@/include/libtestsuite.h
+@prefix@/include/usctest.h
+@prefix@/include/string_to_tokens.h
+@prefix@/include/str_to_bytes.h
+@prefix@/include/databin.h
+@prefix@/include/open_flags.h
+@prefix@/include/write_log.h
+@prefix@/include/dataascii.h
+@prefix@/include/forker.h
+@prefix@/include/compiler.h
+@prefix@/include/test.h
+@prefix@/include/tlibio.h
+@prefix@/include/pattern.h
+@prefix@/include/file_lock.h
+@prefix@/include/random_range.h
+@prefix@/include/search_path.h
+@prefix@/include/rmobj.h
+@mandir@/man3/tst_tmpdir.3
+@mandir@/man3/random_range_seed.3
+@mandir@/man3/pattern.3
+@mandir@/man3/parse_ranges.3
+@mandir@/man3/usctest.3
+@mandir@/man3/random_range.3
+@mandir@/man3/forker.3
+@mandir@/man3/rmobj.3
+@mandir@/man3/parse_open_flags.3
+@mandir@/man3/tst_res.3
+@mandir@/man3/write_log.3
+@mandir@/man3/str_to_bytes.3
+@mandir@/man3/tst_set_error.3
+@mandir@/man3/parse_opts.3
+@mandir@/man3/string_to_tokens.3
+@mandir@/man3/tst_sig.3
+@mandir@/man3/get_attrib.3
+@mandir@/man1/ltp-pan.1
+@mandir@/man1/doio.1
+@mandir@/man1/iogen.1
+@mandir@/man1/ltp-bump.1
+# Post-install stuff would go here.
+#EOF
+
Index: README.ltp-devel.in
===================================================================
RCS file: README.ltp-devel.in
diff -N README.ltp-devel.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ README.ltp-devel.in	12 Jul 2009 05:46:28 -0000
@@ -0,0 +1,48 @@
+This is a README to describe the ltp-devel.patch functional changes.
+
+"make install" is to build and install:
+
+	@prefix@/bin/ltp-bump
+	@prefix@/bin/ltp-pan
+	@prefix@/bin/ltp-scanner
+	@prefix@/lib/libltp.a
+	@datarootdir@/pkgconfig/ltp.pc
+	@prefix@/include/
+	@mandir@
+
+"make package" is to rpm package what was installed above:
+
+	/usr/src/redhat/RPMS/i386/ltp-devel-1.0-0.0.i386.rpm
+
+For someone wanting to write a standalone test that uses "libltp.a", then
+their Makefile would compile their test program like this:
+
+	test: test.c
+		cc test.c `pkg-config --cflags --libs ltp`
+
+To read manual pages, then the developer would type:
+(Most Important man pages)
+
+	man usctest
+	man ltp-pan
+	man tst_res
+	man tst_sig
+	man tst_set_error
+	man tst_tmpdir
+	man parse_opts
+
+(Others)
+	man ltp-bump
+	man doio
+	man iogen
+	man forker
+	man pattern
+	man random_range_seed
+	man string_to_tokens
+	man get_attrib
+	man parse_open_flags
+	man parse_ranges
+	man random_range
+	man rmobj
+	man str_to_bytes
+	man write_log
Index: include/mk/config.mk.in
===================================================================
RCS file: include/mk/config.mk.in
diff -N include/mk/config.mk.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ include/mk/config.mk.in	12 Jul 2009 05:46:28 -0000
@@ -0,0 +1,82 @@
+#
+#    config.mk.in.
+#
+#    Copyright (C) 2009, Cisco Systems Inc.
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Garrett Cooper, July 2009
+#
+
+# Application specifying variables. You should never have to change these.
+AR		= @AR@
+CC		= @CC@
+RANLIB		= @RANLIB@
+
+RPMBUILD	?= rpmbuild
+
+AIO_LIBS	= @AIO_LIBS@
+CRYPTO_LIB	= @CRYPTO_LIB@
+SELINUX_LIBS	= @SELINUX_LIBS@
+
+prefix		= @prefix@
+
+datarootdir	= @datarootdir@
+includedir	= @includedir@
+exec_prefix	= @exec_prefix@
+libdir		= @libdir@
+mandir		= @mandir@
+
+srcdir		?= .
+
+# Avoid overwriting definitions in leaf callers.
+CPPFLAGS	?= @CPPFLAGS@ -I$(includedir)
+CFLAGS		?= @CFLAGS@
+LDLIBS		?= @LIBS@
+LDFLAGS		?= @LDFLAGS@ -L$(libdir)
+
+DEBUG_CFLAGS	?= -g
+DEBUG_CXXFLAGS	?= $(DEBUG_CFLAGS)
+
+CFLAGS		+= $(DEBUG_CFLAGS)
+CXXFLAGS	+= $(DEBUG_CXXFLAGS)
+
+# There have been several bugs in the past related to -O2+ when
+# -fno-strict-aliasing is not specified.
+OPT_CFLAGS	?= -O2 -fno-strict-aliasing
+OPT_CXXFLAGS	?= $(OPT_CFLAGS)
+
+CFLAGS		+= $(OPT_CFLAGS)
+CXXFLAGS	+= $(OPT_CXXFLAGS)
+
+WCFLAGS		?= -Wall
+WCXXFLAGS	?= $(WCFLAGS)
+
+CFLAGS		+= $(WCFLAGS)
+CXXFLAGS	+= $(WCXXFLAGS)
+
+LDFLAGS		+= $(WLDFLAGS)
+
+# Only check for numa when not cross-compiling.
+ifeq ($(strip $(CROSS_COMPILE)),1)
+# Disable all undetectable cross-compilation required items.
+HAS_NUMA	?= 0
+else
+# Only check for numa when not cross-compiling.
+HAS_NUMA	?= $(shell sh $(top_srcdir)/tools/scripts/numa_test.sh 2>/dev/null)
+endif
+
+#export AR CC CFLAGS CPPFLAGS LDLIBS LDFLAGS RANLIB
+export datarootdir includedir libdir mandir prefix
Index: include/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/include/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- include/Makefile	23 Jun 2009 14:18:16 -0000	1.7
+++ include/Makefile	12 Jul 2009 05:46:28 -0000
@@ -1,27 +1,46 @@
+#
+#    include Makefile.
+#
+#    Copyright (C) 2009, Cisco Systems Inc.
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Garrett Cooper, July 2009
+#
+
+top_srcdir		?= ..
+
+include $(top_srcdir)/include/mk/master_include.mk
+
+CLEAN_DEPS		:= ac-clean
+
+INSTALL_DIR		:= $(includedir)
 
+INSTALL_MODE		:= 00644
 
-PREFIX=/opt/ltp
-HEADERS=compiler.h dataascii.h databin.h file_lock.h forker.h open_flags.h \
-	pattern.h random_range.h rmobj.h search_path.h string_to_tokens.h \
-	str_to_bytes.h test.h tlibio.h usctest.h write_log.h \
-	linux_syscall_numbers.h libtestsuite.h config.h
-
-.PHONY: all install
-all:
-
-install: $(HEADERS)
-	@set -e; for i in $(HEADERS); do \
-		install -D -m 644 $$i $(DESTDIR)/$(PREFIX)/include/ltp/$$i; \
-	done
+INSTALL_TARGETS		:= $(wildcard $(srcdir)/*.h)
 
-.PHONY: clean distclean maintainer-clean
-clean: ac-clean
+MAKE_TARGETS		:=
+
+.PHONY: ac-clean ac-distclean ac-maintainer-clean distclean maintainer-clean
 distclean: clean ac-distclean
 maintainer-clean: distclean ac-maintainer-clean
-
-.PHONY: ac-clean ac-distclean ac-maintainerclean
 ac-clean:
 ac-distclean:
-	rm -f config.h
+	$(RM) -f config.h
 ac-maintainer-clean:
-	rm -f config.h.in
+	$(RM) -f config.h.in
+
+$(eval $(generic_leaf_target))
Index: lib/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/lib/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- lib/Makefile	3 Apr 2009 06:58:18 -0000	1.16
+++ lib/Makefile	12 Jul 2009 05:46:28 -0000
@@ -1,26 +1,44 @@
+#
+#    lib Makefile.
+#
+#    Copyright (C) 2009, Cisco Systems Inc.
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Garrett Cooper, July 2009
+#
 
-PREFIX=/opt/ltp
+top_srcdir		?= ..
+
+include $(top_srcdir)/include/mk/lib.mk
 
-CFLAGS+= -Wall
-CPPFLAGS+= -I../include 
 ifeq ($(shell uname -s),HP-UX)
-CFLAGS+=-Ae -D_LARGEFILE64_SOURCE +DA1.1
+CFLAGS			+=-Ae -D_LARGEFILE64_SOURCE +DA1.1
 endif
 ifeq ($(UCLINUX),1)
-CFLAGS+= -D_USC_LIB_ -D__UCLIBC__ -DUCLINUX
+CFLAGS			+= -D_USC_LIB_ -D__UCLIBC__ -DUCLINUX
 endif
-LDFLAGS+=
-TARGET=libltp.a
-SRCS=$(wildcard *.c)
-OBJS=$(patsubst %.c,%.o,$(SRCS))
-
-$(TARGET): $(OBJS)
-	$(AR) -cr $@ $^
-
-clean:
-	rm -f $(TARGET) $(OBJS)
-
-install: $(TARGET)
-	install -D -m 644 $(TARGET) $(DESTDIR)/$(PREFIX)/lib$(LIBSUFFIX)/$(TARGET)
-	install -D -m 644 ltp.pc $(DESTDIR)/$(PREFIX)/share/pkgconfig/ltp.pc
 
+LIB			:= libltp.a
+
+pc_file			:= $(DESTDIR)/$(datarootdir)/pkgconfig/ltp.pc
+
+INSTALL_TARGETS		:= $(pc_file)
+
+$(pc_file):
+	test -d "$(@D)" || mkdir -p "$(@D)"
+	install -m $(INSTALL_MODE) "$(srcdir)/$(@F)" "$@"
+
+$(eval $(lib_target))
Index: lib/ltp.pc.in
===================================================================
RCS file: lib/ltp.pc.in
diff -N lib/ltp.pc.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ lib/ltp.pc.in	12 Jul 2009 05:46:28 -0000
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+includedir=@includedir@
+libdir=@libdir@
+
+Name: LTP
+Description: Linux Test Project
+Version: 1.0
+Libs: -L${libdir} -lltp
+Cflags: -I${includedir}
+Libs.private: -L${libdir} -lltp 
Index: m4/GNUmakefile
===================================================================
RCS file: /cvsroot/ltp/ltp/m4/GNUmakefile,v
retrieving revision 1.1
diff -u -r1.1 GNUmakefile
--- m4/GNUmakefile	18 Jan 2009 22:22:40 -0000	1.1
+++ m4/GNUmakefile	12 Jul 2009 05:46:28 -0000
@@ -1,12 +1,37 @@
+#
+#    m4 Makefile.
+#
+#    Copyright (C) 2009, Cisco Systems Inc.
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Garrett Cooper, July 2009
+#
 
+srcdir			?= ..
 
-PREFIX=/opt/ltp
-M4MACROS=$(notdir $(wildcard *.m4))
+include $(srcdir)/include/mk/master_include.mk
 
-all:
+M4MACROS		:= $(notdir $(wildcard *.m4))
 
-install: $(M4MACROS)
-	for i in $(M4MACROS); do \
-		install -D -m 644 $$i $(DESTDIR)/$(PREFIX)/share/aclocal/$$i; \
-	done
+INSTALL_DIR		:= $(datarootdir)/aclocal
 
+INSTALL_MODE		:= 00644
+
+INSTALL_TARGETS		:= $(M4_MACROS)
+
+MAKE_TARGETS		:=
+
+$(eval $(generic_leaf_target))
Index: pan/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/pan/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- pan/Makefile	19 May 2009 09:39:11 -0000	1.19
+++ pan/Makefile	12 Jul 2009 05:46:28 -0000
@@ -1,24 +1,39 @@
+#
+#    pan Makefile.
+#
+#    Copyright (C) 2009, Cisco Systems Inc.
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Garrett Cooper, July 2009
+#
+
+top_srcdir		?= ..
+
+include $(top_srcdir)/include/mk/master_include.mk
+
+LDLIBS			+= -lm
+LFLAGS			+= -l -w
+CFLAGS			+= -w 
 
-LOADLIBES += -lm
-LFLAGS += -l -w
-CFLAGS += -w 
-PREFIX = /opt/ltp
-
-all: ltp-pan ltp-bump ltp-scanner
-
-ltp-pan: ltp-pan.o zoolib.o splitstr.o
-
+MAKE_TARGETS		:= ltp-bump ltp-pan ltp-scanner
 
 ltp-bump: ltp-bump.o zoolib.o
 
+ltp-pan: ltp-pan.o zoolib.o splitstr.o
 
 ltp-scanner: scan.o ltp-scanner.o reporter.o tag_report.o symbol.o splitstr.o debug.o
 
-
-install: ltp-pan ltp-bump ltp-scanner
-	install -D ltp-scanner $(DESTDIR)/$(PREFIX)/bin/ltp-scanner
-	install -D ltp-pan $(DESTDIR)/$(PREFIX)/bin/ltp-pan
-	install -D ltp-bump $(DESTDIR)/$(PREFIX)/bin/ltp-bump
-
-clean:
-	rm -f *.o ltp-pan ltp-bump ltp-scanner
+$(eval $(generic_leaf_target))
