Please discard the previous one. I sent the patch too early.
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>
diff --git a/tools/blktap2/Makefile b/tools/blktap2/Makefile
--- a/tools/blktap2/Makefile
+++ b/tools/blktap2/Makefile
@@ -11,24 +11,8 @@ SUBDIRS-y += vhd
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 --git a/tools/blktap2/daemon/Makefile b/tools/blktap2/daemon/Makefile
--- a/tools/blktap2/daemon/Makefile
+++ b/tools/blktap2/daemon/Makefile
@@ -2,11 +2,12 @@ XEN_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
LIBS += -lblktap
@@ -31,25 +32,20 @@ CFLAGS += -g
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 --git a/tools/blktap2/daemon/lib/Makefile
b/tools/blktap2/daemon/lib/Makefile
--- a/tools/blktap2/daemon/lib/Makefile
+++ b/tools/blktap2/daemon/lib/Makefile
@@ -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 --git a/tools/blktap2/drivers/Makefile b/tools/blktap2/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile
+++ b/tools/blktap2/drivers/Makefile
@@ -72,28 +72,28 @@ BLK-OBJS-y += aes.o
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 --git a/tools/blktap2/lvm/Makefile b/tools/blktap2/lvm/Makefile
--- a/tools/blktap2/lvm/Makefile
+++ b/tools/blktap2/lvm/Makefile
@@ -28,7 +28,7 @@ build: $(TEST) $(LVM-OBJS)
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 --git a/tools/blktap2/vhd/Makefile b/tools/blktap2/vhd/Makefile
--- a/tools/blktap2/vhd/Makefile
+++ b/tools/blktap2/vhd/Makefile
@@ -2,11 +2,12 @@ XEN_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
CFLAGS += -I../include
@@ -20,7 +21,7 @@ ifeq ($(VHD_STATIC),y)
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 --git a/tools/blktap2/vhd/lib/Makefile b/tools/blktap2/vhd/lib/Makefile
--- a/tools/blktap2/vhd/lib/Makefile
+++ b/tools/blktap2/vhd/lib/Makefile
@@ -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 $@ $^
--
yamahata
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|