ia64/xen-unstable

view tools/blktap2/drivers/Makefile @ 19817:b7f73a7f3078

blktap2: portability fixes for NetBSD

- Use standard off_t and lseek() instead of non-portable off64_t and
lseek64()
- Use uuid API as documented in DCE 1.1 RPC specification
- Add NetBSD implementation for blk_getimagesize() and
blk_getsectorsize()
- Use blk_getimagesize() and blk_getsectorsize()
- Fix uuid header check

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 23 17:24:14 2009 +0100 (2009-06-23)
parents 4f779d41b0ba
children
line source
1 XEN_ROOT=../../../
2 BLKTAP_ROOT= ..
3 include $(XEN_ROOT)/tools/Rules.mk
5 LIBVHDDIR = $(BLKTAP_ROOT)/vhd/lib
7 IBIN = tapdisk2 td-util tapdisk-client tapdisk-stream tapdisk-diff
8 QCOW_UTIL = img2qcow qcow-create qcow2raw
9 LOCK_UTIL = lock-util
10 INST_DIR = $(SBINDIR)
12 CFLAGS += -Werror -g -O0
13 CFLAGS += -Wno-unused
14 CFLAGS += -fno-strict-aliasing
15 CFLAGS += -I../lib -I../../libxc
16 CFLAGS += -I../include -I../../include
17 CFLAGS += -I $(LIBAIO_DIR)
18 CFLAGS += -D_GNU_SOURCE
19 CFLAGS += -DUSE_NFS_LOCKS
21 ifeq ($(CONFIG_X86_64),y)
22 CFLAGS += -fPIC
23 endif
25 LIBS += -lrt -lz
27 ifeq ($(CONFIG_Linux),y)
28 ifeq ($(shell . ./check_gcrypt $(CC)),yes)
29 CFLAGS += -DUSE_GCRYPT
30 CRYPT_LIB += -lgcrypt
31 else
32 CRYPT_LIB += -lcrypto
33 $(warning === libgcrypt not installed: falling back to libcrypto ===)
34 endif
35 else
36 CRYPT_LIB += -lcrypto
37 endif
39 LDFLAGS_img := $(CRYPT_LIB) -lpthread -lz
41 LIBS += -L$(LIBVHDDIR) -lvhd
43 ifeq ($(CONFIG_Linux),y)
44 LIBS += -luuid
45 endif
47 LIBAIO_DIR = $(XEN_ROOT)/tools/libaio/src
48 tapdisk2 tapdisk-stream tapdisk-diff $(QCOW_UTIL): AIOLIBS := $(LIBAIO_DIR)/libaio.a
49 tapdisk-client tapdisk-stream tapdisk-diff $(QCOW_UTIL): CFLAGS += -I$(LIBAIO_DIR) -I$(XEN_LIBXC)
51 ifeq ($(VHD_STATIC),y)
52 td-util: CFLAGS += -static
53 endif
55 PORTABLE-OBJS-y :=
56 PORTABLE-OBJS-$(CONFIG_Linux) += blk_linux.o
57 PORTABLE-OBJS-$(CONFIG_NetBSD) += blk_netbsd.o
59 TAP-OBJS-y := scheduler.o
60 TAP-OBJS-y += tapdisk-ipc.o
61 TAP-OBJS-y += tapdisk-vbd.o
62 TAP-OBJS-y += tapdisk-image.o
63 TAP-OBJS-y += tapdisk-driver.o
64 TAP-OBJS-y += tapdisk-interface.o
65 TAP-OBJS-y += tapdisk-server.o
66 TAP-OBJS-y += tapdisk-queue.o
67 TAP-OBJS-y += tapdisk-filter.o
68 TAP-OBJS-y += tapdisk-log.o
69 TAP-OBJS-y += tapdisk-utils.o
70 TAP-OBJS-y += io-optimize.o
71 TAP-OBJS-y += lock.o
72 TAP-OBJS-y += $(PORTABLE-OBJS-y)
74 MISC-OBJS-y := atomicio.o
76 BLK-OBJS-y := block-aio.o
77 BLK-OBJS-y += block-ram.o
78 BLK-OBJS-y += block-cache.o
79 BLK-OBJS-y += block-vhd.o
80 BLK-OBJS-y += block-log.o
81 BLK-OBJS-y += block-qcow.o
82 BLK-OBJS-y += aes.o
83 BLK-OBJS-y += $(PORTABLE-OBJS-y)
85 all: $(IBIN) lock-util qcow-util
88 tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.c
89 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
91 tapdisk-client: tapdisk-client.o
92 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LDFLAGS_img)
94 tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
95 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
97 td-util: td.o tapdisk-utils.o tapdisk-log.o $(PORTABLE-OBJS-y)
98 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LDFLAGS_img)
100 lock-util: lock.c
101 $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) $(LIBS)
103 .PHONY: qcow-util
104 qcow-util: img2qcow qcow2raw qcow-create
106 img2qcow qcow2raw qcow-create: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
107 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
109 install: all
110 $(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
111 $(INSTALL_PROG) $(IBIN) $(LOCK_UTIL) $(QCOW_UTIL) $(DESTDIR)$(INST_DIR)
113 clean:
114 rm -rf *.o *~ xen TAGS $(IBIN) $(LIB) $(LOCK_UTIL) $(QCOW_UTIL)
116 .PHONY: clean install