# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1243501377 -3600
# Node ID 241607f414c8c6b49bc6568847b28cdec2ab52f6
# Parent 8bf58f09e45a2cb021df59ddfe518ebdc6334b78
blktap2: fix makefile of blktap2
- clean up to use SUBDIRS-y
- With parallel make, libvhd might not be created before
link. guarantee it.
- use LDFLAGS for link which is set by upper level makefiles.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
tools/blktap2/Makefile | 22 +++-------------------
tools/blktap2/daemon/Makefile | 20 ++++++++------------
tools/blktap2/daemon/lib/Makefile | 2 +-
tools/blktap2/drivers/Makefile | 14 +++++++-------
tools/blktap2/lvm/Makefile | 2 +-
tools/blktap2/vhd/Makefile | 26 +++++++++++---------------
tools/blktap2/vhd/lib/Makefile | 2 +-
7 files changed, 32 insertions(+), 56 deletions(-)
diff -r 8bf58f09e45a -r 241607f414c8 tools/blktap2/Makefile
--- a/tools/blktap2/Makefile Thu May 28 10:00:55 2009 +0100
+++ b/tools/blktap2/Makefile Thu May 28 10:02:57 2009 +0100
@@ -11,24 +11,8 @@ SUBDIRS-y += drivers
SUBDIRS-y += drivers
SUBDIRS-y += daemon
-.PHONY: all
-all: build
-
-.PHONY: build
-build:
- @set -e; for subdir in $(SUBDIRS-y); do \
- $(MAKE) -C $$subdir all; \
- done
-
-.PHONY: install
-install:
- @set -e; for subdir in $(SUBDIRS-y); do \
- $(MAKE) -C $$subdir install; \
- done
-
-.PHONY: clean
clean:
rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) TAGS
- @set -e; for subdir in $(SUBDIRS-y); do \
- $(MAKE) -C $$subdir clean; \
- done
+
+.PHONY: all clean install
+all clean install: %: subdirs-%
diff -r 8bf58f09e45a -r 241607f414c8 tools/blktap2/daemon/Makefile
--- a/tools/blktap2/daemon/Makefile Thu May 28 10:00:55 2009 +0100
+++ b/tools/blktap2/daemon/Makefile Thu May 28 10:02:57 2009 +0100
@@ -2,10 +2,11 @@ BLKTAP_ROOT := ..
BLKTAP_ROOT := ..
include $(XEN_ROOT)/tools/Rules.mk
+SUBDIRS-y :=
+SUBDIRS-y += lib
+
IBIN = blktapctrl
INST_DIR = $(SBINDIR)
-
-LIBDIR = lib
LIBS := -lxenstore
LIBS += -Llib
@@ -31,25 +32,20 @@ CFLAGS += -Wp,-MD,.$(@F).d
CFLAGS += -Wp,-MD,.$(@F).d
DEPS = .*.d
-all: libblktap $(IBIN)
+all: $(IBIN)
-blktapctrl: tapdisk-daemon.c $(OBJS)
- $(CC) $(CFLAGS) -o blktapctrl tapdisk-daemon.c $(LIBS) $(OBJS)
-
-libblktap:
- @set -e
- $(MAKE) -C $(LIBDIR) all
+blktapctrl: tapdisk-daemon.c $(OBJS) subdir-all-lib
+ $(CC) $(CFLAGS) -o blktapctrl tapdisk-daemon.c $(LDFLAGS) $(LIBS)
$(OBJS)
install: all
- $(MAKE) -C $(LIBDIR) install
$(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
$(INSTALL_PROG) $(IBIN) $(DESTDIR)$(INST_DIR)
clean:
- $(MAKE) -C $(LIBDIR) clean
rm -rf *.o *~ $(IBIN) $(DEPS) xen TAGS
-.PHONY: all clean install blktapctrl libblktap
+.PHONY: all clean install blktapctrl
+all clean install: %: subdirs-%
-include $(DEPS)
diff -r 8bf58f09e45a -r 241607f414c8 tools/blktap2/daemon/lib/Makefile
--- a/tools/blktap2/daemon/lib/Makefile Thu May 28 10:00:55 2009 +0100
+++ b/tools/blktap2/daemon/lib/Makefile Thu May 28 10:02:57 2009 +0100
@@ -55,7 +55,7 @@ clean:
libblktap.a: $(OBJS)
$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_CFLAGS) \
- -o libblktap.so.$(MAJOR).$(MINOR) $^ $(LIBS)
+ $(LDFLAGS) -o libblktap.so.$(MAJOR).$(MINOR) $^ $(LIBS)
ln -sf libblktap.so.$(MAJOR).$(MINOR) libblktap.so.$(MAJOR)
ln -sf libblktap.so.$(MAJOR) libblktap.so
$(AR) rc $@ libblktap.so
diff -r 8bf58f09e45a -r 241607f414c8 tools/blktap2/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile Thu May 28 10:00:55 2009 +0100
+++ b/tools/blktap2/drivers/Makefile Thu May 28 10:02:57 2009 +0100
@@ -72,28 +72,28 @@ all: $(IBIN) lock-util qcow-util
all: $(IBIN) lock-util qcow-util
tapdisk: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk.c
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.c
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
tapdisk-client: tapdisk-client.o
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS_img)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LDFLAGS_img)
tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
td-util: td.o tapdisk-utils.o tapdisk-log.o
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS_img)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LDFLAGS_img)
lock-util: lock.c
- $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LIBS)
+ $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) $(LIBS)
.PHONY: qcow-util
qcow-util: img2qcow qcow2raw qcow-create
img2qcow qcow2raw qcow-create: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
install: all
$(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
diff -r 8bf58f09e45a -r 241607f414c8 tools/blktap2/lvm/Makefile
--- a/tools/blktap2/lvm/Makefile Thu May 28 10:00:55 2009 +0100
+++ b/tools/blktap2/lvm/Makefile Thu May 28 10:02:57 2009 +0100
@@ -28,7 +28,7 @@ install: all
install: all
lvm-util: lvm-util.o
- $(CC) $(CFLAGS) -DLVM_UTIL -o lvm-util lvm-util.c
+ $(CC) $(CFLAGS) -DLVM_UTIL $(LDFLAGS) -o lvm-util lvm-util.c
clean:
rm -rf *.o *~ $(DEPS) $(IBIN)
diff -r 8bf58f09e45a -r 241607f414c8 tools/blktap2/vhd/Makefile
--- a/tools/blktap2/vhd/Makefile Thu May 28 10:00:55 2009 +0100
+++ b/tools/blktap2/vhd/Makefile Thu May 28 10:02:57 2009 +0100
@@ -2,10 +2,11 @@ BLKTAP_ROOT := ../
BLKTAP_ROOT := ../
include $(XEN_ROOT)/tools/Rules.mk
+SUBDIRS-y :=
+SUBDIRS-y += lib
+
IBIN = vhd-util vhd-update
INST_DIR = $(SBINDIR)
-
-LIBDIR = lib
CFLAGS += -Werror
CFLAGS += -Wno-unused
@@ -20,7 +21,7 @@ CFLAGS += -static
CFLAGS += -static
endif
-LIBS := -L$(LIBDIR) -lvhd
+LIBS := -Llib -lvhd
LIBS += -luuid
# Get gcc to generate the dependencies for us.
@@ -29,27 +30,22 @@ DEPS = .*.d
all: build
-build: libvhd $(IBIN)
+build: $(IBIN)
-libvhd:
- @set -e
- $(MAKE) -C $(LIBDIR) all
+vhd-util: vhd-util.o subdir-all-lib
+ $(CC) $(CFLAGS) -o vhd-util vhd-util.o $(LDFLAGS) $(LIBS)
-vhd-util: vhd-util.o
- $(CC) $(CFLAGS) -o vhd-util vhd-util.o $(LIBS)
-
-vhd-update: vhd-update.o
- $(CC) $(CFLAGS) -o vhd-update vhd-update.o $(LIBS)
+vhd-update: vhd-update.o subdir-all-lib
+ $(CC) $(CFLAGS) -o vhd-update vhd-update.o $(LDFLAGS) $(LIBS)
install: all
- $(MAKE) -C $(LIBDIR) install
$(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
$(INSTALL_PROG) $(IBIN) $(DESTDIR)$(INST_DIR)
clean:
- $(MAKE) -C $(LIBDIR) clean
rm -rf *.o *~ $(DEPS) $(IBIN)
-.PHONY: all build clean install libvhd vhd-util vhd-update
+.PHONY: all build clean install vhd-util vhd-update
+all clean install: %: subdirs-%
-include $(DEPS)
diff -r 8bf58f09e45a -r 241607f414c8 tools/blktap2/vhd/lib/Makefile
--- a/tools/blktap2/vhd/lib/Makefile Thu May 28 10:00:55 2009 +0100
+++ b/tools/blktap2/vhd/lib/Makefile Thu May 28 10:02:57 2009 +0100
@@ -54,7 +54,7 @@ build: $(LIBVHD-BUILD)
libvhd.a: $(LIB-OBJS)
$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_CFLAGS) \
- -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(LIBS) $^
+ $(LDFLAGS) -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(LIBS)
$^
ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR)
libvhd.so.$(LIBVHD-MAJOR)
ln -sf libvhd.so.$(LIBVHD-MAJOR) libvhd.so
$(AR) rc $@ $^
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|