ia64/xen-unstable

view tools/blktap/Makefile @ 7238:971e7c7411b3

Raise an exception if an error appears on the pipes to our children, and make
sure that the child's pipes are closed even under that exception. Move the
handling of POLLHUP to the end of the loop, so that we guarantee to read any
remaining data from the child if POLLHUP and POLLIN appear at the same time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Oct 06 10:13:11 2005 +0100 (2005-10-06)
parents 06d84bf87159
children 82e48750542c
line source
1 MAJOR = 2.0
2 MINOR = 0
3 SONAME = libblktap.so.$(MAJOR)
5 XEN_ROOT = ../..
6 include $(XEN_ROOT)/tools/Rules.mk
8 SUBDIRS :=
9 SUBDIRS += ublkback
10 #SUBDIRS += parallax
12 BLKTAP_INSTALL_DIR = /usr/sbin
14 INSTALL = install
15 INSTALL_PROG = $(INSTALL) -m0755
16 INSTALL_DIR = $(INSTALL) -d -m0755
18 INCLUDES += -I. -I $(XEN_LIBXC) -I $(XEN_XENSTORE)
20 LIBS := -lpthread -lz
22 SRCS :=
23 SRCS += blktaplib.c xenbus.c blkif.c
25 CFLAGS += -Wall
26 CFLAGS += -Werror
27 CFLAGS += -Wno-unused
28 #CFLAGS += -O3
29 CFLAGS += -g3
30 CFLAGS += -fno-strict-aliasing
31 CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
32 # get asprintf():
33 CFLAGS += -D _GNU_SOURCE
34 # Get gcc to generate the dependencies for us.
35 CFLAGS += -Wp,-MD,.$(@F).d
36 CFLAGS += $(INCLUDES)
37 DEPS = .*.d
39 OBJS = $(patsubst %.c,%.o,$(SRCS))
40 IBINS :=
41 #IBINS += blkdump
43 LIB = libblktap.so libblktap.so.$(MAJOR) libblktap.so.$(MAJOR).$(MINOR)
45 all: mk-symlinks libblktap.so #blkdump
46 @set -e; for subdir in $(SUBDIRS); do \
47 $(MAKE) -C $$subdir $@; \
48 done
50 LINUX_ROOT := $(wildcard $(XEN_ROOT)/linux-2.6.*-xen-sparse)
51 mk-symlinks:
52 [ -e xen/linux ] || mkdir -p xen/linux
53 [ -e xen/io ] || mkdir -p xen/io
54 ( cd xen >/dev/null ; \
55 ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
56 ( cd xen/io >/dev/null ; \
57 ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
58 ( cd xen/linux >/dev/null ; \
59 ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
61 install: all
62 $(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
63 $(INSTALL_DIR) -p $(DESTDIR)/usr/include
64 $(INSTALL_PROG) $(LIB) $(DESTDIR)/usr/$(LIBDIR)
65 $(INSTALL_PROG) blktaplib.h $(DESTDIR)/usr/include
66 #$(INSTALL_PROG) $(IBINS) $(DESTDIR)$(BLKTAP_INSTALL_DIR)
67 @set -e; for subdir in $(SUBDIRS); do \
68 $(MAKE) -C $$subdir $@; \
69 done
71 clean:
72 rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS blkdump
73 @set -e; for subdir in $(SUBDIRS); do \
74 $(MAKE) -C $$subdir $@; \
75 done
77 rpm: all
78 rm -rf staging
79 mkdir staging
80 mkdir staging/i386
81 rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
82 --define "_rpmdir$$PWD/staging" -bb rpm.spec
83 mv staging/i386/*.rpm .
84 rm -rf staging
86 libblktap.so: $(OBJS)
87 $(CC) $(CFLAGS) -Wl,-soname -Wl,$(SONAME) -shared \
88 -L$(XEN_XENSTORE) -l xenstore \
89 -o libblktap.so.$(MAJOR).$(MINOR) $^ $(LIBS)
90 ln -sf libblktap.so.$(MAJOR).$(MINOR) libblktap.so.$(MAJOR)
91 ln -sf libblktap.so.$(MAJOR) $@
93 blkdump: libblktap.so
94 $(CC) $(CFLAGS) -o blkdump -L$(XEN_LIBXC) -L. \
95 -l blktap blkdump.c
97 .PHONY: TAGS clean install mk-symlinks rpm
99 TAGS:
100 etags -t $(SRCS) *.h
102 -include $(DEPS)