[LTP] [PATCH resend 6/6] mm: add common Makefile include: libmem.mk

Caspar Zhang
2012-08-09T06:16:19Z

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

libmem.mk is used as a common Makefile used by tests under mem/ dir to
avoid duplicated libmem-related lines.

Signed-off-by: Caspar Zhang <caspar@casparzhang.com>
---
testcases/kernel/mem/cpuset/Makefile | 23 +-------------
testcases/kernel/mem/hugetlb/Makefile.inc | 19 +++--------
testcases/kernel/mem/hugetlb/hugemmap/Makefile | 13 +-------
testcases/kernel/mem/include/libmem.mk | 40 ++++++++++++++++++++++++
testcases/kernel/mem/ksm/Makefile | 23 +-------------
testcases/kernel/mem/oom/Makefile | 23 +-------------
testcases/kernel/mem/swapping/Makefile | 23 +-------------
testcases/kernel/mem/thp/Makefile | 23 +-------------
testcases/kernel/mem/tunable/Makefile | 23 +-------------
testcases/kernel/mem/vma/Makefile | 3 +-
10 files changed, 54 insertions(+), 159 deletions(-)
create mode 100644 testcases/kernel/mem/include/libmem.mk

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0006-mm-add-common-Makefile-include-libmem.mk.patch --]
[-- Type: text/x-patch; name="0006-mm-add-common-Makefile-include-libmem.mk.patch", Size: 9344 bytes --]

diff --git a/testcases/kernel/mem/cpuset/Makefile b/testcases/kernel/mem/cpuset/Makefile
index c9d03bf..8e41c02 100644
--- a/testcases/kernel/mem/cpuset/Makefile
+++ b/testcases/kernel/mem/cpuset/Makefile
@@ -20,26 +20,5 @@
top_srcdir ?= ../../../..

include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += $(NUMA_LIBS) -lmem -lltp -lm
-LIBDIR := ../lib
-LIB := $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS := $(LIBDIR)
-CFLAGS += -I../include
-LDFLAGS += -L$(LIBDIR)
-
-$(LIBDIR):
- mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS := $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/mem/hugetlb/Makefile.inc b/testcases/kernel/mem/hugetlb/Makefile.inc
index 1831fbb..cc0ada6 100644
--- a/testcases/kernel/mem/hugetlb/Makefile.inc
+++ b/testcases/kernel/mem/hugetlb/Makefile.inc
@@ -23,23 +23,16 @@
# DO NOT USE THIS FILE FOR hugetlb / lib!!!
LIBIPCDIR := ../lib
LIBIPC := $(LIBIPCDIR)/libipc_hugetlb.a
+
$(LIBIPCDIR):
mkdir -p "$@"
$(LIBIPC): $(LIBIPCDIR)
$(MAKE) -C "$^" -f "$(abs_srcdir)/$^/Makefile" all

-LIBMEMDIR := ../../lib
-LIBMEM := $(LIBMEMDIR)/libmem.a
-$(LIBMEM): $(LIBMEMDIR)
- $(MAKE) -C "$^" -f "$(abs_srcdir)/$^/Makefile" all
-
-CPPFLAGS += -I$(abs_srcdir)/$(LIBIPCDIR) -I$(abs_srcdir)/../../include
-LDFLAGS += -L$(abs_builddir)/$(LIBIPCDIR) -L$(abs_builddir)/$(LIBMEMDIR)
-LDLIBS += $(NUMA_LIBS) -lmem -lltp -lipc_hugetlb
-MAKE_DEPS += $(LIBMEM) $(LIBIPC)
-
-lib-clean:: $(LIBMEMDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
+CPPFLAGS += -I$(abs_srcdir)/$(LIBIPCDIR)
+LDFLAGS += -L$(abs_builddir)/$(LIBIPCDIR)
+LDLIBS += -lipc_hugetlb
+MAKE_DEPS += $(LIBIPC)

-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
# vim: syntax=make
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/Makefile b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
index 0b1b60c..71da630 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/Makefile
+++ b/testcases/kernel/mem/hugetlb/hugemmap/Makefile
@@ -23,16 +23,5 @@
top_srcdir ?= ../../../../..

include $(top_srcdir)/include/mk/testcases.mk
-
-LIBMEMDIR := ../../lib
-LIBMEM := $(LIBMEMDIR)/libmem.a
-$(LIBMEM): $(LIBMEMDIR)
- $(MAKE) -C "$^" -f "$(abs_srcdir)/$^/Makefile" all
-
-CPPFLAGS += -I$(abs_srcdir)/$(LIBMEMDIR) -I$(abs_srcdir)/../../include
-LDFLAGS += -L$(abs_builddir)/$(LIBMEMDIR)
-LDLIBS += $(NUMA_LIBS) -lmem -lltp
-MAKE_DEPS += $(LIBMEM)
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/mem/include/libmem.mk b/testcases/kernel/mem/include/libmem.mk
new file mode 100644
index 0000000..22efda2
--- /dev/null
+++ b/testcases/kernel/mem/include/libmem.mk
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2012 Red Hat, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+MEM_DIR := $(top_srcdir)/testcases/kernel/mem
+LIBMEM_DIR := $(MEM_DIR)/lib
+LIBMEM := $(LIBMEM_DIR)/libmem.a
+FILTER_OUT_DIRS := $(LIBMEM_DIR)
+CFLAGS += -I$(MEM_DIR)/include
+LDLIBS += $(NUMA_LIBS) -lmem -lltp
+LDFLAGS += -L$(LIBMEM_DIR)
+
+$(LIBMEM_DIR):
+ mkdir -p "$@"
+
+$(LIBMEM): $(LIBMEM_DIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS += $(LIBMEM)
+
+trunk-clean:: | lib-clean
+
+lib-clean:: $(LIBMEM_DIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
+
+include $(top_srcdir)/testcases/kernel/include/lib.mk
diff --git a/testcases/kernel/mem/ksm/Makefile b/testcases/kernel/mem/ksm/Makefile
index b17845b..128d7bc 100644
--- a/testcases/kernel/mem/ksm/Makefile
+++ b/testcases/kernel/mem/ksm/Makefile
@@ -19,26 +19,5 @@
top_srcdir ?= ../../../..

include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += $(NUMA_LIBS) -lmem -lltp
-LIBDIR := ../lib
-LIB := $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS := $(LIBDIR)
-CFLAGS += -I../include
-LDFLAGS += -L$(LIBDIR)
-
-$(LIBDIR):
- mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS := $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/mem/oom/Makefile b/testcases/kernel/mem/oom/Makefile
index b17845b..128d7bc 100644
--- a/testcases/kernel/mem/oom/Makefile
+++ b/testcases/kernel/mem/oom/Makefile
@@ -19,26 +19,5 @@
top_srcdir ?= ../../../..

include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += $(NUMA_LIBS) -lmem -lltp
-LIBDIR := ../lib
-LIB := $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS := $(LIBDIR)
-CFLAGS += -I../include
-LDFLAGS += -L$(LIBDIR)
-
-$(LIBDIR):
- mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS := $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/mem/swapping/Makefile b/testcases/kernel/mem/swapping/Makefile
index b17845b..128d7bc 100644
--- a/testcases/kernel/mem/swapping/Makefile
+++ b/testcases/kernel/mem/swapping/Makefile
@@ -19,26 +19,5 @@
top_srcdir ?= ../../../..

include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += $(NUMA_LIBS) -lmem -lltp
-LIBDIR := ../lib
-LIB := $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS := $(LIBDIR)
-CFLAGS += -I../include
-LDFLAGS += -L$(LIBDIR)
-
-$(LIBDIR):
- mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS := $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/mem/thp/Makefile b/testcases/kernel/mem/thp/Makefile
index 3ef9288..867dcf0 100644
--- a/testcases/kernel/mem/thp/Makefile
+++ b/testcases/kernel/mem/thp/Makefile
@@ -20,26 +20,5 @@
top_srcdir ?= ../../../..

include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += $(NUMA_LIBS) -lmem -lltp
-LIBDIR := ../lib
-LIB := $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS := $(LIBDIR)
-CFLAGS += -I../include
-LDFLAGS += -L$(LIBDIR)
-
-$(LIBDIR):
- mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS := $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/mem/tunable/Makefile b/testcases/kernel/mem/tunable/Makefile
index 3ef9288..867dcf0 100644
--- a/testcases/kernel/mem/tunable/Makefile
+++ b/testcases/kernel/mem/tunable/Makefile
@@ -20,26 +20,5 @@
top_srcdir ?= ../../../..

include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += $(NUMA_LIBS) -lmem -lltp
-LIBDIR := ../lib
-LIB := $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS := $(LIBDIR)
-CFLAGS += -I../include
-LDFLAGS += -L$(LIBDIR)
-
-$(LIBDIR):
- mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS := $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
- $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/mem/vma/Makefile b/testcases/kernel/mem/vma/Makefile
index 949db9a..b323dbf 100644
--- a/testcases/kernel/mem/vma/Makefile
+++ b/testcases/kernel/mem/vma/Makefile
@@ -20,6 +20,5 @@
top_srcdir ?= ../../../..

include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk

[-- Attachment #3: Type: text/plain, Size: 395 bytes --]

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]