ia64/xen-unstable

view tools/blktap2/drivers/Makefile @ 19667:241607f414c8

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@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 28 10:02:57 2009 +0100 (2009-05-28)
parents 1c627434605e
children 4f779d41b0ba
line source
1 XEN_ROOT=../../../
2 BLKTAP_ROOT= ..
3 include $(XEN_ROOT)/tools/Rules.mk
5 LIBVHDDIR = $(BLKTAP_ROOT)/vhd/lib
7 IBIN = tapdisk 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 ($(shell . ./check_gcrypt $(CC)),yes)
28 CFLAGS += -DUSE_GCRYPT
29 CRYPT_LIB += -lgcrypt
30 else
31 CRYPT_LIB += -lcrypto
32 $(warning === libgcrypt not installed: falling back to libcrypto ===)
33 endif
35 LDFLAGS_img := $(CRYPT_LIB) -lpthread -lz
37 tapdisk tapdisk2 td-util tapdisk-stream tapdisk-diff $(QCOW_UTIL): LIBS += -L$(LIBVHDDIR) -lvhd -luuid
39 LIBAIO_DIR = $(XEN_ROOT)/tools/libaio/src
40 tapdisk tapdisk2 tapdisk-stream tapdisk-diff $(QCOW_UTIL): AIOLIBS := $(LIBAIO_DIR)/libaio.a
41 tapdisk tapdisk-client tapdisk-stream tapdisk-diff $(QCOW_UTIL): CFLAGS += -I$(LIBAIO_DIR) -I$(XEN_LIBXC)
43 ifeq ($(VHD_STATIC),y)
44 td-util: CFLAGS += -static
45 endif
47 TAP-OBJS-y := scheduler.o
48 TAP-OBJS-y += tapdisk-ipc.o
49 TAP-OBJS-y += tapdisk-vbd.o
50 TAP-OBJS-y += tapdisk-image.o
51 TAP-OBJS-y += tapdisk-driver.o
52 TAP-OBJS-y += tapdisk-interface.o
53 TAP-OBJS-y += tapdisk-server.o
54 TAP-OBJS-y += tapdisk-queue.o
55 TAP-OBJS-y += tapdisk-filter.o
56 TAP-OBJS-y += tapdisk-log.o
57 TAP-OBJS-y += tapdisk-utils.o
58 TAP-OBJS-y += io-optimize.o
59 TAP-OBJS-y += lock.o
60 TAP-OBJS-$(CONFIG_Linux) += blk_linux.o
62 MISC-OBJS-y := atomicio.o
64 BLK-OBJS-y := block-aio.o
65 BLK-OBJS-y += block-ram.o
66 BLK-OBJS-y += block-cache.o
67 BLK-OBJS-y += block-vhd.o
68 BLK-OBJS-y += block-log.o
69 BLK-OBJS-y += block-qcow.o
70 BLK-OBJS-y += aes.o
72 all: $(IBIN) lock-util qcow-util
74 tapdisk: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk.c
75 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
77 tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.c
78 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
80 tapdisk-client: tapdisk-client.o
81 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LDFLAGS_img)
83 tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
84 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
86 td-util: td.o tapdisk-utils.o tapdisk-log.o
87 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LDFLAGS_img)
89 lock-util: lock.c
90 $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) $(LIBS)
92 .PHONY: qcow-util
93 qcow-util: img2qcow qcow2raw qcow-create
95 img2qcow qcow2raw qcow-create: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
96 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(LDFLAGS_img)
98 install: all
99 $(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
100 $(INSTALL_PROG) $(IBIN) $(LOCK_UTIL) $(QCOW_UTIL) $(DESTDIR)$(INST_DIR)
102 clean:
103 rm -rf *.o *~ xen TAGS $(IBIN) $(LIB) $(LOCK_UTIL) $(QCOW_UTIL)
105 .PHONY: clean install