ia64/xen-unstable

view tools/blktap2/vhd/lib/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 b7f73a7f3078
line source
1 XEN_ROOT=../../../../
2 BLKTAP_ROOT := ../../
3 include $(XEN_ROOT)/tools/Rules.mk
5 LIBVHD-MAJOR = 1.0
6 LIBVHD-MINOR = 0
7 LIBVHD-SONAME = libvhd.so.$(LIBVHD-MAJOR)
9 LVM-UTIL-OBJ := $(BLKTAP_ROOT)lvm/lvm-util.o
11 LIBVHD-BUILD := libvhd.a
13 INST-DIR = $(LIBDIR)
15 CFLAGS += -Werror
16 CFLAGS += -Wno-unused
17 CFLAGS += -I../../include
18 CFLAGS += -D_GNU_SOURCE
19 CFLAGS += -fPIC
20 CFLAGS += -g
22 LIBS := -luuid
24 # Get gcc to generate the dependencies for us.
25 CFLAGS += -Wp,-MD,.$(@F).d
26 DEPS = .*.d
28 LIB-SRCS := libvhd.c
29 LIB-SRCS += libvhd-journal.c
30 LIB-SRCS += vhd-util-coalesce.c
31 LIB-SRCS += vhd-util-create.c
32 LIB-SRCS += vhd-util-fill.c
33 LIB-SRCS += vhd-util-modify.c
34 LIB-SRCS += vhd-util-query.c
35 LIB-SRCS += vhd-util-read.c
36 LIB-SRCS += vhd-util-repair.c
37 LIB-SRCS += vhd-util-resize.c
38 LIB-SRCS += vhd-util-revert.c
39 LIB-SRCS += vhd-util-set-field.c
40 LIB-SRCS += vhd-util-snapshot.c
41 LIB-SRCS += vhd-util-scan.c
42 LIB-SRCS += vhd-util-check.c
43 LIB-SRCS += relative-path.c
44 LIB-SRCS += atomicio.c
46 LIB-OBJS = $(patsubst %.c,%.o,$(LIB-SRCS))
47 LIB-OBJS += $(LVM-UTIL-OBJ)
49 LIBVHD = libvhd.a libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR)
51 all: build
53 build: $(LIBVHD-BUILD)
55 libvhd.a: $(LIB-OBJS)
56 $(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_CFLAGS) \
57 $(LDFLAGS) -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(LIBS) $^
58 ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) libvhd.so.$(LIBVHD-MAJOR)
59 ln -sf libvhd.so.$(LIBVHD-MAJOR) libvhd.so
60 $(AR) rc $@ $^
62 install: all
63 $(INSTALL_DIR) -p $(DESTDIR)$(INST-DIR)
64 $(INSTALL_DATA) $(LIBVHD) $(DESTDIR)$(INST-DIR)
65 ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR)/libvhd.so.$(LIBVHD-MAJOR)
66 ln -sf libvhd.so.$(LIBVHD-MAJOR) $(DESTDIR)$(INST-DIR)/libvhd.so
68 clean:
69 rm -rf *.a *.so* *.o *~ $(DEPS) $(LIBVHD)
71 .PHONY: all build clean install libvhd
73 -include $(DEPS)