1 | XEN_ROOT = ../../.. |
---|
2 | include $(XEN_ROOT)/tools/Rules.mk |
---|
3 | |
---|
4 | MAJOR = 3.0 |
---|
5 | MINOR = 0 |
---|
6 | SONAME = libblktap.so.$(MAJOR) |
---|
7 | |
---|
8 | BLKTAP_INSTALL_DIR = /usr/sbin |
---|
9 | |
---|
10 | INCLUDES += -I. -I.. -I $(XEN_LIBXC) -I $(XEN_XENSTORE) |
---|
11 | |
---|
12 | LIBS := -lz |
---|
13 | |
---|
14 | SRCS := |
---|
15 | SRCS += xenbus.c blkif.c xs_api.c |
---|
16 | |
---|
17 | CFLAGS += -Werror |
---|
18 | CFLAGS += -Wno-unused |
---|
19 | CFLAGS += -fno-strict-aliasing -fPIC |
---|
20 | # get asprintf(): |
---|
21 | CFLAGS += -D _GNU_SOURCE |
---|
22 | |
---|
23 | # Get gcc to generate the dependencies for us. |
---|
24 | CFLAGS += -Wp,-MD,.$(@F).d |
---|
25 | CFLAGS += $(INCLUDES) |
---|
26 | DEPS = .*.d |
---|
27 | |
---|
28 | OBJS = $(patsubst %.c,%.o,$(SRCS)) |
---|
29 | IBINS := |
---|
30 | |
---|
31 | LIB = libblktap.a libblktap.so.$(MAJOR).$(MINOR) |
---|
32 | |
---|
33 | .PHONY: all |
---|
34 | all: build |
---|
35 | |
---|
36 | .PHONY: build |
---|
37 | build: libblktap.a |
---|
38 | |
---|
39 | .PHONY: libblktap |
---|
40 | libblktap: libblktap.a |
---|
41 | |
---|
42 | install: all |
---|
43 | $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR) |
---|
44 | $(INSTALL_DIR) $(DESTDIR)/usr/include |
---|
45 | $(INSTALL_PROG) $(LIB) $(DESTDIR)/usr/$(LIBDIR) |
---|
46 | ln -sf libblktap.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libblktap.so.$(MAJOR) |
---|
47 | ln -sf libblktap.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libblktap.so |
---|
48 | $(INSTALL_PROG) blktaplib.h $(DESTDIR)/usr/include |
---|
49 | |
---|
50 | clean: |
---|
51 | rm -rf *.a *.so* *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS |
---|
52 | |
---|
53 | libblktap.a: $(OBJS) |
---|
54 | $(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_CFLAGS) \ |
---|
55 | -L$(XEN_XENSTORE) -l xenstore \ |
---|
56 | -o libblktap.so.$(MAJOR).$(MINOR) $^ $(LIBS) |
---|
57 | ln -sf libblktap.so.$(MAJOR).$(MINOR) libblktap.so.$(MAJOR) |
---|
58 | ln -sf libblktap.so.$(MAJOR) libblktap.so |
---|
59 | $(AR) rc $@ libblktap.so |
---|
60 | |
---|
61 | .PHONY: TAGS all build clean install libblktap |
---|
62 | |
---|
63 | TAGS: |
---|
64 | etags -t $(SRCS) *.h |
---|
65 | |
---|
66 | -include $(DEPS) |
---|
67 | |
---|