[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 9 of 9 RFC v2] blktap3/libblktapctl: Introduce makefile that builds tapback-required libblktapctl functionality



This patch imports control/Makefile from the existing blktap2 implementation,
building only the libblktapctl functionality required by the tapback daemon.
The rest of the binaries/functionality will be introduced by a later patch.

Defines TAPDISK_EXEC, TAPDISK_EXECDIR, and TAPDISK_BUILDDIR are used by
tap-ctl-spawn, as it needs to know where the tapdisk binary is located in order
to spawn a tapdisk process. Variables TAPDISK_EXEC and TAPDISK_EXECDIR are
declared in config/StdGNU.mk and end up as #define's using buildmakevars2file,
just like libxl does.

diff --git a/Config.mk b/Config.mk
--- a/Config.mk
+++ b/Config.mk
@@ -147,7 +147,7 @@ define buildmakevars2file-closure
        $(foreach var,                                                      \
                  SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR     \
                  XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
-                 XEN_RUN_DIR XEN_PAGING_DIR,                               \
+                 XEN_RUN_DIR XEN_PAGING_DIR TAPDISK_EXEC TAPDISK_EXECDIR,  \
                  echo "$(var)=\"$($(var))\"" >>$(1).tmp;)        \
        $(call move-if-changed,$(1).tmp,$(1))
 endef
diff --git a/config/StdGNU.mk b/config/StdGNU.mk
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -77,3 +77,6 @@ ifeq ($(lto),y)
 CFLAGS += -flto
 LDFLAGS-$(clang) += -plugin LLVMgold.so
 endif
+
+TAPDISK_EXEC = "tapdisk"
+TAPDISK_EXECDIR = $(LIBEXEC)
diff --git a/tools/blktap2/control/Makefile b/tools/blktap3/control/Makefile
copy from tools/blktap2/control/Makefile
copy to tools/blktap3/control/Makefile
--- a/tools/blktap2/control/Makefile
+++ b/tools/blktap3/control/Makefile
@@ -6,40 +6,45 @@ MINOR              = 0
 LIBNAME            = libblktapctl
 LIBSONAME          = $(LIBNAME).so.$(MAJOR)
 
-IBIN               = tap-ctl
+genpath-target = $(call buildmakevars2file,_paths.h.tmp)
+$(eval $(genpath-target))
 
-CFLAGS            += -Werror
-CFLAGS            += -Wno-unused
-CFLAGS            += -I../include -I../drivers
-CFLAGS            += $(CFLAGS_xeninclude)
-CFLAGS            += $(CFLAGS_libxenctrl)
-CFLAGS            += -D_GNU_SOURCE
-CFLAGS            += -DTAPCTL
+_paths.h: genpath
+       sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@.tmp >$@.2.tmp
+       rm -f $@.tmp
+       $(call move-if-changed,$@.2.tmp,$@)
 
-CTL_OBJS  := tap-ctl-ipc.o
+override CFLAGS += \
+       -I../include \
+       -DTAPDISK_BUILDDIR='"../drivers"' \
+       $(CFLAGS_xeninclude) \
+       $(CFLAGS_libxenctrl) \
+       -D_GNU_SOURCE \
+       -DTAPCTL \
+    -Wall \
+    -Wextra \
+    -Werror
+
+# FIXME cause trouble
+override CFLAGS += \
+    -Wno-type-limits \
+    -Wno-missing-field-initializers \
+    -Wno-sign-compare
+
 CTL_OBJS  += tap-ctl-list.o
-CTL_OBJS  += tap-ctl-allocate.o
-CTL_OBJS  += tap-ctl-free.o
-CTL_OBJS  += tap-ctl-create.o
-CTL_OBJS  += tap-ctl-destroy.o
+CTL_OBJS  += tap-ctl-info.o
+CTL_OBJS  += tap-ctl-xen.o
+CTL_OBJS  += tap-ctl-ipc.o
 CTL_OBJS  += tap-ctl-spawn.o
-CTL_OBJS  += tap-ctl-attach.o
-CTL_OBJS  += tap-ctl-detach.o
-CTL_OBJS  += tap-ctl-open.o
-CTL_OBJS  += tap-ctl-close.o
-CTL_OBJS  += tap-ctl-pause.o
-CTL_OBJS  += tap-ctl-unpause.o
-CTL_OBJS  += tap-ctl-major.o
-CTL_OBJS  += tap-ctl-check.o
+
+tap-ctl-spawn.o: _paths.h
 
 CTL_PICS  = $(patsubst %.o,%.opic,$(CTL_OBJS))
 
-OBJS = $(CTL_OBJS) tap-ctl.o
 PICS = $(CTL_PICS)
 
 LIB_STATIC = $(LIBNAME).a
 LIB_SHARED = $(LIBSONAME).$(MINOR)
-IBIN = tap-ctl
 
 all: build
 
@@ -51,27 +56,24 @@ build: $(IBIN) $(LIB_STATIC) $(LIB_SHARE
 $(LIBSONAME): $(LIB_SHARED)
        ln -sf $< $@
 
-tap-ctl: tap-ctl.o $(LIBNAME).so
-       $(CC) $(LDFLAGS) -o $@ $^
-
 $(LIB_STATIC): $(CTL_OBJS)
        $(AR) r $@ $^
 
 $(LIB_SHARED): $(CTL_PICS)
        $(CC) $(LDFLAGS) -fPIC  -Wl,$(SONAME_LDFLAG) -Wl,$(LIBSONAME) 
$(SHLIB_LDFLAGS) -rdynamic $^ -o $@
 
-install: $(IBIN) $(LIB_STATIC) $(LIB_SHARED)
+install: $(LIB_STATIC) $(LIB_SHARED)
        $(INSTALL_DIR) -p $(DESTDIR)$(SBINDIR)
-       $(INSTALL_PROG) $(IBIN) $(DESTDIR)$(SBINDIR)
        $(INSTALL_DATA) $(LIB_STATIC) $(DESTDIR)$(LIBDIR)
        $(INSTALL_PROG) $(LIB_SHARED) $(DESTDIR)$(LIBDIR)
        ln -sf $(LIBSONAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so
        ln -sf $(LIB_SHARED) $(DESTDIR)$(LIBDIR)/$(LIBSONAME)
 
 clean:
-       rm -f $(OBJS) $(PICS) $(DEPS) $(IBIN) $(LIB_STATIC) $(LIB_SHARED)
+       rm -f $(CTL_OBJS) $(PICS) $(DEPS) $(LIB_STATIC) $(LIB_SHARED)
        rm -f $(LIBNAME).so $(LIBSONAME)
        rm -f *~
+       rm -f _paths.h
 
 .PHONY: all build clean install
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.