Skip to contentSkip to conversation

Makefile updates

PATCH New Zdenek Kabelac 2 participants 8 messages Mar 23, 2010 – Mar 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Makefile updates

This patch set fixes few minor Makefile errors mostly around clean & distclean targets. Major topic is the update of cflow rules.

Zdenek Kabelac (6):
Reuse clean target for distclean
Query make.tmpl variable
Fix cleanup of libdevmapper-event.a and dmeventd Fix run of cscope in $(builddir)
Fix distclean error for subtargets Update cflow

 Makefile.in                                 |   25 ++++-------
 daemons/Makefile.in                         |    9 ++++-
 daemons/dmeventd/Makefile.in                |   27 ++++++++++---
 daemons/dmeventd/plugins/mirror/Makefile.in |   11 ++++-
 include/Makefile.in                         |    3 +-
 lib/Makefile.in                             |   21 ++++++----
 libdm/Makefile.in                           |    4 ++
 make.tmpl.in                                |   58 +++++++++++++++++++++++----
 tools/Makefile.in                           |   23 ++++-------
 9 files changed, 122 insertions(+), 59 deletions(-)
#1 lore raw

PATCH 1/6 Reuse clean target for distclean

Instead of duplicating clean target inside distclean target, just use it as a subtarget and avoid add duplicating code.

---
 make.tmpl.in |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
make.tmpl.in +2 -5
index ff4d1b2..df4eafa 100644
@@ -257,12 +257,9 @@ clean: $(SUBDIRS.clean)
 	      $(SOURCES2:%.c=%.d) $(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.gcno) \
 	      $(SOURCES:%.c=%.gcda) $(LDDEPS)
 
-distclean: $(SUBDIRS.distclean)
+distclean: $(SUBDIRS.clean) $(SUBDIRS.distclean)
 	$(RM) -rf $(DISTCLEAN_DIRS)
-	$(RM) $(DISTCLEAN_TARGETS) \
-	      $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
-	      $(SOURCES2:%.c=%.d) $(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.gcno) \
-	      $(SOURCES:%.c=%.gcda) $(LDDEPS) \
+	$(RM) $(DISTCLEAN_TARGETS)  \
 	      config.cache config.log config.status \
 	      Makefile make.tmpl core \
 	      lvm-version.h
Signature · 1 line
1.7.0.1
#2 lore raw

PATCH 2/6 Query make.tmpl variable

In reply to Zdenek Kabelac

Avoid hard sed replacement - i.e. quick test change in make.tmpl could avoid recofiguration steps in same debug cases.

---
 Makefile.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Makefile.in +2 -2
index a4b1d78..593500e 100644
@@ -88,7 +88,7 @@ endif
 check: all
 	$(MAKE) -C test all
 
-ifneq ("@LCOV@", "")
+ifneq ("$(LCOV)", "")
 .PHONY: lcov-reset lcov lcov-dated
 
 ifeq ($(MAKECMDGOALS),lcov-dated)
@@ -116,7 +116,7 @@ lcov: all
 		-a $(LCOV_REPORTS_DIR)/libdm.info \
 		-a $(LCOV_REPORTS_DIR)/tools.info \
 		-o $(LCOV_REPORTS_DIR)/lvm.info
-ifneq ("@GENHTML@", "")
+ifneq ("$(GENHTML)", "")
 	$(GENHTML) -o $(LCOV_REPORTS_DIR) -p $(top_srcdir) $(LCOV_REPORTS_DIR)/lvm.info
 endif
 
Signature · 1 line
1.7.0.1
#3 lore raw

PATCH 3/6 Fix cleanup of libdevmapper-event.a and dmeventd

In reply to Zdenek Kabelac

Add $(LIB_STATIC) to TARGETS so it's cleaned in the same way as other libraries in project.
Add dmeventd.gcda dmeventd.gcno to CLEAN_TARGETS.

---
 daemons/dmeventd/Makefile.in |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
daemons/dmeventd/Makefile.in +6 -5
index dc48f0d..948d908 100644
@@ -26,9 +26,10 @@ TARGETS = dmeventd
 INSTALL_DMEVENTD_TARGETS = install_dmeventd_dynamic
 INSTALL_LIB_TARGETS = install_lib_dynamic
 
+LIB_NAME = libdevmapper-event
 ifeq ("@STATIC_LINK@", "yes")
-  LIB_STATIC = libdevmapper-event.a
-  TARGETS += dmeventd.static
+  LIB_STATIC = $(LIB_NAME).a
+  TARGETS += $(LIB_STATIC) dmeventd.static
   INSTALL_DMEVENTD_TARGETS += install_dmeventd_static
   INSTALL_LIB_TARGETS += install_lib_static
 endif
@@ -36,13 +37,13 @@ endif
 LIB_VERSION = $(LIB_VERSION_DM)
 
 ifeq ("@LIB_SUFFIX@","dylib")
-  LIB_SHARED = libdevmapper-event.dylib
+  LIB_SHARED = $(LIB_NAME).dylib
 else
-  LIB_SHARED = libdevmapper-event.so
+  LIB_SHARED = $(LIB_NAME).so
   VERSIONED_SHLIB = $(LIB_SHARED).$(LIB_VERSION)
 endif
 
-CLEAN_TARGETS = dmeventd.o dmeventd.static
+CLEAN_TARGETS = dmeventd.o dmeventd.static dmeventd.gcda dmeventd.gcno
 
 ifneq ($(MAKECMDGOALS),device-mapper)
   SUBDIRS+=plugins
Signature · 1 line
1.7.0.1
#4 lore raw

PATCH 4/6 Fix run of cscope in $(builddir)

In reply to Zdenek Kabelac

Use $(top_srcdir) for sources and add cscope.out to distcleaning.

---
 Makefile.in |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Makefile.in +2 -1
index 593500e..967b026 100644
@@ -81,8 +81,9 @@ endif
 
 ifneq ("@CSCOPE_CMD@", "")
 cscope.out: tools
-	@CSCOPE_CMD@ -b -R
+	@CSCOPE_CMD@ -b -R $(top_srcdir)
 all: cscope.out
+DISTCLEAN_TARGETS += cscope.out
 endif
 
 check: all
Signature · 1 line
1.7.0.1
#5 lore raw

PATCH 5/6 Fix distclean error for subtargets

In reply to Zdenek Kabelac

Move daemons/ and lib/ subtargets to their Makefiles so we don't get double cleanup error during execution of distclean target.

---
 Makefile.in         |   11 +----------
 daemons/Makefile.in |    4 ++++
 lib/Makefile.in     |    9 +++++++++
 3 files changed, 14 insertions(+), 10 deletions(-)
Makefile.in +1 -10
index 967b026..5c64a9a 100644
@@ -34,16 +34,7 @@ ifeq ("@APPLIB@", "yes")
 endif
 
 ifeq ($(MAKECMDGOALS),distclean)
-  SUBDIRS += daemons/clvmd \
-	     daemons/cmirrord \
-	     daemons/dmeventd/plugins \
-	     daemons/dmeventd \
-	     lib/format1 \
-	     lib/format_pool \
-	     lib/locking \
-	     lib/mirror \
-	     lib/snapshot \
-	     liblvm \
+  SUBDIRS += liblvm \
 	     udev \
 	     test/api \
 	     test \
daemons/Makefile.in +4 -0
index a0e7268..1b4bcbb 100644
@@ -30,6 +30,10 @@ ifeq ("@BUILD_DMEVENTD@", "yes")
   SUBDIRS += dmeventd
 endif
 
+ifeq ($(MAKECMDGOALS),distclean)
+  SUBDIRS = clvmd cmirrord dmeventd
+endif
+
 include $(top_builddir)/make.tmpl
 
 ifeq ("@BUILD_DMEVENTD@", "yes")
lib/Makefile.in +9 -0
index a2e66f3..c83dc89 100644
@@ -152,6 +152,15 @@ LIB_STATIC = $(LIB_NAME).a
 
 CLEAN_TARGETS += $(LIB_NAME).cflow
 
+ifeq ($(MAKECMDGOALS),distclean)
+  SUBDIRS =\
+	format1 \
+	format_pool \
+	snapshot \
+	mirror \
+	locking
+endif
+
 include $(top_builddir)/make.tmpl
 
 $(SUBDIRS): $(LIB_STATIC)
Signature · 1 line
1.7.0.1
#6 lore raw

PATCH 6/6 Update cflow

In reply to Zdenek Kabelac

Update cflow file generation - support build dir and properly use top_srcdir to obtain sources. Create make.tmpl target for simplier generation of cflow files with the help of CFLOW_DIR, CFLOW_LIST, CFLOW_TARGET, CFLOW_GEN

Add support for dmeventd.

Try to avoid generation too many warnings from cflow execution.

---
 Makefile.in                                 |    7 ++--
 daemons/Makefile.in                         |    5 ++-
 daemons/dmeventd/Makefile.in                |   16 ++++++++-
 daemons/dmeventd/plugins/mirror/Makefile.in |   11 ++++--
 include/Makefile.in                         |    3 +-
 lib/Makefile.in                             |   12 ++----
 libdm/Makefile.in                           |    4 ++
 make.tmpl.in                                |   51 +++++++++++++++++++++++++--
 tools/Makefile.in                           |   23 ++++--------
 9 files changed, 96 insertions(+), 36 deletions(-)
Makefile.in +4 -3
index 5c64a9a..ae52ff6 100644
@@ -65,9 +65,10 @@ po.pofile: tools.pofile daemons.pofile
 pofile: po.pofile
 endif
 
-ifneq ("@CFLOW_CMD@", "")
-tools.cflow: lib.cflow
-cflow: tools.cflow
+ifneq ("$(CFLOW_CMD)", "")
+tools.cflow: libdm.cflow lib.cflow
+daemons.cflow: tools.cflow
+cflow: include.cflow
 endif
 
 ifneq ("@CSCOPE_CMD@", "")
daemons/Makefile.in +4 -1
index 1b4bcbb..2f5837a 100644
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
 #
 # This file is part of LVM2.
 #
@@ -28,6 +28,9 @@ endif
 
 ifeq ("@BUILD_DMEVENTD@", "yes")
   SUBDIRS += dmeventd
+ifneq ("$(CFLOW_CMD)", "")
+daemons.cflow: dmeventd.cflow
+endif
 endif
 
 ifeq ($(MAKECMDGOALS),distclean)
daemons/dmeventd/Makefile.in +15 -1
index 948d908..22100f9 100644
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2005-2010 Red Hat, Inc. All rights reserved.
 #
 # This file is part of the device-mapper userspace tools.
 #
@@ -49,6 +49,11 @@ ifneq ($(MAKECMDGOALS),device-mapper)
   SUBDIRS+=plugins
 endif
 
+CFLOW_DIR = daemons/dmeventd
+CFLOW_LIST = $(SOURCES)
+CFLOW_TARGET = $(LIB_NAME).cflow
+CFLOW_GEN = dmeventd
+
 include $(top_builddir)/make.tmpl
 
 all: device-mapper
@@ -72,6 +77,15 @@ ifeq ("@PKGCONFIG@", "yes")
   INSTALL_LIB_TARGETS += install_pkgconfig
 endif
 
+ifneq ("$(CFLOW_CMD)", "")
+CFLOW_SOURCES = $(addprefix $(top_srcdir)/daemons/dmeventd/, $(SOURCES))
+-include $(top_builddir)/libdm/libdevmapper.cflow
+-include $(top_builddir)/lib/liblvm-internal.cflow
+-include $(top_builddir)/lib/liblvm2cmd.cflow
+-include $(top_builddir)/daemons/dmeventd/$(LIB_NAME).cflow
+-include $(top_builddir)/daemons/dmeventd/plugins/mirror/$(LIB_NAME)-lvm2mirror.cflow
+endif
+
 install_include:
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 444 $(srcdir)/libdevmapper-event.h \
 		$(includedir)/libdevmapper-event.h
daemons/dmeventd/plugins/mirror/Makefile.in +8 -3
index bd85a6f..d4c9c7e 100644
@@ -22,19 +22,24 @@ CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/l
 
 SOURCES = dmeventd_mirror.c
 
+LIB_NAME = libdevmapper-event-lvm2mirror
 ifeq ("@LIB_SUFFIX@","dylib")
-  LIB_SHARED = libdevmapper-event-lvm2mirror.dylib
+  LIB_SHARED = $(LIB_NAME).dylib
 else
-  LIB_SHARED = libdevmapper-event-lvm2mirror.so
+  LIB_SHARED = $(LIB_NAME).so
 endif
 
 LIB_VERSION = $(LIB_VERSION_LVM)
 
+CFLOW_DIR = daemons/dmeventd/plugins/mirror
+CFLOW_LIST = $(SOURCES)
+CFLOW_TARGET = $(LIB_NAME).cflow
+
 include $(top_builddir)/make.tmpl
 
 LIBS += @LVM2CMD_LIB@ -ldevmapper-event-lvm2 -ldevmapper $(PTHREAD_LIBS)
 
-install_lvm2: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
+install_lvm2: $(LIB_NAME).$(LIB_SUFFIX)
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
 		$(libdir)/$<
 
include/Makefile.in +1 -2
index 55add36..3023d4a 100644
@@ -48,5 +48,4 @@ install_device-mapper:
 
 install_lvm2:
 
-cflow:
-
+cflow: all
lib/Makefile.in +4 -8
index c83dc89..f2cfdf7 100644
@@ -161,14 +161,10 @@ ifeq ($(MAKECMDGOALS),distclean)
 	locking
 endif
 
+CFLOW_DIR = lib
+CFLOW_LIST = $(SOURCES)
+CFLOW_TARGET = $(LIB_NAME).cflow
+
 include $(top_builddir)/make.tmpl
 
 $(SUBDIRS): $(LIB_STATIC)
-
-$(LIB_NAME).cflow: $(SOURCES)
-	set -e; (echo -n "SOURCES += "; \
-		 echo $(SOURCES) | \
-		 sed "s/^/ /;s/ / $(top_srcdir)\/lib\//g;s/$$//"; \
-		 ) > $@
-
-cflow: $(LIB_NAME).cflow
libdm/Makefile.in +4 -0
index 85e19ea..8874b2b 100644
@@ -47,6 +47,10 @@ endif
 VERSIONED_SHLIB = libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM)
 LIB_VERSION = $(LIB_VERSION_DM)
 
+CFLOW_DIR = libdm
+CFLOW_LIST = $(SOURCES)
+CFLOW_TARGET = libdevmapper.cflow
+
 include $(top_builddir)/make.tmpl
 
 DEFS += -DDM_DEVICE_UID=@DM_DEVICE_UID@ -DDM_DEVICE_GID=@DM_DEVICE_GID@ \
make.tmpl.in +48 -3

73 lines not on this page · raw message

tools/Makefile.in +8 -15
index 5106327..b3e5299 100644
@@ -89,7 +89,6 @@ LIB_VERSION = $(LIB_VERSION_LVM)
 
 CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) liblvm2cmd.a liblvm2cmd-static.a lvm lvm.o \
 		lvm2cmd.o lvm2cmd-static.o lvm2cmdlib.o lvm.static \
-		lvm.cflow lvm.xref lvm.tree lvm.rxref lvm.rtree \
 		lvmcmdlib.o lvm-static.o dmsetup.o $(TARGETS_DM)
 
 ifeq ("@CMDLIB@", "yes")
@@ -105,6 +104,11 @@ LVMLIBS += -ldevmapper
 
 DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
 
+CFLOW_DIR = tools
+CFLOW_LIST = lvmcmdlib.c lvm2cmd.c
+CFLOW_TARGET = liblvm2cmd.cflow
+CFLOW_GEN = lvm
+
 include $(top_builddir)/make.tmpl
 
 LIBS += $(UDEV_LIBS)
@@ -147,20 +151,9 @@ liblvm2cmd.$(LIB_SUFFIX): liblvm2cmd.a $(LDDEPS)
 	install_tools_dynamic install_tools_static
 
 ifneq ("$(CFLOW_CMD)", "")
-CFLOW_FLAGS += --cpp="$(CC) -E"
-.PHONY: lvm.cflow
--include $(top_srcdir)/lib/liblvm-internal.cflow
-lvm.cflow: $(SOURCES)
-	$(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) $(INCLUDES) $(DEFS) $(SOURCES)
-lvm.rxref: $(SOURCES)
-	$(CFLOW_CMD) -o$@ --cpp="$(CC) -E" -r --omit-arguments -x $(INCLUDES) $(DEFS) $(SOURCES)
-lvm.xref: $(SOURCES)
-	$(CFLOW_CMD) -o$@ --cpp="$(CC) -E" --omit-arguments -x $(INCLUDES) $(DEFS) $(SOURCES)
-lvm.rtree: $(SOURCES)
-	$(CFLOW_CMD) -o$@ --cpp="$(CC) -E" -r --omit-arguments -T -b $(INCLUDES) $(DEFS) $(SOURCES)
-lvm.tree: $(SOURCES)
-	$(CFLOW_CMD) -o$@ --cpp="$(CC) -E" --omit-arguments -T -b $(INCLUDES) $(DEFS) $(SOURCES)
-cflow: lvm.cflow lvm.xref lvm.tree lvm.rtree lvm.rxref
+CFLOW_SOURCES = $(addprefix $(top_srcdir)/tools/, $(SOURCES))
+-include $(top_builddir)/libdm/libdevmapper.cflow
+-include $(top_builddir)/lib/liblvm-internal.cflow
 endif
 
 install_cmdlib_dynamic: liblvm2cmd.$(LIB_SUFFIX)
Signature · 1 line
1.7.0.1
#7 lore raw

cover Makefile updates

In reply to Zdenek Kabelac
Quoted 3 lines · Zdenek Kabelac

This patch set fixes few minor Makefile errors mostly around clean & distclean targets. Major topic is the update of cflow rules.

Go for it - check them in.

It's a bit of a hack, but 'make distclean' attempts to clean up everything regardless of what configuration options were used last time the configure script was run: it has to try to clean up stuff that was created by previous configure options.

Alasdair