summaryrefslogtreecommitdiff
path: root/ltp_framework/include/mk
diff options
context:
space:
mode:
Diffstat (limited to 'ltp_framework/include/mk')
-rw-r--r--ltp_framework/include/mk/automake.mk117
-rw-r--r--ltp_framework/include/mk/config.mk82
-rw-r--r--ltp_framework/include/mk/config.mk.default76
-rw-r--r--ltp_framework/include/mk/config.mk.in82
-rw-r--r--ltp_framework/include/mk/env_post.mk104
-rw-r--r--ltp_framework/include/mk/env_pre.mk144
-rw-r--r--ltp_framework/include/mk/features.mk55
-rw-r--r--ltp_framework/include/mk/features.mk.default55
-rw-r--r--ltp_framework/include/mk/features.mk.in55
-rw-r--r--ltp_framework/include/mk/functions.mk76
-rw-r--r--ltp_framework/include/mk/generic_leaf_target.inc106
-rw-r--r--ltp_framework/include/mk/generic_leaf_target.mk24
-rw-r--r--ltp_framework/include/mk/generic_trunk_target.inc97
-rw-r--r--ltp_framework/include/mk/generic_trunk_target.mk24
-rw-r--r--ltp_framework/include/mk/gitignore.mk51
-rw-r--r--ltp_framework/include/mk/lib.mk64
-rw-r--r--ltp_framework/include/mk/man.mk37
-rw-r--r--ltp_framework/include/mk/testcases.mk55
18 files changed, 1304 insertions, 0 deletions
diff --git a/ltp_framework/include/mk/automake.mk b/ltp_framework/include/mk/automake.mk
new file mode 100644
index 0000000..e5a4fe0
--- /dev/null
+++ b/ltp_framework/include/mk/automake.mk
@@ -0,0 +1,117 @@
+#
+# Autotools 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
+#
+
+# Override these variables to use non-system available tools.
+ACLOCAL ?= aclocal
+AUTOCONF ?= autoconf
+AUTOHEADER ?= autoheader
+AUTOMAKE ?= automake
+
+AUTOCONFED_SUBDIRS = \
+ testcases/realtime
+
+# We want to run this every single time to ensure that all of the prereq files
+# are there.
+.PHONY: testcases/realtime/configure
+testcases/realtime/configure:
+ $(MAKE) -C $(@D) autotools
+
+.PHONY: autotools
+autotools: aclocal autoconf autoheader automake $(addsuffix /configure,$(AUTOCONFED_SUBDIRS))
+
+.PHONY: aclocal
+aclocal: aclocal.m4
+
+aclocal.m4: $(wildcard m4/*.m4) m4/ltp-version.m4
+ $(ACLOCAL) -I m4
+
+.PHONY: autoconf
+autoconf: configure
+
+configure: configure.ac aclocal.m4
+ $(AUTOCONF)
+
+.PHONY: autoheader
+autoheader: configure.ac $(wildcard m4/*.m4) m4/ltp-version.m4 aclocal.m4
+ $(AUTOHEADER)
+
+include:
+ mkdir -p "$@"
+
+m4/ltp-version.m4: ChangeLog
+ sed -n '1{s:LTP-:m4_define([LTP_VERSION],[:;s:$$:]):;p;q}' $< > $@
+
+.PHONY: automake
+AUTOMAKE_FILES := config.guess config.sub install-sh missing stamp-h1
+automake: aclocal $(AUTOMAKE_FILES)
+$(AUTOMAKE_FILES): m4/Makefile.in
+m4/Makefile.in: m4/Makefile.am aclocal.m4
+ $(AUTOMAKE) -c -a
+
+.PHONY: ac-clean ac-distclean ac-maintainer-clean
+ac-clean::
+ $(RM) -rf autom4te.cache
+ $(RM) -f config.log config.status
+ $(RM) -f include/config.h include/stamp-h1
+ $(RM) -f m4/Makefile m4/ltp-version.m4
+ for d in $(AUTOCONFED_SUBDIRS); do \
+ $(MAKE) -C "$(top_srcdir)/$$d" $@; \
+ done
+
+ac-distclean:: ac-clean
+ac-maintainer-clean:: ac-distclean
+ for d in $(AUTOCONFED_SUBDIRS); do \
+ $(MAKE) -C "$(top_srcdir)/$$d" $@; \
+ done
+ $(RM) -f aclocal.m4 configure $(AUTOMAKE_FILES) m4/Makefile.in
+ $(RM) -f include/*config.h.in
+
+# Don't include config.h, or make will (rightfully) whine about overriding
+# rules.
+#
+# This list should match the files in configure.ac.
+#
+AUTOGENERATED_FILES = \
+ include/mk/config.mk \
+ include/mk/features.mk \
+ lib/ltp.pc \
+ m4/Makefile \
+ ltp-devel.spec \
+ execltp \
+ README.ltp-devel
+
+distclean:: %: clean ac-distclean
+ for d in $(AUTOCONFED_SUBDIRS); do \
+ $(MAKE) -C "$(top_srcdir)/$$d" $@; \
+ done
+ $(RM) -f $(AUTOGENERATED_FILES)
+
+maintainer-clean:: distclean ac-maintainer-clean
+
+$(AUTOGENERATED_FILES): $(top_builddir)/config.status
+ $(SHELL) $^
+
+# This variable is automatically changed from help to all once someone has
+# run configure, or the equivalent steps manually, as described in INSTALL.
+$(abs_top_builddir)/include/mk/config.mk \
+$(abs_top_builddir)/include/mk/features.mk:
+ $(MAKE) -C $(top_srcdir) help; false
diff --git a/ltp_framework/include/mk/config.mk b/ltp_framework/include/mk/config.mk
new file mode 100644
index 0000000..de7a353
--- /dev/null
+++ b/ltp_framework/include/mk/config.mk
@@ -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
+#
+
+# See this page for more info about LEX*:
+# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html
+
+# Application specifying variables. You should never have to change these.
+AR := arm-linux-gnueabi-ar
+CC := arm-linux-gnueabi-gcc
+LEX := :
+RANLIB := arm-linux-gnueabi-ranlib
+STRIP := arm-linux-gnueabi-strip
+YACC := yacc
+
+# XXX: I'm lazy... but if someone has a working javac, they should have a
+# working jar on their systems.
+JAR := jar
+JAVAC := @JAVAC@
+
+AIO_LIBS :=
+CAP_LIBS :=
+ACL_LIBS :=
+CRYPTO_LIBS :=
+LEXLIB :=
+NUMA_CPPFLAGS :=
+NUMA_LIBS :=
+SELINUX_LIBS :=
+
+prefix := /opt/ltp
+
+datarootdir := ${prefix}/share
+includedir := ${prefix}/include
+exec_prefix := ${prefix}
+bindir := ${exec_prefix}/bin
+libdir := ${exec_prefix}/lib
+mandir := ${datarootdir}/man
+
+RPMBUILD ?= rpmbuild
+
+CPPFLAGS :=
+CFLAGS := -g -O2
+LDLIBS :=
+LDFLAGS :=
+
+DEBUG_CFLAGS ?= -g
+DEBUG_CXXFLAGS ?= $(DEBUG_CFLAGS)
+
+# Please see README.mk-devel about -fstrict-aliasing.
+OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe
+OPT_CXXFLAGS ?= $(OPT_CFLAGS)
+
+WCFLAGS ?= -Wall
+WCXXFLAGS ?= $(WCFLAGS)
+
+LDFLAGS += $(WLDFLAGS)
+CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS)
+CXXFLAGS += $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS)
+
+ifeq ($(strip $(prefix)),)
+$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree)
+endif
+
+export datarootdir includedir libdir mandir prefix
diff --git a/ltp_framework/include/mk/config.mk.default b/ltp_framework/include/mk/config.mk.default
new file mode 100644
index 0000000..8248071
--- /dev/null
+++ b/ltp_framework/include/mk/config.mk.default
@@ -0,0 +1,76 @@
+#
+# 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
+#
+
+# See this page for more info about LEX*:
+# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html
+
+# Application specifying variables. You should never have to change these.
+AR := ar
+CC := gcc
+LEX := flex
+RANLIB := ranlib
+STRIP := strip
+YACC := bison -y
+
+#JAR := jar
+#JAVAC := javac
+
+#AIO_LIBS := -laio
+#CAP_LIBS := -lcap
+#ACL_LIBS := -lacl
+#CRYPTO_LIBS := -lcrypto
+#LEXLIB := -lfl
+#NUMA_CPPFLAGS := -DNUMA_VERSION1_COMPATIBILITY
+#NUMA_LIBS := -lnuma
+#SELINUX_LIBS := -lselinux
+
+prefix := /opt/ltp
+
+datarootdir := ${prefix}/share
+includedir := ${prefix}/include
+exec_prefix := ${prefix}
+bindir := ${exec_prefix}/bin
+libdir := ${exec_prefix}/lib
+mandir := ${datarootdir}/man
+
+RPMBUILD ?= rpmbuild
+
+CPPFLAGS :=
+CFLAGS := -g -O2
+LDLIBS :=
+LDFLAGS :=
+
+DEBUG_CFLAGS ?= -g
+DEBUG_CXXFLAGS ?= $(DEBUG_CFLAGS)
+
+# Please see README.mk-devel about -fstrict-aliasing.
+OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe
+OPT_CXXFLAGS ?= $(OPT_CFLAGS)
+
+WCFLAGS ?= -Wall
+WCXXFLAGS ?= $(WCFLAGS)
+
+LDFLAGS += $(WLDFLAGS)
+CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS)
+CXXFLAGS += $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS)
+
+export datarootdir includedir libdir mandir prefix
diff --git a/ltp_framework/include/mk/config.mk.in b/ltp_framework/include/mk/config.mk.in
new file mode 100644
index 0000000..b835c86
--- /dev/null
+++ b/ltp_framework/include/mk/config.mk.in
@@ -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
+#
+
+# See this page for more info about LEX*:
+# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html
+
+# Application specifying variables. You should never have to change these.
+AR := @AR@
+CC := @CC@
+LEX := @LEX@
+RANLIB := @RANLIB@
+STRIP := @STRIP@
+YACC := @YACC@
+
+# XXX: I'm lazy... but if someone has a working javac, they should have a
+# working jar on their systems.
+JAR := jar
+JAVAC := @JAVAC@
+
+AIO_LIBS := @AIO_LIBS@
+CAP_LIBS := @CAP_LIBS@
+ACL_LIBS := @ACL_LIBS@
+CRYPTO_LIBS := @CRYPTO_LIBS@
+LEXLIB := @LEXLIB@
+NUMA_CPPFLAGS := @NUMA_CPPFLAGS@
+NUMA_LIBS := @NUMA_LIBS@
+SELINUX_LIBS := @SELINUX_LIBS@
+
+prefix := @prefix@
+
+datarootdir := @datarootdir@
+includedir := @includedir@
+exec_prefix := @exec_prefix@
+bindir := @bindir@
+libdir := @libdir@
+mandir := @mandir@
+
+RPMBUILD ?= rpmbuild
+
+CPPFLAGS := @CPPFLAGS@
+CFLAGS := @CFLAGS@
+LDLIBS := @LIBS@
+LDFLAGS := @LDFLAGS@
+
+DEBUG_CFLAGS ?= -g
+DEBUG_CXXFLAGS ?= $(DEBUG_CFLAGS)
+
+# Please see README.mk-devel about -fstrict-aliasing.
+OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe
+OPT_CXXFLAGS ?= $(OPT_CFLAGS)
+
+WCFLAGS ?= -Wall
+WCXXFLAGS ?= $(WCFLAGS)
+
+LDFLAGS += $(WLDFLAGS)
+CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS)
+CXXFLAGS += $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS)
+
+ifeq ($(strip $(prefix)),)
+$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree)
+endif
+
+export datarootdir includedir libdir mandir prefix
diff --git a/ltp_framework/include/mk/env_post.mk b/ltp_framework/include/mk/env_post.mk
new file mode 100644
index 0000000..ebaee1f
--- /dev/null
+++ b/ltp_framework/include/mk/env_post.mk
@@ -0,0 +1,104 @@
+#
+# Environment post-setup 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
+#
+
+ENV_PRE_LOADED ?= $(error You must load env_pre.mk before including this file)
+
+include $(top_srcdir)/include/mk/functions.mk
+
+ifndef ENV_POST_LOADED
+ENV_PRE_LOADED = 1
+
+# Default source search path. Modify as necessary, but I would call that
+# poor software design if you need more than one search directory, and
+# would suggest creating a general purpose static library to that end.
+vpath %.c $(abs_srcdir)
+
+# For config.h, et all.
+CPPFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include
+
+LDFLAGS += -L$(top_builddir)/lib
+
+ifeq ($(UCLINUX),1)
+CPPFLAGS += -D__UCLIBC__ -DUCLINUX
+endif
+
+MAKE_TARGETS ?= $(notdir $(patsubst %.c,%,$(wildcard $(abs_srcdir)/*.c)))
+
+MAKE_TARGETS := $(filter-out $(FILTER_OUT_MAKE_TARGETS),$(MAKE_TARGETS))
+
+CLEAN_TARGETS += $(MAKE_TARGETS) *.o *.pyc
+
+# Majority of the files end up in testcases/bin...
+INSTALL_DIR ?= testcases/bin
+
+ifneq ($(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS))
+
+ifeq ($(strip $(INSTALL_DIR)),)
+INSTALL_DIR := $(error You must define INSTALL_DIR before including this file)
+endif
+
+ifneq ($(strip $(prefix)),)
+# Value specified by INSTALL_DIR isn't an absolute path, so let's tack on $(prefix).
+ifneq ($(patsubst /%,,$(INSTALL_DIR)),)
+INSTALL_DIR := $(prefix)/$(INSTALL_DIR)
+endif
+
+# Glob any possible expressions, but make sure to zap the $(abs_srcdir)
+# reference at the start of the filename instead of using $(notdir), so that
+# way we don't accidentally nuke the relative path from $(abs_srcdir) that
+# may have been set in the Makefile.
+INSTALL_TARGETS := $(wildcard $(addprefix $(abs_srcdir)/,$(INSTALL_TARGETS)))
+INSTALL_TARGETS := $(patsubst $(abs_srcdir)/%,%,$(INSTALL_TARGETS))
+
+# The large majority of the files that we install are going to be apps and
+# scripts, so let's chmod them like that.
+INSTALL_MODE ?= 00775
+
+ifdef MAKE_3_80_COMPAT
+
+INSTALL_PATH := $(call MAKE_3_80_abspath,$(DESTDIR)/$(INSTALL_DIR))
+
+INSTALL_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(INSTALL_TARGETS)))
+MAKE_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(MAKE_TARGETS)))
+
+INSTALL_FILES := $(INSTALL_TARGETS_ABS) $(MAKE_TARGETS_ABS)
+
+$(INSTALL_TARGETS_ABS):
+ test -d "$(@D)" || mkdir -p "$(@D)"
+ install -m $(INSTALL_MODE) "$(abs_srcdir)/$(subst $(INSTALL_PATH)/,,$@)" "$@"
+
+$(MAKE_TARGETS_ABS):
+ test -d "$(@D)" || mkdir -p "$(@D)"
+ install -m $(INSTALL_MODE) "$(abs_builddir)/$(subst $(INSTALL_PATH)/,,$@)" "$@"
+else
+$(abspath $(addprefix $(DESTDIR)/$(INSTALL_DIR)/,$(sort $(dir $(INSTALL_TARGETS) $(MAKE_TARGETS))))):
+ mkdir -p "$@"
+$(foreach install_target,$(INSTALL_TARGETS),$(eval $(call generate_install_rule,$(install_target),$(abs_srcdir),$(INSTALL_DIR))))
+$(foreach make_target,$(MAKE_TARGETS),$(eval $(call generate_install_rule,$(make_target),$(abs_builddir),$(INSTALL_DIR))))
+endif
+
+else # else ! $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)
+$(error You must define $$(prefix) before executing install)
+endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)
+endif
+
+endif
diff --git a/ltp_framework/include/mk/env_pre.mk b/ltp_framework/include/mk/env_pre.mk
new file mode 100644
index 0000000..f1584a8
--- /dev/null
+++ b/ltp_framework/include/mk/env_pre.mk
@@ -0,0 +1,144 @@
+#
+# Make pre-include environment 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, September 2009
+#
+# This Makefile must be included first. NO IF'S, AND'S, OR BUT'S.
+#
+# This sets the stage for all operations required within Makefiles.
+#
+
+ifndef ENV_PRE_LOADED
+ENV_PRE_LOADED = 1
+
+# "out-of-build-tree" build.
+BUILD_TREE_BUILDDIR_INSTALL := 1
+# "in-srcdir" build / install.
+BUILD_TREE_SRCDIR_INSTALL := 2
+# "in-srcdir" build, non-srcdir install.
+BUILD_TREE_NONSRCDIR_INSTALL := 3
+# configure not run.
+BUILD_TREE_UNCONFIGURED := 4
+
+ifndef MAKE_VERSION_CHECK
+export MAKE_VERSION_CHECK = 1
+ifneq ($(firstword $(sort 3.80 $(MAKE_VERSION))),3.80)
+$(error Your version of make $(MAKE_VERSION) is too old. Upgrade to at least 3.80; 3.81+ is preferred)
+else
+ifneq ($(filter 3.80%,$(MAKE_VERSION)),)
+export MAKE_3_80_COMPAT := 1
+endif # make 3.80?
+endif # At least make 3.80?
+endif # MAKE_VERSION_CHECK
+
+# Get the absolute path for the source directory.
+top_srcdir ?= $(error You must define top_srcdir before including this file)
+
+include $(top_srcdir)/include/mk/functions.mk
+
+# Where's the root source directory?
+ifdef MAKE_3_80_COMPAT
+abs_top_srcdir := $(call MAKE_3_80_abspath,$(top_srcdir))
+else
+abs_top_srcdir := $(abspath $(top_srcdir))
+endif
+
+#
+# Where's the root object directory?
+#
+# Just in case it's not specified, set it to the top srcdir (because the user
+# must not have wanted out of build tree support)...
+#
+top_builddir ?= $(top_srcdir)
+
+# We need the absolute path...
+ifdef MAKE_3_80_COMPAT
+abs_top_builddir := $(call MAKE_3_80_abspath,$(top_builddir))
+else
+abs_top_builddir := $(abspath $(top_builddir))
+endif
+
+# Where's the root object directory?
+builddir := .
+
+abs_builddir := $(CURDIR)
+
+cwd_rel_from_top := $(subst $(abs_top_builddir),,$(abs_builddir))
+
+# Where's the source located at? Squish all of the / away by using abspath...
+ifdef MAKE_3_80_COMPAT
+abs_srcdir := $(call MAKE_3_80_abspath,$(abs_top_srcdir)/$(cwd_rel_from_top))
+else
+abs_srcdir := $(abspath $(abs_top_srcdir)/$(cwd_rel_from_top))
+endif
+
+srcdir := $(strip $(subst $(abs_top_srcdir)/,,$(abs_srcdir)))
+
+ifeq ($(srcdir),)
+srcdir := .
+endif
+
+# autotools, *clean, and help don't require config.mk, features.mk, etc...
+ifeq ($(filter autotools %clean .gitignore gitignore.% help,$(MAKECMDGOALS)),)
+
+include $(abs_top_builddir)/include/mk/config.mk
+include $(abs_top_builddir)/include/mk/features.mk
+
+# START out-of-build-tree check.
+ifneq ($(abs_builddir),$(abs_srcdir))
+BUILD_TREE_STATE := $(BUILD_TREE_BUILDDIR_INSTALL)
+else
+# Else, not out of build tree..
+
+# START srcdir build-tree install checks
+ifeq ($(strip $(DESTDIR)$(prefix)),)
+BUILD_TREE_STATE := $(BUILD_TREE_SRCDIR_INSTALL)
+else # Empty $(DESTDIR)$(prefix)
+ifeq ($(abs_top_srcdir),$(prefix))
+BUILD_TREE_STATE := $(BUILD_TREE_SRCDIR_INSTALL)
+endif
+# END srcdir build-tree install checks
+endif
+# END out-of-build-tree check.
+endif
+
+# Is the build-tree configured yet?
+ifeq ($(BUILD_TREE_STATE),)
+ifneq ($(wildcard $(abs_top_builddir)/include/mk/config.mk),)
+BUILD_TREE_STATE := $(BUILD_TREE_NONSRCDIR_INSTALL)
+endif
+endif
+
+ifeq ($(MAKE_3_80_COMPAT),1)
+# Trick make 3.80 into thinking that the default goal is all.
+.PHONY: default
+default: all
+else
+.DEFAULT_GOAL := all
+endif
+
+endif # END autotools, *clean...
+
+BUILD_TREE_STATE ?= $(BUILD_TREE_UNCONFIGURED)
+
+# We can piece together where we're located in the source and object trees with
+# just these two vars and $(CURDIR).
+export abs_top_srcdir abs_top_builddir BUILD_TREE_STATE
+
+endif
diff --git a/ltp_framework/include/mk/features.mk b/ltp_framework/include/mk/features.mk
new file mode 100644
index 0000000..d06a80a
--- /dev/null
+++ b/ltp_framework/include/mk/features.mk
@@ -0,0 +1,55 @@
+#
+# features.mk.in - feature tuning include Makefile.
+#
+# Copyright (C) 2010, Linux Test Project.
+#
+# 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, October 2010
+#
+
+# Path to capset program
+CAPSET :=
+
+# Tools enable knobs
+WITH_EXPECT := no
+
+WITH_PERL := no
+
+WITH_PYTHON := no
+
+# Features knobs
+
+# Is securebits[.h], et all support available?
+HAVE_SECUREBITS := yes
+
+# Test suite knobs
+
+# Enable testcases/kernel/power_management's compile and install?
+ifeq ($(UCLINUX),1)
+WITH_POWER_MANAGEMENT_TESTSUITE := no
+else
+WITH_POWER_MANAGEMENT_TESTSUITE := no
+endif
+
+# Enable testcases/open_posix_testsuite's compile and install?
+WITH_OPEN_POSIX_TESTSUITE := no
+
+# Enable testcases/realtime's compile and install?
+ifeq ($(UCLINUX),1)
+WITH_REALTIME_TESTSUITE := no
+else
+WITH_REALTIME_TESTSUITE := no
+endif
diff --git a/ltp_framework/include/mk/features.mk.default b/ltp_framework/include/mk/features.mk.default
new file mode 100644
index 0000000..53ea30c
--- /dev/null
+++ b/ltp_framework/include/mk/features.mk.default
@@ -0,0 +1,55 @@
+#
+# features.mk.default - feature tuning include Makefile.
+#
+# Copyright (C) 2010, Linux Test Project.
+#
+# 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, October 2010
+#
+
+# Path to capset program
+CAPSET :=
+
+# Tools enable knobs
+WITH_EXPECT := no
+
+WITH_PERL := no
+
+WITH_PYTHON := no
+
+# Features knobs
+
+# Is securebits[.h], et all support available?
+HAVE_SECUREBITS := no
+
+# Test suite knobs
+
+# Enable testcases/kernel/power_management's compile and install?
+ifeq ($(UCLINUX),1)
+WITH_POWER_MANAGEMENT_TESTSUITE := no
+else
+WITH_POWER_MANAGEMENT_TESTSUITE :=
+endif
+
+# Enable testcases/open_posix_testsuite's compile and install?
+WITH_OPEN_POSIX_TESTSUITE := no
+
+# Enable testcases/realtime's compile and install?
+ifeq ($(UCLINUX),1)
+WITH_REALTIME_TESTSUITE := no
+else
+WITH_REALTIME_TESTSUITE := no
+endif
diff --git a/ltp_framework/include/mk/features.mk.in b/ltp_framework/include/mk/features.mk.in
new file mode 100644
index 0000000..3472159
--- /dev/null
+++ b/ltp_framework/include/mk/features.mk.in
@@ -0,0 +1,55 @@
+#
+# features.mk.in - feature tuning include Makefile.
+#
+# Copyright (C) 2010, Linux Test Project.
+#
+# 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, October 2010
+#
+
+# Path to capset program
+CAPSET := @CAPSET@
+
+# Tools enable knobs
+WITH_EXPECT := @WITH_EXPECT@
+
+WITH_PERL := @WITH_PERL@
+
+WITH_PYTHON := @WITH_PYTHON@
+
+# Features knobs
+
+# Is securebits[.h], et all support available?
+HAVE_SECUREBITS := @HAVE_SECUREBITS@
+
+# Test suite knobs
+
+# Enable testcases/kernel/power_management's compile and install?
+ifeq ($(UCLINUX),1)
+WITH_POWER_MANAGEMENT_TESTSUITE := no
+else
+WITH_POWER_MANAGEMENT_TESTSUITE := @WITH_POWER_MANAGEMENT_TESTSUITE@
+endif
+
+# Enable testcases/open_posix_testsuite's compile and install?
+WITH_OPEN_POSIX_TESTSUITE := @WITH_OPEN_POSIX_TESTSUITE@
+
+# Enable testcases/realtime's compile and install?
+ifeq ($(UCLINUX),1)
+WITH_REALTIME_TESTSUITE := no
+else
+WITH_REALTIME_TESTSUITE := @WITH_REALTIME_TESTSUITE@
+endif
diff --git a/ltp_framework/include/mk/functions.mk b/ltp_framework/include/mk/functions.mk
new file mode 100644
index 0000000..fc58737
--- /dev/null
+++ b/ltp_framework/include/mk/functions.mk
@@ -0,0 +1,76 @@
+#
+# A Makefile with a collection of reusable functions.
+#
+# 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
+#
+
+SQUOTE := '
+
+# ' # to keep colorized editors from going nuts
+
+MAKE_3_80_realpath = $(shell $(top_srcdir)/scripts/realpath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))')
+
+MAKE_3_80_abspath = $(shell $(top_srcdir)/scripts/abspath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))')
+
+#
+# NOTE (garrcoop):
+#
+# The following functions are (sometimes) split into 3.80 and 3.81+
+# counterparts, and not conditionalized inside of the define(s) to work around
+# an issue with how make 3.80 evaluates defines.
+#
+# SO DO NOT INTERNALIZE CONDITIONALS IN DEFINES OR YOU WILL BREAK MAKE 3.80!
+#
+
+#
+# Generate an install rule which also creates the install directory if needed
+# to avoid unnecessary bourne shell based for-loops and install errors, as well
+# as adhoc install rules.
+#
+# 1 -> Target basename.
+# 2 -> Source directory.
+# 3 -> Destination directory.
+#
+ifdef MAKE_3_80_COMPAT
+define generate_install_rule
+
+INSTALL_FILES += $$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1))
+
+$$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1)): \
+ $$(call MAKE_3_80_abspath,$$(dir $$(DESTDIR)/$(3)/$(1)))
+ install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@"
+endef
+else # not MAKE_3_80_COMPAT
+define generate_install_rule
+
+INSTALL_FILES += $$(abspath $$(DESTDIR)/$(3)/$(1))
+
+$$(abspath $$(DESTDIR)/$(3)/$(1)): \
+ $$(abspath $$(dir $$(DESTDIR)/$(3)/$(1)))
+ install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@"
+endef
+endif # END MAKE_3_80_COMPAT
+
+#
+# Set SUBDIRS to the subdirectories where Makefiles were found.
+#
+define get_make_dirs
+SUBDIRS ?= $$(subst $$(abs_srcdir)/,,$$(patsubst %/Makefile,%,$$(wildcard $$(abs_srcdir)/*/Makefile)))
+SUBDIRS := $$(filter-out $$(FILTER_OUT_DIRS),$$(SUBDIRS))
+endef
diff --git a/ltp_framework/include/mk/generic_leaf_target.inc b/ltp_framework/include/mk/generic_leaf_target.inc
new file mode 100644
index 0000000..a88586f
--- /dev/null
+++ b/ltp_framework/include/mk/generic_leaf_target.inc
@@ -0,0 +1,106 @@
+#
+# Generic leaf rules 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
+#
+
+#
+# generic_leaf_target
+#
+# Generate a set of basic targets (all, clean, install) for a leaf directory
+# (no subdirectories).
+#
+# $(MAKE_DEPS) : What should we execute beforehand as a
+# dependency of $(MAKE_TARGETS)?
+#
+# $(INSTALL_FILES) -> install
+#
+# Helpful variables are:
+#
+# $(MAKE_TARGETS) : What to execute as direct dependencies of
+# all.
+# 1. Defaults to the basename of the targets
+# produced by the %.c -> % implicit pattern
+# rules, e.g. the MAKE_TARGET in a directory
+# like the following:
+#
+# $$ ls /bar
+# foo.c
+#
+# Would be `foo'. Similarly, the following
+# dir structure:
+#
+# $$ ls /bar
+# foo.c zanzibar.c
+#
+# Would be `foo zanzibar'.
+#
+# 2. If you define MAKE_TARGETS as an empty
+# string, this will override the defaults.
+# I did this to avoid providing too much
+# rope to hang one's self in the event of
+# unwanted behavior.
+#
+# $(CLEAN_TARGETS) : What targets should be cleaned (must be
+# real files). This will automatically append
+# adds the .o suffix to all files referenced
+# by $(MAKE_TARGETS)) to CLEAN_TARGETS, if
+# MAKE_TARGETS wasn't defined (see
+# $(MAKE_TARGETS)).
+# $(INSTALL_MODE) : What mode should we using when calling
+# install(1)?
+#
+# Also, if you wish to change the installation directory, from the set default
+# (testcases/bin) you must do something like either one of the following items:
+#
+# Method A:
+#
+# INSTALL_DIR := /path/to/installdir/from/$(DESTDIR)/$(prefix)
+#
+# e.g. if I wanted to install my binaries in testcases/bin, I would do:
+#
+# INSTALL_DIR := testcases/bin
+#
+# in my calling Makefile.
+#
+# Or Method B:
+#
+# INSTALL_DIR := /path/to/installdir/from/$(DESTDIR)
+#
+# e.g. if I wanted to install my binaries in $(libdir) (which may not exist
+# outside of $(prefix) right now, but could in the future), I could do the
+# following:
+#
+# INSTALL_DIR := $(libdir)
+#
+
+.PHONY: all clean install
+
+$(MAKE_TARGETS): | $(MAKE_DEPS)
+
+all: $(MAKE_TARGETS)
+
+clean:: $(CLEAN_DEPS)
+ -$(RM) -f $(CLEAN_TARGETS)
+
+$(INSTALL_FILES): | $(INSTALL_DEPS)
+
+install: $(INSTALL_FILES)
+
+# vim: syntax=make
diff --git a/ltp_framework/include/mk/generic_leaf_target.mk b/ltp_framework/include/mk/generic_leaf_target.mk
new file mode 100644
index 0000000..cb6db5e
--- /dev/null
+++ b/ltp_framework/include/mk/generic_leaf_target.mk
@@ -0,0 +1,24 @@
+#
+# Generic leaf 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
+#
+
+include $(top_srcdir)/include/mk/env_post.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.inc
diff --git a/ltp_framework/include/mk/generic_trunk_target.inc b/ltp_framework/include/mk/generic_trunk_target.inc
new file mode 100644
index 0000000..86d654c
--- /dev/null
+++ b/ltp_framework/include/mk/generic_trunk_target.inc
@@ -0,0 +1,97 @@
+#
+# Generic trunk rules 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
+#
+
+#
+# generic_trunk_target
+#
+# Generate a set of recursive targets to apply over a trunk directory (has
+# directories) -- optionally with a set of trunk-based files.
+#
+# All variables in this canned define are essentially the same as
+# generic_leaf_target, with the exception that the install flow for local
+# targets is:
+#
+# $(INSTALL_FILES) -> trunk-install -> install (recursive)
+#
+# All recursive targets are traverse SUBDIRS as defined by the user, or if
+# undefined, defaults to any subdirectories where Makefile's are contained
+# within.
+#
+# generic_trunk_target specific variables are:
+#
+# RECURSIVE_TARGETS : a list of targets to apply over an entire
+# directory tree. This defaults to
+# `all install'.
+#
+# See generic_leaf_target, generic_target_env_setup, and get_make_dirs for
+# more details and design notes.
+#
+
+include $(top_srcdir)/include/mk/functions.mk
+
+RECURSIVE_TARGETS ?= all install
+
+$(eval $(get_make_dirs))
+
+.PHONY: $(RECURSIVE_TARGETS) $(addprefix trunk-,$(RECURSIVE_TARGETS))
+
+$(SUBDIRS): %:
+ mkdir -m 00755 -p "$@"
+
+$(MAKE_TARGETS): | $(MAKE_DEPS)
+
+trunk-all: $(MAKE_TARGETS)
+
+trunk-clean:: | $(SUBDIRS)
+ $(if $(strip $(CLEAN_TARGETS)),$(RM) -f $(CLEAN_TARGETS))
+
+$(INSTALL_FILES): | $(INSTALL_DEPS)
+
+trunk-install: $(INSTALL_FILES)
+
+# Avoid creating duplicate .PHONY references to all, clean, and install. IIRC,
+# I've seen some indeterministic behavior when one does this in the past with
+# GNU Make...
+.PHONY: $(filter-out $(RECURSIVE_TARGETS),all clean install)
+all: trunk-all
+
+clean:: trunk-clean
+ @set -e; for dir in $(SUBDIRS); do \
+ $(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \
+ done
+ifneq ($(abs_builddir),$(abs_srcdir))
+ $(RM) -Rf $(SUBDIRS)
+endif
+
+install: trunk-install
+
+# Print out CURDIR to check for a recursion issue.
+ifeq ($(strip $(SUBDIRS)),)
+ $(warning CURDIR is: $(CURDIR))
+else
+$(RECURSIVE_TARGETS): %: | $(SUBDIRS)
+ @set -e; for dir in $(SUBDIRS); do \
+ $(MAKE) -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \
+ done
+endif
+
+# vim: syntax=make
diff --git a/ltp_framework/include/mk/generic_trunk_target.mk b/ltp_framework/include/mk/generic_trunk_target.mk
new file mode 100644
index 0000000..f480ef6
--- /dev/null
+++ b/ltp_framework/include/mk/generic_trunk_target.mk
@@ -0,0 +1,24 @@
+#
+# Generic trunk 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
+#
+
+include $(top_srcdir)/include/mk/env_post.mk
+include $(top_srcdir)/include/mk/generic_trunk_target.inc
diff --git a/ltp_framework/include/mk/gitignore.mk b/ltp_framework/include/mk/gitignore.mk
new file mode 100644
index 0000000..b9932fb
--- /dev/null
+++ b/ltp_framework/include/mk/gitignore.mk
@@ -0,0 +1,51 @@
+#
+# gitignore generation include Makefile.
+#
+# Copyright (C) 2011, Linux Test Project.
+#
+# 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, January 2011
+#
+
+CLEAN_TARGETS+= gitignore_clean
+
+BEFORE:= .gitignore-before
+
+AFTER:= .gitignore-after
+
+IGNORE_DIR_EXPR:= egrep -v "^$$(echo "$(AUTOCONFED_SUBDIRS)" | tr " " "|")"
+
+# NOTE: The underscore is used in place of a dash to avoid implicit rule
+# evaluation in top-level Makefile.
+.PHONY: gitignore_clean
+gitignore_clean:
+ $(RM) -f $(BEFORE) $(AFTER)
+
+$(BEFORE):
+ $(MAKE) distclean
+ $(MAKE) ac-maintainer-clean
+ find . | $(IGNORE_DIR_EXPR) > $@
+
+$(AFTER):
+ $(MAKE) autotools
+ ./configure --prefix=/dev/null
+ $(MAKE) all
+ find . | $(IGNORE_DIR_EXPR) > $@
+ # Set everything in autoconf land back to a sane state.
+ $(MAKE) distclean
+
+.gitignore: | $(BEFORE) $(AFTER)
+ diff -u $(BEFORE) $(AFTER) | grep '^+' | sed -e 's,^\+,,g' > $@
diff --git a/ltp_framework/include/mk/lib.mk b/ltp_framework/include/mk/lib.mk
new file mode 100644
index 0000000..bc0c45d
--- /dev/null
+++ b/ltp_framework/include/mk/lib.mk
@@ -0,0 +1,64 @@
+#
+# library 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
+#
+
+# Makefile to include for libraries.
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_DIR := $(libdir)
+
+# An extension of generic_leaf_target, strictly for libraries.
+.PHONY: install_headers
+
+ifndef LIB
+$(error You must define LIB when including this Makefile)
+endif
+
+install_headers: $(addprefix $(DESTDIR)/$(includedir)/,$(notdir $(HEADER_FILES)))
+
+INSTALL_MODE ?= 00664
+
+MAKE_TARGETS := $(LIB)
+
+LIBSRCS ?= $(wildcard $(abs_srcdir)/*.c)
+
+ifdef MAKE_3_80_COMPAT
+LIBSRCS := $(call MAKE_3_80_abspath,$(LIBSRCS))
+else
+LIBSRCS := $(abspath $(LIBSRCS))
+endif
+
+LIBSRCS := $(subst $(abs_srcdir)/,,$(wildcard $(LIBSRCS)))
+
+LIBSRCS := $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS))
+
+LIBOBJS := $(LIBSRCS:.c=.o)
+
+$(LIB): $(notdir $(LIBOBJS))
+ if [ -z "$(strip $^)" ] ; then \
+ echo "Cowardly refusing to create empty archive"; \
+ exit 1; \
+ fi
+ $(if $(AR),$(AR),ar) -rc "$@" $^
+ $(if $(RANLIB),$(RANLIB),ranlib) "$@"
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/ltp_framework/include/mk/man.mk b/ltp_framework/include/mk/man.mk
new file mode 100644
index 0000000..f0b4525
--- /dev/null
+++ b/ltp_framework/include/mk/man.mk
@@ -0,0 +1,37 @@
+#
+# Manpage 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
+#
+
+ifeq ($(strip $(MANPREFIX)),)
+$(error $$(MANPREFIX) not defined)
+endif
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_DIR := $(mandir)/man$(MANPREFIX)
+
+INSTALL_MODE := 00644
+
+INSTALL_TARGETS ?= *.$(MANPREFIX)
+
+MAKE_TARGETS :=
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/ltp_framework/include/mk/testcases.mk b/ltp_framework/include/mk/testcases.mk
new file mode 100644
index 0000000..ea26d4f
--- /dev/null
+++ b/ltp_framework/include/mk/testcases.mk
@@ -0,0 +1,55 @@
+#
+# testcases 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
+#
+
+include $(top_srcdir)/include/mk/env_pre.mk
+include $(top_srcdir)/include/mk/functions.mk
+
+APICMDS_DIR := $(abs_top_builddir)/tools/apicmds
+
+TKI_DIR := testcases/kernel/include
+
+LSN_H := $(abs_top_builddir)/$(TKI_DIR)/linux_syscall_numbers.h
+
+LIBLTP_DIR := $(abs_top_builddir)/lib
+
+LIBLTP := $(LIBLTP_DIR)/libltp.a
+
+$(APICMDS_DIR)/tst_kvercmp: $(APICMDS_DIR)
+ $(MAKE) -C "$^" -f "$(abs_top_srcdir)/tools/apicmds/Makefile" all
+
+$(LIBLTP): $(LIBLTP_DIR)
+ $(MAKE) -C "$^" -f "$(abs_top_srcdir)/lib/Makefile" all
+
+$(LSN_H): $(abs_top_builddir)/$(TKI_DIR)
+ $(MAKE) -C "$^" -f "$(abs_top_srcdir)/$(TKI_DIR)/Makefile" all
+
+MAKE_DEPS := $(LIBLTP) $(LSN_H)
+
+# For linux_syscall_numbers.h
+CPPFLAGS += -I$(abs_top_builddir)/$(TKI_DIR)
+
+INSTALL_DIR := testcases/bin
+
+LDLIBS += -lltp
+
+$(APICMDS_DIR) $(LIBLTP_DIR) $(abs_top_builddir)/$(TKI_DIR): %:
+ mkdir -p "$@"